Skip to content

Conversation

roland-ruedenauer
Copy link
Contributor

As the title says, this PR changes the packinging of moin.
Files below any of the "_tests" folder will no longer be part of the created python wheel.

@ThomasWaldmann
Copy link
Member

Discuss: maybe we rather want to be able to run the tests, even if moin is installed from a sdist or wheel?

@roland-ruedenauer
Copy link
Contributor Author

I should have added, that it was attempted before to not have the test code in the python wheel.
Meaning this PR is kind of packaging fix.

exclude = ["_tests"]

And with the PR test code should still be present in the created sdist.

But of course, it might be wanted now to still have the test code also in the Python wheel.

@UlrichB22
Copy link
Collaborator

By excluding the test modules, we can keep the moin package clean and focused on the wiki admins who install and update a moin wiki.

The tests are run multiple times when a PR is created and merged into the master branch, the test results are archived through the GitHub workflow. I see no reason to repeat the tests for an “old” package version.

@RogerHaase
Copy link
Member

Googling gives mixed results, and yields "including tests are recommended, but not required".

https://packaging.python.org/en/latest/tutorials/packaging-projects/ seems to suggest including tests:


Creating the package files

You will now add files that are used to prepare the project for distribution. When you’re done, the project structure will look like this:

packaging_tutorial/
├── LICENSE
├── pyproject.toml
├── README.md
├── src/
│ └── example_package_YOUR_USERNAME_HERE/
│ ├── init.py
│ └── example.py
└── tests/

Creating a test directory

tests/ is a placeholder for test files. Leave it empty for now.


I vote to continue including tests, as some odd wikiconfig file may cause a failure.

@roland-ruedenauer
Copy link
Contributor Author

Thanks for commenting.

I have to admit, I did not expect someone could want to have test code and data be part of a wheel package. The installer most of the time will install wheels in some site-packages folder and all you normally would want to do now imo is run the installed application or use the library. And if I wanted to run tests for a package, then I would either download the sdist or more likely directly clone the source repository.

Btw, the reason I created the PR is quite simple: I built a docker container for moin2 where I installed the beta-2 wheel package from pypi. Then I opened a shell in the running container to verify it's content and was surprised to see all of the _tests folders were present in the site-packages folder.

Anyways, feel free to close the PR if you like to keep the packaging as it is.

@UlrichB22
Copy link
Collaborator

We still need some cleanup of the existing pyproject.toml to remove the wrong exclude line. This should be done in a new PR.

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.

4 participants