Перейти к содержимому

Your language is missing?

Help us translate this documentation!

See how to contribute translations →

python-env

Это содержимое пока не доступно на вашем языке.

python-env - HyDE Python virtual environment manager

Terminal window
python-env [command] [options]

python-env is HyDE’s Python virtual environment manager built on top of uv. It manages an isolated virtual environment stored under $XDG_STATE_HOME/hyde/python_env (usually ~/.local/state/hyde/python_env), completely separate from your system Python and any user packages.

HyDE Python scripts run inside this environment. You can extend it with extra packages without touching your system Python installation.

Execution flow after install

HyDE scripts reach the isolated environment through two entry points:

  • hyde-shell cmd.py — activates the venv via python_activate, then execs the Python interpreter.
  • Shell scripts — call $venv/bin/python script.py directly.

The system Python and user packages are never accessed.

Terminal window
python-env create

Creates the virtual environment and installs all dependencies from pyproject.toml. If a valid venv already exists, it is skipped. If a broken one is detected, it is destroyed and rebuilt automatically.


Terminal window
python-env sync

Syncs dependencies from pyproject.toml into the existing environment. Use this after pulling HyDE updates to ensure the environment is up to date.


Terminal window
python-env install <package> [package ...]

Installs one or more packages into the HyDE venv using uv add. The package is added to pyproject.toml so it persists across rebuilds.

Example:

Terminal window
python-env install requests pillow

Terminal window
python-env uninstall <package> [package ...]

Removes one or more packages from the HyDE venv using uv remove. Also removes the package from pyproject.toml.

Example:

Terminal window
python-env uninstall pillow

Terminal window
python-env destroy

Removes the entire virtual environment directory. Does not modify pyproject.toml. Run create afterward to recreate it.


Terminal window
python-env rebuild

Destroys the virtual environment and recreates it from scratch (does create & sync in behind). Useful when the environment becomes corrupted or after a Python version change.


Terminal window
python-env uv [--hyde] <uv-args> ...

Passes arguments directly to the underlying uv executable. Use --hyde to scope the command to HyDE’s venv and project directory.

Options:

--hyde : Injects UV_PROJECT_ENVIRONMENT and --project so the raw uv command operates on HyDE’s venv. Without this flag, the command runs as a plain uv call with no HyDE context.

Examples:

Terminal window
# List installed packages in HyDE's venv
python-env uv --hyde pip list
# Run uv tree scoped to the HyDE project
python-env uv --hyde tree

Some HyDE features ship as optional dependency groups in pyproject.toml. These are not installed by default to keep the environment lean.

ExtraPackagesWhen to install
amdpyamdgpuinfoAMD GPU monitoring widgets

Use the uv subcommand with --extra:

Terminal window
python-env uv --hyde sync --extra amd

This installs only the packages declared under [project.optional-dependencies] for that extra. It does not affect the rest of the environment.

You can extend the HyDE venv with your own packages. The key rule is: only add packages that HyDE does not declare.

Terminal window
# Safe — adding a package HyDE doesn't know about
python-env install my-tool
# After adding, sync is automatic — no extra step needed

To keep your additions across rebuilds:

  1. Your packages are written to pyproject.toml by uv add, so they survive sync.
  2. A full rebuild will re-install everything listed in pyproject.toml, including your additions.

UV_PROJECT_ENVIRONMENT : Overrides the venv path used by uv. Set internally by python-env to $XDG_STATE_HOME/hyde/python_env.

XDG_STATE_HOME : Base directory for the venv (default: ~/.local/state). The venv lives at $XDG_STATE_HOME/hyde/python_env.

PathDescription
$XDG_STATE_HOME/hyde/python_env/Virtual environment root
$XDG_STATE_HOME/hyde/python_env/bin/pythonPython interpreter used by HyDE scripts
<hyde-dir>/pyproject.tomlDependency declarations
<hyde-dir>/uv.lockLockfile — do not edit manually

First-time setup:

Terminal window
python-env create

Update after pulling HyDE changes:

Terminal window
python-env sync

Install AMD GPU support:

Terminal window
python-env uv --hyde sync --extra amd

Add a personal package:

Terminal window
python-env install python-dotenv

Nuke and rebuild a broken environment:

Terminal window
python-env rebuild

Inspect what is installed:

Terminal window
python-env uv --hyde pip list