Live data from Hacker News

You don't really need a virtualenv

frostming.com

61–70 of 148 posts

Re: You don't really need a virtualenv

#61

Earlier quoted context omitted.

Not sure if JavaScript has anything that any other language or development tool should copy.

JavaScript's package management is significantly better than Pythons: - There's one tool to use, and it comes pre-installed - You don't have to deal with virtualenvs or packages from different projects conflicting. - Native code dependencies "just work".

That one tool must be yarnnpmgypbabelwebpack?

Re: You don't really need a virtualenv

#62

Earlier quoted context omitted.

Java is a self hosted language and has very little dependency on C/C++ or something similar. Python is glue language for C/C++/Fortran/Rust/etc. projects. Most of the valuable packages in Python in fact C++ projects (like Tensorflow, Pandas, etc.). When you are talking about Python dependency management you are talking about the Cartesian product of the packages you are depending on, their dependency in terms of comp…

> It is not hard to run into missing .h files while trying to install these dependencies. They would be if python provided the .h files in the packages rather than expecting them to already exist on the system.

That's just dangerous band-aid. If there is a mismatch between bundled .h and installed system library, you'll get (in better case) linker error, or runtime problems.

Re: You don't really need a virtualenv

#63
Thanks for giving a look and leaving so many reactions. This project was originally built to experiment on some new PEPs on Python packaging and it turned out working well.

1. What does PEP 582 differ from virtualenv, it is just another "virutualenv" The biggest difference, as you can see, is __pypackages__ doesn't carry an interpreter with it. This way the packages remain available even the base interpreter gets removed. 2. I prefer Poetry/virtualenvwrapper/Pipenv It is fine. If you feel comfortable with the current solution you are using, stick with it. I am not persuading that PDM is a better tool than those. Any of the said tools does a great job solving its own problems. PDM, IMO, does good in following aspects:

- Plugin system, people can enhance the functionalities easily with plugins - Windows support, PDM has completion support for PowerShell out of the box. Other CLI features also work as good as *nix on Windows.

Re: You don't really need a virtualenv

#64

Could someone ELI7 why python is struggling so hard with dependencies and dependency management when in the Java world this is a solved problem and just works with maven, which is working so damn well it last got updated in November 2019, and the biggest fight going is whether you should use gradle as client instead of maven to access the same dependency ecosystem? I had to set up Python projects for some machine lea…

My secret is to build a new computer every year and keep images of the old ones with all my packages and libraries. Trying to run a tensorflow GitHub library from 2013? Easy just use the computer with that image

Re: You don't really need a virtualenv

#65

> One day a minor release of Python is out It is decidedly not true that I want to update my venv for every minor version bump! I deploy to a cloud service w/ a specific version; my package manager is slow to update; I develop collaboratively using a shared container w/ a fixed version. Updating shared resources with every new release is not always realistic, and that makes it so that I do need (or at least want ) to…

> It is decidedly not true that I want to update my venv for every minor version bump!

Until you run into a minor version bump that patches a critical security vulnerability, and then you suddenly may very much want to (and in some corporate environments, have a regulatory requirement to)

Re: You don't really need a virtualenv

#66

Earlier quoted context omitted.

Java is a self hosted language and has very little dependency on C/C++ or something similar. Python is glue language for C/C++/Fortran/Rust/etc. projects. Most of the valuable packages in Python in fact C++ projects (like Tensorflow, Pandas, etc.). When you are talking about Python dependency management you are talking about the Cartesian product of the packages you are depending on, their dependency in terms of comp…

> It is not hard to run into missing .h files while trying to install these dependencies. They would be if python provided the .h files in the packages rather than expecting them to already exist on the system.

That's a terrible idea, all you'd end up with is a bunch of headers mismatched to actual system libraries.

Re: You don't really need a virtualenv

#67
post #26

Earlier quoted context omitted.

Honestly just use poetry.

Poetry shell doesn't work on windows, and it doesn't have named venv which matters for some users. Also it's very slow, require to be installed and use proprietary fields in pyproject.toml. It's a great tool but there are reasons you might want something else. Alternative like raw pip, pip tools, or dephell all have various pros and cons.

>Poetry shell doesn't work on windows

What do you mean it doesn't work? It works fine on Windows here, unless I am missing something.

Re: You don't really need a virtualenv

#68
post #30

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 r…

__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

#69

This looks interesting, but personally I don't have any problems with virtualenvs. I use pipx to install "global" tools and virtualenvwrapper to make project envs. It all works fine really.

As I wrote in the post, you cannot make two tools isolated in their own environment work together(work together meaning one needs to import from the other). The only way to make it is to install one tool in the global site-packages and create the other virtualenvs with --system-sitepackages and this flag is off by default.

Re: You don't really need a virtualenv

#70

Earlier quoted context omitted.

Not sure if JavaScript has anything that any other language or development tool should copy.

JavaScript's package management is significantly better than Pythons: - There's one tool to use, and it comes pre-installed - You don't have to deal with virtualenvs or packages from different projects conflicting. - Native code dependencies "just work".

> You don't have to deal with virtualenvs or packages from different projects conflicting.

That's only because you're basically assured there will be conflicts inside any single project. Every time I install anything via npm I get a boatload of warnings about insecure dependencies, which are effectively impossible to fix without breaking the whole mountain of hacks.

There are good deployment stories out there. JS is not one of them.

Post reply on HN