uv/crates/gourgeist
konsti 889f6173cc
Unify python interpreter abstractions (#178)
Previously, we had two python interpreter metadata structs, one in
gourgeist and one in puffin. Both would spawn a subprocess to query
overlapping metadata and both would appear in the cli crate, if you
weren't careful you could even have to different base interpreters at
once. This change unifies this to one set of metadata, queried and
cached once.

Another effect of this crate is proper separation of python interpreter
and venv. A base interpreter (such as `/usr/bin/python/`, but also pyenv
and conda installed python) has a set of metadata. A venv has a root and
inherits the base python metadata except for `sys.prefix`, which unlike
`sys.base_prefix`, gets set to the venv root. From the root and the
interpreter info we can compute the paths inside the venv. We can reuse
the interpreter info of the base interpreter when creating a venv
without having to query the newly created `python`.
2023-10-25 20:11:36 +00:00
..
src Unify python interpreter abstractions (#178) 2023-10-25 20:11:36 +00:00
static Copy over gourgeist crate (#61) 2023-10-08 14:37:09 -04:00
benchmark.sh Copy over gourgeist crate (#61) 2023-10-08 14:37:09 -04:00
Cargo.toml Unify python interpreter abstractions (#178) 2023-10-25 20:11:36 +00:00
compare_in_git.sh Copy over gourgeist crate (#61) 2023-10-08 14:37:09 -04:00
imasnake.py Copy over gourgeist crate (#61) 2023-10-08 14:37:09 -04:00
oranda.json Copy over gourgeist crate (#61) 2023-10-08 14:37:09 -04:00
README.md Enable release builds via cargo-dist (#79) 2023-10-09 20:48:55 +00:00
venv_checker.py Unify python interpreter abstractions (#178) 2023-10-25 20:11:36 +00:00

Gourgeist

Gourgeist is a rust library to create python virtual environments. It also has a CLI.

It currently supports only unix (linux/mac), windows support is missing.

Rust

use camino::Utf8PathBuf;
use gourgeist::{create_venv, get_interpreter_info, parse_python_cli};

let location = cli.path.unwrap_or(Utf8PathBuf::from(".venv"));
let python = parse_python_cli(cli.python)?;
let data = get_interpreter_info(&python)?;
create_venv(&location, &python, &data, cli.bare)?;

CLI

Use python as base for a virtualenv .venv:

gourgeist

Or use custom defaults:

gourgeist -p 3.11 my_env

Jessie's gourgeist

Jessie's gourgeist, a pokemon with a jack o'lantern as body