Skip to content

py_library generated from wheel shouldn't include tests/ folder #528

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

Merged
merged 1 commit into from
Sep 12, 2021

Conversation

alexeagle
Copy link
Contributor

This is a python convention that wheels are shipped to pypi including their tests.
These shouldn't be used in user code.
We have observed these files expose modules which collide with first-party targets.

PR Checklist

Please check if your PR fulfills the following requirements:

  • Does not include precompiled binaries, eg. .par files. See CONTRIBUTING.md for info
  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been added / updated (for bug fixes / features)

PR Type

What kind of change does this PR introduce?

  • Bugfix
  • Feature (please, look at the "Scope of the project" section in the README.md file)
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Documentation content changes
  • Other... Please describe:

What is the current behavior?

Issue Number: N/A

What is the new behavior?

Does this PR introduce a breaking change?

  • Yes
  • No

Other information

@google-cla google-cla bot added the cla: yes label Sep 8, 2021
@thundergolfer thundergolfer requested review from thundergolfer and removed request for brandjon and lberki September 12, 2021 12:14
Copy link

@thundergolfer thundergolfer left a comment

Choose a reason for hiding this comment

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

This is only a heuristic, but from checking ~50 of the top ~300 wheels
at https://pythonwheels.com/ tests/ seems by far the most common. Others do exist though, and look safe to also exclude. I saw:

  • test/: urllib3
  • testing/: cffi
  • {name}/tests/ : certifi, colorama, pandas, google-auth-core, jsonschema

@alexeagle
Copy link
Contributor Author

Thanks for doing that research.

I'd worry about excluding testing/ because I could imagine that being used to provide a library which is useful for writing tests against your code that uses the package.
I'll add the tested tests/ case though, as you found that was somewhat common.

This is a python convention that wheels are shipped to pypi including their tests.
These shouldn't be used in user code.
We have observed these files expose modules which collide with first-party targets.
@alexeagle alexeagle merged commit 7609526 into bazel-contrib:main Sep 12, 2021
alexeagle added a commit to alexeagle/rules_python that referenced this pull request Sep 23, 2021
hrfuller added a commit that referenced this pull request Sep 28, 2021
…ers (#528)" (#539)

This reverts commit 7609526.

Fixes #538

Co-authored-by: Henry Fuller <hrofuller@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants