News for hackers. Stuff that matters.
Re:You don't really need a virtualenv by dissent on Thursday February 04, 2021 @06:46AM (#26024552)
Thanks for writing this. I've always felt that virtualenv was bit of a placebo. I still use it from time to time though because others expect it. In fact I have used it this week on MacOS, and was annoyed to find that I can't install ipdb to my user packages and still see it in a virtualenv. Seems it's either global or local. (I think the --system-site-packages defaulting to off has it backwards, but it is probably reassuring if you don't know how the module finder works).

Regarding nested virtualenvs, last time I checked there was no such thing. When nested, they always linked back to the system level python, and the cloned python had loads of dependencies on the global system. I'm not aware of a valid use case for nesting virtualenvs.

There is one handy feature of virtualenv that I'm not sure __packages__ solves though: console_scripts and entry_points. setuptools will automatically create a console script under /usr/local/bin or similar which hooks in your module under site-packages. virtualenv includes a ./bin directory and adds it to your path so that these console scripts still work locally. Any thoughts on this?

Re:You don't really need a virtualenv by frostming on Thursday February 04, 2021 @08:28AM (#26025114)
__pypackages__ also has a bin/ directory and you can run the console_scripts with pdm run my_bin or by absolute path: /path/to/__pypackages__/3.8/bin/my_bin
Re:You don't really need a virtualenv by BiteCode_dev on Thursday February 04, 2021 @07:15AM (#26024709)
-m is the replacement for console scripts. Well behaved cli should define a _ _ main _ _. Py

Pytest, pylint, black, pip, poetry, mypy all have one.

Jupyter one is buggy.

Re:You don't really need a virtualenv by dissent on Thursday February 04, 2021 @09:10AM (#26025413)
That's a fair point actually.