Skip to main content

Module pyenv

Module pyenv 

Source
Expand description

The Python a plugin’s scripts and backend run with.

Every plugin gets byob’s helper module (byob_plugin.py, HELPER) on PYTHONPATH. A plugin that lists python.requirements gets its own virtual environment, cached under byob’s data folder and keyed by a hash of the interpreter and the requirements (so two plugins with the same list share one, and changing the list makes a new one). It is built the first time something needs it, never on the engine thread: with uv when it is on PATH (uv venv + uv pip install), else python -m venv + pip install. A failure is kept (with the installer’s output) until the plugin is reloaded, and shows as one of the plugin’s problems. A build can be called off (the tool call stopped, the backend stopped); it isn’t kept as a failure then.

Two byob processes may share the data folder: a build holds a lock file next to the environment (<venv>.lock), and the other waits for it and uses what it built. A lock whose holder stopped refreshing it (a byob that died mid-build) is taken over.

Structs§

PluginPython
One plugin’s Python: byob’s helper, and its own environment if it has requirements.
PyEnv
One virtual environment.
PyEnvs
Every plugin environment of one engine.
Python
How to start Python for one plugin.

Constants§

BUILD_CALLED_OFF
What a build that was called off says.
HELPER
byob’s Python helper for plugins (import byob_plugin).
HELPER_FILE
Its file name.