I created a Python egg; now what?
Asked Answered
N

2

6

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?

Notice answered 3/6, 2010 at 18:40 Comment(4)
You mean you laid a Python egg.Jerrelljerri
@Seth Johnson - seriously? is that the terminology? (we just started a list of interesting/amusing computer terminology that sounds insane to anyone not programming...)Notice
No, he's just kidding, no one actually says that ;)Tamtam
Ian has it: I'm just pulling your egg. Er, leg.Jerrelljerri
N
0

What I ended up doing was:

  1. Ran PYTHONPATH=fullPathOfMyEgg in command line
  2. Was then able to do import someModuleInMyEgg from my Python code

I'm not sure if this is the most standard or accepted way to do it, but it worked. If anyone has any comments or other methods, please feel free to add...

Notice answered 17/6, 2010 at 15:56 Comment(0)
T
6

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.

Tamtam answered 3/6, 2010 at 19:20 Comment(0)
N
0

What I ended up doing was:

  1. Ran PYTHONPATH=fullPathOfMyEgg in command line
  2. Was then able to do import someModuleInMyEgg from my Python code

I'm not sure if this is the most standard or accepted way to do it, but it worked. If anyone has any comments or other methods, please feel free to add...

Notice answered 17/6, 2010 at 15:56 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.