[Python-ideas] PEP for Python folder structure

13 views
Skip to first unread message

Armin Wieser

unread,
May 30, 2012, 4:45:31 AM5/30/12
to python...@python.org
Hi,

I would like to write a PEP about folder structure in python projects.

You will think that there is no need for that, because everything is
documented (package, module, setuptools). But it should contain
something like [0].

If you aren't into those concepts, never have pushed some package to
pypi, and you only have written some scripts, it's hard to find out how to
structure your folders.

Therefore i think a PEP would be a great way to show how you can do it.

What do you think about it?

[0] http://jcalderone.livejournal.com/39794.html
_______________________________________________
Python-ideas mailing list
Python...@python.org
http://mail.python.org/mailman/listinfo/python-ideas

LittleQ

unread,
May 30, 2012, 5:05:41 AM5/30/12
to Armin Wieser, python...@python.org
I think one of the goodnesses of Python is "no project structure", that make Python is easy to learn and easy to use.

Could you show something like your Python project structure for example? I'm curious for why do you think Python needs a basic project structure : )

Just personally hate the project structure, because Erlang has project structure for each project, that made me get into a mess often.

>>>
Best Regards,

Colin Su (LittleQ)
NCCU Computer Science Dept. / PLSM Lab.

Steven D'Aprano

unread,
May 30, 2012, 5:19:07 AM5/30/12
to python...@python.org
On Wed, May 30, 2012 at 10:45:31AM +0200, Armin Wieser wrote:
> Hi,
>
> I would like to write a PEP about folder structure in python projects.

Why?

PEP stands for Python Enhancement Proposal, and relate to suggested
changes to the Python language and standard library. Your blog post
about folder structure:

> [0] http://jcalderone.livejournal.com/39794.html

is interesting, but it has nothing to do with either Python the language
or the standard library, as far as I can tell. In fact, some of your
project suggestions go against best-practice, or at least common
practice:

"Don't put your source in a directory called src"

Really? I think you'll find many people disagree with that.

I think your blog post is a good blog post, and deserves to have people
read it and discuss it. With feedback from others, I think it might even
become a good How To layout projects. But I think it would be a poor
PEP.

Of course, you can write a post in the format of a PEP. Just don't call
it a PEP unless it is a proposal for an enhancement to Python, or at
least related to development of Python, e.g. PEP 8.


--
Steven

M.-A. Lemburg

unread,
May 30, 2012, 7:01:42 AM5/30/12
to Steven D'Aprano, python...@python.org
Steven D'Aprano wrote:
> On Wed, May 30, 2012 at 10:45:31AM +0200, Armin Wieser wrote:
>> Hi,
>>
>> I would like to write a PEP about folder structure in python projects.
>
> Why?
>
> PEP stands for Python Enhancement Proposal, and relate to suggested
> changes to the Python language and standard library. Your blog post
> about folder structure:
>
>> [0] http://jcalderone.livejournal.com/39794.html
>
> is interesting, but it has nothing to do with either Python the language
> or the standard library, as far as I can tell.

We do have informational PEPs for the purpose Armin is describing, but
we usually only try to use those for standardization of things.

I don't think a standard project dir layout is really needed. Helping new
package authors finding the right structure for their project does
help, though.

Perhaps the idea could be turned into a section of the (distutils)
documentation, a how-to or a page on the wiki ?!

--
Marc-Andre Lemburg
eGenix.com

Professional Python Services directly from the Source (#1, May 30 2012)
>>> Python/Zope Consulting and Support ... http://www.egenix.com/
>>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/
>>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/
________________________________________________________________________
2012-07-17: Python Meeting Duesseldorf ... 48 days to go
2012-07-02: EuroPython 2012, Florence, Italy ... 33 days to go
2012-05-16: Released eGenix pyOpenSSL 0.13 ... http://egenix.com/go29

::: Try our new mxODBC.Connect Python Database Interface for free ! ::::


eGenix.com Software, Skills and Services GmbH Pastor-Loeh-Str.48
D-40764 Langenfeld, Germany. CEO Dipl.-Math. Marc-Andre Lemburg
Registered at Amtsgericht Duesseldorf: HRB 46611
http://www.egenix.com/company/contact/

Nick Coghlan

unread,
May 30, 2012, 7:48:39 AM5/30/12
to M.-A. Lemburg, python...@python.org
On Wed, May 30, 2012 at 9:01 PM, M.-A. Lemburg <m...@egenix.com> wrote:
> I don't think a standard project dir layout is really needed. Helping new
> package authors finding the right structure for their project does
> help, though.

The basic problem is that it's a matter of "it depends what you're
building and whether or not there are any other constraints on your
layout". Kenneth Reitz has a decent guide that he posted recently
([1]), but see the comments below the post for some useful caveats and
discussion.

Ultimately though, providing a place to provide opinionated advice on
exactly this kind of question is why the Hitchhiker's Guide to Python
[2] was created.

[1] http://kennethreitz.com/repository-structure-and-python.html
[2] http://docs.python-guide.org/en/latest/index.html

--
Nick Coghlan   |   ncog...@gmail.com   |   Brisbane, Australia
Reply all
Reply to author
Forward
0 new messages