News for hackers. Stuff that matters.
Re:Show HN: Virtualenv-mv – Move (rename) Python virtualenvs by m_mueller on Sunday June 12, 2016 @02:16AM (#11886895)
> a better wrapper around virtual environments compared to virtualenv wrapper

This comment alone tells me there's something wrong about python's modularisation. And I'm saying this as a python programmer. Why didn't Python 3 clean up this mess? Or am I missing something there?

Re:Show HN: Virtualenv-mv – Move (rename) Python virtualenvs by agumonkey on Sunday June 12, 2016 @04:20AM (#11887207)
Seems to me that virtualenv was a quick n dirty solution that hardcoded a lot of things in the subtree; but that proved extremely useful at the time so it became a standard.
Re:Show HN: Virtualenv-mv – Move (rename) Python virtualenvs by bhntr3 on Sunday June 12, 2016 @03:10PM (#11889732)
Dependency management isn't really a solved problem in any language ecosystem or operating system AFAIK. I'd love an example of the best case.

I feel like this is why things like Docker exist.

For a language like python, I'm not sure this is something you would really want to try to solve at the language level. Let's say you solved it for pure python code. You'd still have the problem of interfacing with native libraries and the OS itself. For instance, NumPy and SciPy are typically kind of a pain due to Fortran dependencies.

I think Docker is a pretty nice solution. I feel like for any language, any time this becomes painful, I assume I should either be using Docker or AWS+Chef. Disposable VMs essentially.

In a sense, virtualenv is a lot like a VM. It provides a reliable execution environment on demand without forcing you to have an actual different machine. And you don't have to deal with virtualization. But. . . it has its limitations. Because, if this is what really matters to you, you might really be wanting a VM.

Languages that run in VMs already (like Java) solve this problem a bit better at the language level. But Java dependency management turns out to be a nightmare anyway. This is probably just one of those hard problems. But if you really want reliable environments for just your app, I think it's going to be better in the long term to think about containerization and virtual machines instead of virtual environments.

Re:Show HN: Virtualenv-mv – Move (rename) Python virtualenvs by Eridrus on Sunday June 12, 2016 @04:56PM (#11890193)
What have you seen go wrong with Java packaging? I've had very, very few issues with it. The fact that you can package compiled blobs in JARs means you don't need to rely on the OS package manager. You can get into some hairy class loader situations with dependencies on conflicting versions, but most other environments don't even let you try and resolve those issues.
Re:Show HN: Virtualenv-mv – Move (rename) Python virtualenvs by has2k1 on Sunday June 12, 2016 @03:27AM (#11887091)
There is Python, then there is the tooling around Python. Virtual environments constitute tooling around Python. Sometimes aspects of the tooling become indispensable and they are adopted as part of the standard library -- see venv.

You may not realise it, but Python usage patterns have changed significantly over the last 6-8 years and they are still changing. With such change, it is hard to create any tooling that is concrete and stable over the long term. By that same reason not a lot of tooling can be adopted by the standard library.

Re:Show HN: Virtualenv-mv – Move (rename) Python virtualenvs by m_mueller on Sunday June 12, 2016 @03:38AM (#11887113)
I can see that reasoning given how Python started, but since Python3 broke backwards compatibilities anyways it should IMO have solved the whole packaging, versioning and isolation problem once and for all through standard utilities delivered with every Python distro.
Re:Show HN: Virtualenv-mv – Move (rename) Python virtualenvs by has2k1 on Sunday June 12, 2016 @05:15AM (#11887321)
If there are no agreed upon proposals, then why implement solutions if their utility would still be inadequate. It is not enough to demand perfect solutions, there must be perfect proposals.
Re:Show HN: Virtualenv-mv – Move (rename) Python virtualenvs by m_mueller on Sunday June 12, 2016 @05:21AM (#11887341)
Well, sometimes you need an architect rather than a committee. This is one such time.

Looking at the whole thing superficially (i.e. just throwing something at the wall here), this is how I'd have done it:

* packages are by default always installed in user space.

* package manager is built into import system. Importing a package that's not in the user's environment yet will lead to something like pip install at script startup.

* import statements understand versions. By default the latest version of a package is loaded. If something else is needed, the programmer can specify the specific one.

* for most third party packages that are publicised in pypy it's recommended to bind all imports to specific versions of dependencies, so it can be tested in this configuration at release.

Re:Show HN: Virtualenv-mv – Move (rename) Python virtualenvs by devnonymous on Sunday June 12, 2016 @07:47AM (#11887671)

  > package manager is built into import system.
  > Importing a package that's not in the user's
  > environment yet will lead to something like
  > pip install at script startup
Here's a nifty little recipe I came up with to do just this by exploiting the import hooks introduced in py3.4

  http://lonetwin.github.io/blog/html/2016/05/16/auto_install_missing_python_modules.html
Re:Show HN: Virtualenv-mv – Move (rename) Python virtualenvs by maweki on Sunday June 12, 2016 @09:30AM (#11888007)
Please don't do that. Provide a requirements-file with the appropriate dependencies and their versions to use with `pip install -r `
Re:Show HN: Virtualenv-mv – Move (rename) Python virtualenvs by pekk on Sunday June 12, 2016 @03:01AM (#11887024)
virtualenvwrapper isn't part of virtualenv or python. Are you saying that the existence of virtualenv tells you there's something wrong?
Re:Show HN: Virtualenv-mv – Move (rename) Python virtualenvs by hkjgkjy on Sunday June 12, 2016 @03:25AM (#11887082)
I would agree to that yes, as are most (all) languages.

It would be very nice if the Python version was something specified in the project manifest. Don't know what is the popular build tool in python, but something like specifying the node.js version in the package.json file would be great.

I think the reason it never works like that is that the language is written before the package manager and VM/compiler.

In Clojure it's the other way around - the JVM and the package managers were there before the language. The Clojure compiler is a library that you include in your project.clj file like any other lib. Hence you can specify language version per project. That's a feature I would like to have in other programming environments.

Re:Show HN: Virtualenv-mv – Move (rename) Python virtualenvs by m_mueller on Sunday June 12, 2016 @03:36AM (#11887109)
No, my point is rather: Why do we need virtualenv at all (and worse, more wrappers around it)? Why should, say, pip packages have any problems with each other as long as they aren't imported directly in a python sourcefile. It seems like versioning of packages isn't solved correctly at the interpreter level, that's why we have the virtualenv crutch.
Re:Show HN: Virtualenv-mv – Move (rename) Python virtualenvs by neuroid on Sunday June 12, 2016 @08:10AM (#11887734)
Why should, say, pip packages have any problems with each other as long as they aren't imported directly in a python sourcefile.

Are you suggesting that package versions should be explicitly provided as part of import statements? Or that import statements should be mangled depending on the versions specified in setup.py?

Re:Show HN: Virtualenv-mv – Move (rename) Python virtualenvs by m_mueller on Sunday June 12, 2016 @09:18AM (#11887957)
> Are you suggesting that package versions should be explicitly provided as part of import statements?

Yep, see also my suggestion in the other subthread.