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

2.5.0: Installs tests into top-level directory #11

Closed
dvzrv opened this issue Jan 15, 2021 · 4 comments
Closed

2.5.0: Installs tests into top-level directory #11

dvzrv opened this issue Jan 15, 2021 · 4 comments

Comments

@dvzrv
Copy link

dvzrv commented Jan 15, 2021

Hi! I package python-utils for Arch Linux.

When packaging 2.5.0, I noticed, that now the tests are installed top-level into the site-packages directory. This is a problem, because it will conflict with other packages (it happens from time to time, that packages accidentally install tests globally).

To fix this, the packages parameter for setuptools' setup() needs to be specified in such a way, that it only installs the contents of the utils, but not that of the tests.

dvzrv added a commit to dvzrv/python-utils that referenced this issue Jan 15, 2021
setup.py:
Provide an include list for `setuptools.find_packages()` [1], which is called
within `setuptools.setup()`'s `packages` parameter.
This prevents the tests being picked up as a package and installed
top-level in the site-packages directory (conflicting with other
packages, that also make this mistake).

Fixes wolph#11

[1] https://packaging.python.org/guides/distributing-packages-using-setuptools/#packages
@wolph
Copy link
Owner

wolph commented Jan 15, 2021

Thank you for the help. I've created a new release :)

@nathanjackson
Copy link

nathanjackson commented Jan 21, 2021

@wolph I noticed this issue as well. I tried to upgrade to 2.5.1 but I'm having the same issue.

From pip list:

Name: python-utils
Version: 2.5.1
Summary: Python Utils is a module with some convenient utilities not included with the standard Python install
Home-page: https://github.com/WoLpH/python-utils
Author: Rick van Hattem
Author-email: Wolph@wol.ph
License: BSD
Location: env/lib/python3.8/site-packages
Requires: six
Required-by: progressbar2
Files:
  python_utils-2.5.1.dist-info/INSTALLER
  python_utils-2.5.1.dist-info/LICENSE
  python_utils-2.5.1.dist-info/METADATA
  python_utils-2.5.1.dist-info/RECORD
  python_utils-2.5.1.dist-info/REQUESTED
  python_utils-2.5.1.dist-info/WHEEL
  python_utils-2.5.1.dist-info/pbr.json
  python_utils-2.5.1.dist-info/top_level.txt
  python_utils/__about__.py
  python_utils/__init__.py
  python_utils/__pycache__/__about__.cpython-38.pyc
  python_utils/__pycache__/__init__.cpython-38.pyc
  python_utils/__pycache__/compat.cpython-38.pyc
  python_utils/__pycache__/converters.cpython-38.pyc
  python_utils/__pycache__/decorators.cpython-38.pyc
  python_utils/__pycache__/formatters.cpython-38.pyc
  python_utils/__pycache__/import_.cpython-38.pyc
  python_utils/__pycache__/logger.cpython-38.pyc
  python_utils/__pycache__/terminal.cpython-38.pyc
  python_utils/__pycache__/time.cpython-38.pyc
  python_utils/compat.py
  python_utils/converters.py
  python_utils/decorators.py
  python_utils/formatters.py
  python_utils/import_.py
  python_utils/logger.py
  python_utils/terminal.py
  python_utils/time.py
  tests/__init__.py
  tests/__pycache__/__init__.cpython-38.pyc
  tests/__pycache__/test_import.cpython-38.pyc
  tests/__pycache__/test_python_utils.cpython-38.pyc
  tests/test_import.py
  tests/test_python_utils.py

Downgrading to 2.4.0 solved the issue in the short term for me.

wolph added a commit that referenced this issue Jan 21, 2021
@wolph
Copy link
Owner

wolph commented Jan 21, 2021

I'm not entirely sure what is causing this honestly... I tried modifying the find_packages() with a specific include, with several tries of exclude and I even tried to modify MANIFEST.in. All to no avail...

So I went for the nuclear option which should be acceptable for everyone. I renamed the tests directory to _python_utils_tests which shouldn't clash with anything and won't break your autocomplete either.

wolph added a commit that referenced this issue Jan 21, 2021
renamed tests to fix #11 properly v2.5.2

# gpg: Signature made Thu Jan 21 04:17:08 2021 CET
# gpg:                using RSA key 149325FD15904E9C4EB89E95E81444E9CE1F695D
# gpg: Good signature from "Rick van Hattem <wolph@wol.ph>" [ultimate]
# gpg:                 aka "[jpeg image of size 9662]" [ultimate]
@dvzrv
Copy link
Author

dvzrv commented Jan 21, 2021

FWIW: The package on Arch Linux is at 2.5.1 and does not exhibit that behavior:
https://archlinux.org/packages/community/any/python-utils/
(See the Package Contents section at the bottom)

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 a pull request may close this issue.

3 participants