[Chicago] Python Packaging Question.

Brian Curtin brian at python.org
Wed Jan 22 04:22:51 CET 2014


On Tue, Jan 21, 2014 at 8:57 PM, Samir Faci <samir at esamir.com> wrote:
> I'm working to re-package a python project from work and hopefully open
> source it, and I'm running into a few blockers I was hoping someone can
> clarify for me.
>
> I've seen two styles and I'm not sure which is better or recommended when
> structuring your module
>
> A:
>
> ${root}/
>    - setup.py
>    - modulename.py
>    -modulefolder/__init__.py # contains all your code except for
> modulename.py
>   - test/__init__.py   # all your tests
>
> using A, I think any XML, yaml etc configuration is dropped into the
> modulefolder/
>
> B:
>
> ${root}/
>    - setup.py
>    - modulefolder/__init__.py
>                        /modulename.py
>
>
> 1.   is A preferred over B? Is there a recommended layout ?  Is there a
> recommended location as to where to store your test classes? inside the
> modulefolder? outside of it?

I guess it depends on what you're actually building beyond an example
layout. If you're building a package, then you'll have a packagename
folder, the __init__.py, and the files that folder which construct
your package. If you just need a module, then just have a module.

Do you have a more realistic example?

Also, as for tests, most people tend to go with your A choice there.


More information about the Chicago mailing list