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

Add tests/test*.py to sdist default inclusion list #2494

Closed
wants to merge 2 commits into from

Conversation

tomchen
Copy link

@tomchen tomchen commented Dec 20, 2020

Summary of changes

By default, all files matching the pattern test/test*.py (not tests/test*.py) are included in the source distribution (sdist). This is documented in Python Packaging User Guide's "Including files in source distributions with MANIFEST.in" page.

But, both pypa/sampleproject and Python Packaging User Guide's "Packaging Python Projects" page suggest the unit test folder be named tests.

I opened the issue pypa/sampleproject#133, it looks clear that tests is a more common name than test, and it may avoid conflicting with the test standard library module according to some.

Therefore, I request to add "tests/test*.py" to sdist default inclusion list. And "test/test*.py" should be kept for compatibility with old repos.

Pull Request Checklist

@@ -268,7 +268,7 @@ def _add_defaults_standards(self):
self.warn("standard file '%s' not found" % fn)

def _add_defaults_optional(self):
optional = ['test/test*.py', 'setup.cfg']
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfortunately, it's not allowed to make changes to distutils here. If you wish to make changes to distutils, they need to happen in the pypa/distutils project.

@@ -17,7 +17,7 @@ def add_defaults(self):
"""Add all the default files to self.filelist:
- README or README.txt
- setup.py
- test/test*.py
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's a docstring in this code saying not to change this code.

@jaraco
Copy link
Member

jaraco commented Dec 20, 2020

Probably this issue requires more discussion. It's intertwined with the effort to adopt distutils and the copy of distutils functionality in the compat module. Making this change will add more divergence between distutils implementations. I'm inclined to say it would be best to wait for this change until setuptools owns distutils, at which time fine-tuning such a list would be more straightforward.

I do agree with you, the default of 'test' versus 'tests' violates my expectations, but this shift in expectations happened in spite of 'test' being included as a default for a very long time. Perhaps the better approach here would be to just remove all special files and simply require the user to use setuptools_scm or maintain a manifest of all the sources. After all, fixing this change still doesn't help users who have a pyproject.toml or those who choose a different convention for their tests.

The recommended usage here is for the packager to use setuptools_scm or provide a MANIFEST.in with the relevant rules.

Since neither of these code bases are meant to be changed here, I'm going to decline the PR.

Thanks anyhow for the effort.

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