Best Practices for Internal Package Structure

Sven R. Kunze srkunze at mail.de
Mon Apr 4 13:03:11 EDT 2016


Hi Josh,

good question.

On 04.04.2016 18:47, Josh B. wrote:
> My package, available at https://github.com/jab/bidict, is currently laid out like this:
>
> bidict/
> ├── __init__.py
> ├── _bidict.py
> ├── _common.py
> ├── _frozen.py
> ├── _loose.py
> ├── _named.py
> ├── _ordered.py
> ├── compat.py
> ├── util.py
>
>
> I'd like to get some more feedback on a question about this layout that I originally asked here: <https://github.com/jab/bidict/pull/33#issuecomment-193877248>:
>
> What do you think of the code layout, specifically the use of the _foo modules? It seems well-factored to me, but I haven't seen things laid out this way very often in other projects, and I'd like to do this as nicely as possible.
>
> It does kind of bug me that you see the _foo modules in the output when you do things like this:
> [code]

we had a similar discussion internally. We have various packages 
requiring each other but have some internals that should not be used 
outside of them.

The _ signifies that actually clearly but it looks weird within the 
package itself.

We haven't found a solution so far. Maybe others do.


Best,
Sven



More information about the Python-list mailing list