Skip to content
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

Use a src/ layout #332

Merged
merged 3 commits into from
May 2, 2023
Merged

Use a src/ layout #332

merged 3 commits into from
May 2, 2023

Conversation

jwodder
Copy link
Collaborator

@jwodder jwodder commented May 2, 2023

Part of #325.

The changes to the *.py files are due to isort (via pre-commit) now putting absolute nidm imports in the proper location; they were in the wrong location before because the isort config I copied assumed a src/ layout.

@jwodder jwodder mentioned this pull request May 2, 2023
35 tasks
@jwodder
Copy link
Collaborator Author

jwodder commented May 2, 2023

@yarikoptic Please merge this soon.

@yarikoptic
Copy link
Member

In general I prefer to not mess with src/'ing it and just have things straight under the packagename/. Please remind me why we would like that. E.g. is that to prevent using the nidm package without first building it, which would be needed for proper version assignment (if we are to use versioningit or alike)? or is there is more to it?

@jwodder
Copy link
Collaborator Author

jwodder commented May 2, 2023

@yarikoptic The src/ layout helps ensure that testing happens against an installed copy of your package rather than the copy in the repository, thereby letting you catch packaging errors. There are other benefits as well, mostly around making it easier to package exactly what you want; see https://blog.ionelmc.ro/2014/05/25/python-packaging/ and a web search for more information.

(Also, this reminded me that, when using a src/ layout, either the tests should be in their own top-level directory or else the --pyargs option has to be passed to pytest; I'm going with the former.)

@yarikoptic
Copy link
Member

either the tests should be in their own top-level directory or else the --pyargs option has to be passed to pytest; I'm going with the former.)

I thought to argue, but since you did keep the hierarchical organization, my argument no longer holds, so ok, lets' do it your way.

@yarikoptic yarikoptic merged commit 4df3e27 into master May 2, 2023
@yarikoptic yarikoptic deleted the src branch May 2, 2023 19:09
@jwodder jwodder added cleanup internal Changes only affect the internal API labels May 2, 2023
@github-actions
Copy link

🚀 PR was released in v4.0.0 🚀

@github-actions github-actions bot added the released This issue/pull request has been released. label May 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cleanup internal Changes only affect the internal API released This issue/pull request has been released.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants