Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

I created a Python egg; now what?

I've finally figured out how to create a Python egg and gotten it to work. Now... what do I do with it? How do I use it? How do I ensure that everything was correctly included? (Simple steps please... not just redirection to another site. I've googled, but it's confusing me, and I was hoping someone could explain it in a couple of simple bullet points or sentences.)

Edit:

I asked this question a couple of weeks ago, and I'm clarifying now in the hope of getting clearer answers... basically, I have an egg, I want to take it to another machine and be able to use it and import modules from it from my (other, unrelated) code. How do I do this?

like image 351
froadie Avatar asked Jun 03 '10 18:06

froadie


People also ask

How do you use a Python egg?

A python egg is a "a single-file importable distribution format". Which is typically a python package. You can import the package in the egg as long as you know it's name and it's in your path. You can execute a package using the "-m" option and the package name.

Can you pip install an egg?

egg files are deprecated and are replaced by Wheel format. Since DSS uses pip which does not support installing egg format you won't be able to add egg packages directly from DSS.


1 Answers

I'd advise only using python setup.py sdist to create zips and/or tarballs, and skip eggs.

If you want to look at the egg it is a zip file; you can use unzip -v MyEgg-0.1.egg and see its contents to see if includes all the files you expect. You can also try installing it. Use virtualenv to create a new environment (use --no-site-packages to make it isolated) and try installing it into that environment, like:

$ virtualenv --no-site-packages test-env
$ ./test-env/bin/easy_install path/to/MyEgg-0.1.egg
$ ./test-env/bin/python

And then see if you can import it and use your package like you expect. You can do all the same things to test an sdist too.

like image 183
Ian Bicking Avatar answered Sep 22 '22 02:09

Ian Bicking