Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Talked about this before in the PR moving extra-geom to GitHub workflows (European-XFEL/EXtra-geom#34 (comment)) but I'll summarise it here again for completeness:
There are many very long discussions about the 'best' way to lay out python packages (pypa/packaging.python.org#320 is a pretty big one, which links to other discussions as well), personally I'm a fan of the
src
layout instead of the 'standard' way of putting the main module in the root of the package directory for a couple of reasons, the main one being how tests execute.The standard package layout has the issue where your tests will (typically) perform a relative import of the package and execute code from within the current directory, meaning your tests do not actually run on the package as it would be when installed by a user (n.b. these would be the same if you do an editable install with
pip install -e
but users typically won't be doing that).I think the intention behind tests is to check that what users install works correctly, which doesn't end up happening when the tests import the package in a different way to how users will be importing it.
In the end this only matters if you have some compiled code, resources, additional
py_modules
, or run coverage tests for some scenarios, so in the case of EXtra-data it's probably fine. But it does cause issues with coverage reports for nbval tests in extra geom, and having extra geom and extra data have different layouts would be a bit weird.This PR is WIP since I'm not too sure how to handle one specific aspect: currently tests are in the package as a module, and as part of the
lpd_data
notebook in the docs we run!python3 -m extra_data.tests.make_examples
to create some example datasets. In thesrc
layout, tests are completely split out from the package modules, so this would no longer be possible andmake_examples
would have to move intoextra_data
itself.