kilojoules kilojoules - 1 year ago 85
Python Question

can I make a virtualenv into an egg

I can make a python egg using setuptools:

python bdist_egg
. In theory, I should be able to do this for every installed package with a
file. Is it possible to encapsulate an entire
virtual python environment to a python egg?

Answer Source

You shouldn't do this for several reasons

Even if you could manage to do this, it wouldn't work as you'd expect. If the user already had one of the packages inside your egg installed, they would clash, because python eggs don't add additional namespaces.

Also, python eggs are kind of on their way out. If you want to create a binary distribution, you should use the newer python wheels.

If you have a project with dependencies, just declare those dependencies in your and pip will handle installing them. If you have some dependencies that don't exist on PyPi, or you need a very specific legacy version of a package, just include those packages as a subpackage in your package.


And then in your code, instead of importing them as

import non_pypy_package

you would use

from my_package.libs import non_pypi_package
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download