Unlike Windows, environment variables work very fine for such use cases.
Windows has environment variables, doesn't it?
On Unix, direnv, dotenv, and maybe more tools are there.
I've been around Python for decades, and have never heard of these. Is this dotenv?
From the looks of it, it works on Windows too. Or it's dangerously mis-documented, which is kinds my point. We're talking about this because people that do their work on *nix systems deliver code that does not work correctly on Windows.
I think it's MUCH better to have ONE way to do something that works, for Python, on all platforms. That way people that only know one platform can still write and document code that can work on all platforms.
> Which is another good reason that having it be something that can be "turned on" by an virtual environment / requirements file would be very helpful.
There are direnv and dotenv.
It looks to me like dotenv would have to be run after Python startup -- so wouldn't help here.
direnv looks nifty, but again, not Python, and I can't quite see how it would help here, it seems to be about the current working directory.
You and Eryk certainly know the implementation details more than I, so I'll step back and talk about what I'd like to see:
1) Something that can be easily set up to be "environment" specific, where an environment can be a virtualenv, a venv, a pipenv (are they different??), a conda environment, or, hopefully whatever new environment system comes along.
2) Something that can be part of the standard environment creation step, not an extra step you need folks to do by hand. Ideally a package that could be put in a requirements file. That is, I could simply put "utf8_mode" in my requirements file(s) and anyone that installed those requirements into an environment would get it configured.
3) One way to do that that's the same on all platforms.
I *think* this is possible.
Christopher Barker, PhD (Chris)
Python Language Consulting
- Scientific Software Development
- Desktop GUI and Web Development
- wxPython, numpy, scipy, Cython