3 ms·
> Node, Rust, etc all manage it. $ (bash -c 'export foo=bar && echo $foo') bar $ echo $foo $ How do they work around this?
by zahlman 1y ago
> Node, Rust, etc all manage it.
$ (bash -c 'export foo=bar && echo $foo')
bar
$ echo $foo
$
How do they work around this?
- baq 1y agoThey don’t use environment variables. See also git.
- zahlman 1y ago... And as I explained repeatedly in multiple other posts throughout the thread, you can also use virtual environments without activating them, in which case you are similarly not using environment variables. The git model is based on automatic detection of the .git folder, by having it in a location determined by convention. Many higher-level tools in the Python ecosystem have provided analogous handling of virtual environments over the years. Uv is doing it now; historically pyenv was used for that sort of thing, for example. But when I said "which is otherwise impossible on Linux", I was specifically referring to the setting of environment variables, because OP asked why an activation script had to be sourced, and the reason is because that's what "activation" is. This is a model that enough people liked using many years ago, to become dominant. It creates the abstraction of being "in" the virtual environment, while giving you the flexibility to put the actual file tree whereever you want.
- oblio 1y agoYou're arguing an awful lot in favor of Python venvs for someone who doesn't really seem to know any other programming language ecosystems in depth. Similar mindset to the original creators of venv, I imagine :-)
- zelphirkalt 1y agoOr you don't realize the difference between something like "cargo run" and "python file.py".