Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How should I split up a Python module into PyPi packages?

I have written a Python module that I'd like to make available for others. Right now, it is one large module nested into sub-folders:

  • wraith
    • util
    • ext
    • color

I think it's best to split these sub-folders up into separate packages. The tipfy project does this. However, the ext and color modules depend on util.

What's the best way to organize and release these modules? Do I split them up and name them wraith.util, wraith.ext, and wraith.color like tipfy? Do I include util when people install ext or color?

like image 529
Matt Norris Avatar asked Nov 13 '22 16:11

Matt Norris


1 Answers

If wraith.ext etc. are not useful on their own it is not necessary to split. Can you imagine someone would use wrait.util without installing wraith.color?

If you decide to split you need to set install_requires in setup.py which tells setuptools etc. the package dependencies. Also you need to set-up namespace_packages telling that wrait namespace will receive other packages too.

More info

  • http://tarekziade.wordpress.com/2011/08/19/5-tips-for-packaging-your-python-projects/

  • http://packages.python.org/distribute/setuptools.html

like image 104
Mikko Ohtamaa Avatar answered Dec 20 '22 16:12

Mikko Ohtamaa