Using setup.py with virtualenv to handle the development of main and sub-projects

I'm still bugged by the complexity of using git subtrees to effectively handle development on main and sub projects. In my case I have several 'main' projects that are Django sites which share a functioning but actively developed app. I can work with the git subtree solution but I constantly have to remind myself of the required commands for merging and updating.

Enter setup.py for the subproject integration. With a properly configured setup for the sub project developers will be able to install it in the main projects using 'setup.py develop' if they need to do development on it in context whereas other developers who are just working on the main project (or other sub projects) can just install and or update off the requirements.txt in the usual way. This has the advantage of covering us for the future too - if the sub project is to be deployed to pypi or similar.

With this approach we can stick the project into our requirements.txt in the main project in the usual way, eg:

-e git://github.com/cccs-web/docmeta.git#egg=docmeta

That sorts all the normal deployment. This can be specialized to use a particular commit or tag as needed.

For development, the virtualenv comes to our rescue. Just use pip to uninstall the package and then go to your working copy of the sub project and invoke setup:

(abadi)~/wk/abadi $ pip uninstall docmeta
...
(abadi)~/wk/abadi $ cd ../docmeta
(abadi)~/wk/docmeta $ python setup.py develop

All done. On balance this is much simpler than worrying about subtrees. Developers can put the working copies of the subprojects where ever they want and there is no need for installers to do anything special at all.

The only downside, if it is one at all, is that you may need to duplicate your IDE environment for the sub-project.


Comments

There are currently no comments

New Comment

required

required (not published)

optional

Australia: 07 3103 2894

International: +61 410 545 357