Search code examples
pythondjangomarkdownsetuptoolsegg

Where is the source code for a Python egg?


I'm attempting to add a video extension to the Python Markdown-2.0.3-py2.7.egg

Things aren't working, so I want to use pdb debugger to see what's going on.

I can't seem to find the source code to insert pdb.

The egg is located here:

/usr/local/lib/python2.7/site-packages/Markdown-2.0.3-py2.7.egg

Using iPython, I can view the Python source code of the Markdown module and it's path:

/usr/local/lib/python2.7/site-packages/Markdown-2.0.3-py2.7.egg/markdown/__init__.py

But I can't navigate to that file, nor can open it in a Text Editor.

I'm guessing the source code I'm viewing may be generated from the compiled egg. However, it seems there must be some way of accessing the code.


Solution

  • An .egg file is a simple ZIP archive, you can extract the files using any ZIP-enabled application if you want. That being said, you can install an .egg into a folder for development by passing the develop option to setup.py. This will make setuptools use the sources in the specified folder and just link to them by a file in your package path.