News for hackers. Stuff that matters.
Re:Why not tell people to “simply” use pyenv, poetry or anac... by abrichr on Thursday March 30, 2023 @06:42PM (#35379853)
Agreed, never had a problem with this approach.

The only limitation I've encountered is when moving the environment or renaming one of the parent directories. In which case it's easy to create a new one:

    # optional: freeze the environment if you don't already have a requirements.txt
    source .venv/bin/activate
    pip freeze > requirements.txt
    deactivate

    # remove the old environment
    rm -rf .venv

    # create a new one
    python3.10 -m venv .venv

    # activate it
    source .venv/bin/activate

    # install the requirements
    pip install -r requirements.txt
Re:Why not tell people to “simply” use pyenv, poetry or anac... by nicoburns on Thursday March 30, 2023 @06:50PM (#35379934)
I've found that venv's work. They're just very inconvenient (having to constantly manage which venv you're in when you change directory). Consider that with NPM, only two of those commands are ever needed:

    # install the requirements
    npm install

    # remove it
    rm -rf node_modules
The rest is unnecessary because NPM uses the equivalent of a venv automatically based on your current working directory and the location of your package.json file.
Re:Why not tell people to “simply” use pyenv, poetry or anac... by sureglymop on Saturday April 01, 2023 @04:09AM (#35398297)
Python has this too, check out PEP 582. There's a package manager called PDM which will just create a __pyoackages__ folder in this style.
Re:Why not tell people to “simply” use pyenv, poetry or anac... by rami3l on Saturday April 01, 2023 @06:54AM (#35399175)
As a PDM enthusiast for quite a while, I'm sorry to inform you that PEP 582 has been officially abandoned (which doesn't mean that it won't be revived someday, just not so easily). https://discuss.python.org/t/pep-582-python-local-packages-d...
Re:Why not tell people to “simply” use pyenv, poetry or anac... by pepa65 on Tuesday April 04, 2023 @04:56AM (#35436918)
This just illustrates that the most recommended solution is not easy to use, many steps one could forget. And I guess if your package manager happens to update your default python, more/other steps will be necessary...
Re:Why not tell people to “simply” use pyenv, poetry or anac... by abrichr on Tuesday April 04, 2023 @08:39AM (#35438661)
Venvs are self contained python environments, no interaction with system python.

For those already familiar with venvs, the above just condenses to “remove the old venv and create a new one”.