Expand description
A project’s environments for its scripts: what Python runs them, with which packages, and which Rust toolchain builds them. The project folder holds them, so a project (and a pipeline built in it) runs the same on another computer:
scripts/
pyproject.toml uv.lock .venv/ Python: the packages, locked; the environment
Cargo.toml Cargo.lock rust-toolchain.toml Rust: the crates, locked; the toolchain- Python runs with the environment’s own interpreter (
.venv/bin/python): the project’s.venv, else the one activated ($VIRTUAL_ENV), else the app’s default environment. uv makes and syncs it frompyproject.tomlanduv.lock(sync_python); the lock, not the.venv, is what travels (a.venvnames its base interpreter, so it is made again elsewhere). - Rust has no environment to activate:
Cargo.tomlandCargo.lockare the crates, andrust-toolchain.tomlpins the toolchain (rustup reads it from the folder Cargo runs in).ensure_rustwrites them; builds share one target folder.
Structs§
- Python
Env - A Python environment (a venv).
Enums§
- Python
Source - Where a Python environment comes from.
Functions§
- add_
python - Adds
packagesto the environment indir(uv add:pyproject.toml,uv.lockand the.venvtogether). - ensure_
rust - Makes
dira Rust environment when it is not one yet: a Cargo workspace whose members are the scripts’ crates (members, globs allowed), andrust-toolchain.tomlpinning the compiler found now. The lock (Cargo.lock) is written by the first build. Returns the toolchain pinned. - rust_
toolchain - The Rust toolchain a folder pins (
channelof itsrust-toolchain.toml). - rustc_
version - The version of the Rust compiler found (
1.95.0), the one a new pin names. - sync_
python - Makes or updates the Python environment in
dirwith uv: writespyproject.tomlfirst when there is none (withpackages, the app’s own needs such as NumPy), thenuv sync(the.venvmatchinguv.lock, made when missing). Returns uv’s report. - uv
- uv, if found:
$UV, thePATH, then where its installer puts it. - venv_
python - The interpreter inside the venv at
root, if there is one.