I'm newish to the python ecosystem, and have a question about module editing.
I use a bunch of third-party modules, distributed on PyPi. Coming from a C and Java background, I love the ease of easy_install <whatever>
. This is a new, wonderful world, but the model breaks down when I want to edit the newly installed module for two reasons:
egg
files may be stored in a folder or archive somewhere crazy on the file system.egg
seems to preclude using the version control system of the originating project, just as using a debian package precludes development from an originating VCS repository.What is the best practice for installing modules from an arbitrary VCS repository? I want to be able to continue to import foomodule
in other scripts. And if I modify the module's source code, will I need to perform any additional commands?
Are you wanting to do development but have the developed version be handled as an egg by the system (for instance to get entry-points)? If so then you should check out the source and use Development Mode by doing:
python setup.py develop
If the project happens to not be a setuptools based project, which is required for the above, a quick work-around is this command:
python -c "import setuptools; execfile('setup.py')" develop
Almost everything you ever wanted to know about setuptools (the basis of easy_install) is available from the the setuptools docs. Also there are docs for easy_install.
Development mode adds the project to your import path in the same way that easy_install does. An changes you make will be available to your apps the next time they import the module.
As others mentioned, you can also directly use version control URLs if you just want to get the latest version as it is now without the ability to edit, but that will only take a snapshot, and indeed creates a normal egg as part of the process. I know for sure it does Subversion and I thought it did others but I can't find the docs on that.