Skip to content

Avoid incentivizing multi-package distributions #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conversation

abravalheri
Copy link

Hi @codeandfire, thank you very much for the PR.
I would like to avoid incentivising a distribution with multiple top-level packages. What do you think about this alternative examples?

@codeandfire
Copy link
Owner

@abravalheri Sure, makes sense! I must admit I found the multi-package layout a little strange too, but I assumed there was some reason for keeping it that way. However, if we are advocating a single-package structure - I think that the src-layout becomes unnecessary, because the src directory is just a wrapper around the mypkg package directory; we might as well just stick to the flat-layout instead. What are your thoughts on this?

@abravalheri
Copy link
Author

Well, there is some division in the community about the src-layout... some people like it, other people don't.

Personally, I think the src layout is less error prone and more explicit. It avoids problems with unintentional implicit namespaces (PEP 420) and make it easier to do better testing (which is independent of distributing one or multiple packages per wheel). I use the src layout in all my projects.

You can find some pointers in and discussion in pypa/packaging.python.org#320 (which motivated the example in the packaging tutorial to move towards the src-layout).

Also the classic explanation can be found in https://blog.ionelmc.ro/2014/05/25/python-packaging/#the-structure (there is a newer post revisiting the topic which argues that a good project template will already take care of the things for you, but I still think the arguments in the original article are valid, and that the src-layout just facilitate doing the right thing).

@codeandfire codeandfire merged commit 9e26f88 into codeandfire:package-discovery-fix May 20, 2022
@abravalheri abravalheri deleted the package-discovery-fix branch May 20, 2022 14:32
@codeandfire
Copy link
Owner

Sure, no problem! Have merged your commit.

codeandfire pushed a commit that referenced this pull request Jun 23, 2022
Refactor `StaticModule.__getattr__` and fix `ast.AnnAssign` edge case
codeandfire pushed a commit that referenced this pull request Jan 2, 2024
Remove extraneous question mark.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants