3 ms·
They don't care about the isolated environment. They care about having the right dependencies available to the script. Competing languages like Java don't need
by imtringued 2y ago
They don't care about the isolated environment. They care about having the right dependencies available to the script.
Competing languages like Java don't need or even have the concept of isolated environments. It's an illogical concept. You have a class path and that is about it.
- orf 2y agoA virtual environment is just a project-specific class path, but for Python.
- tcptomato 2y agoWhich also installs a complete JVM in it.
- zahlman 2y agoNot really; it can just symlink the base executable and make a few folders and scripts. $ python -m venv --without-pip test-venv && du -sh test-venv 56K test-venv
- dragonwriter 2y agoConceptually, a venv has its own executable. Physically, that can just be a symlink to the system python (or another version that is still potentially shared with multiple venvs.)
- simonw 2y agoThat's one of the great things about uv: it uses clever symlink tricks to avoid installing copies of things, so it's wildly fast.
- zahlman 2y ago>They care about having the right dependencies available to the script. Right; my point is that I'd expect one-off scripts like this to keep relying on the same few standard dependencies which would already have been set up in an environment somewhere. >You have a class path and that is about it. A Python venv pretty much is just a layer on top of the existing "class path" mechanism (sys.path) to point it at the right place automatically (reproducing the basic folder layout relative to a symlinked executable, so that sys.path ends up with the right paths and so that there's a dedicated folder for installing the dependencies). While it's ugly and not recommended, you can work with the PYTHONPATH environment variable, or even modify sys.path at runtime.
- SAI_Peregrinus 2y agoThe isolated environment is required because most Linux systems also depend upon Python, and can have dependency conflicts if you install development dependencies that conflict with system dependencies.
- dkarl 2y agoThe isolated environment can matter when different scripts that you use depend on libraries that have conflicting dependency requirements. > Competing languages like Java don't need or even have the concept of isolated environments The nice thing about scripts is that you can quickly add new capabilities when you need them. They are always under development. To get the same thing in Java, you need a project directory with a build file, which gives you an isolated build environment.