开发者

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?


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜