jazzband / django-hosts

Dynamic and static host resolving for Django. Maps hostnames to URLconfs.
http://django-hosts.rtfd.org
Other
982 stars 106 forks source link

Exclude tests from wheel distribution #170

Open browniebroke opened 2 months ago

browniebroke commented 2 months ago

When installing the package, I get a tests folder added to my site-packages with the content of the tests from the repo. This is polluting the virtualenv with code that users don't usually need.

Before

unzip -l dist/*.whl ``` Archive: dist/django_hosts-0.1.dev330+g625969b-py3-none-any.whl Length Date Time Name --------- ---------- ----- ---- 418 07-26-2024 12:28 django_hosts/__init__.py 400 07-26-2024 12:28 django_hosts/apps.py 3759 07-26-2024 12:28 django_hosts/callbacks.py 696 07-26-2024 12:28 django_hosts/checks.py 5656 07-26-2024 12:28 django_hosts/defaults.py 4611 07-26-2024 12:28 django_hosts/managers.py 3385 07-26-2024 12:28 django_hosts/middleware.py 6568 07-26-2024 12:28 django_hosts/resolvers.py 435 07-26-2024 12:28 django_hosts/utils.py 0 07-26-2024 12:28 django_hosts/templatetags/__init__.py 5070 07-26-2024 12:28 django_hosts/templatetags/hosts.py 828 07-26-2024 12:28 django_hosts/templatetags/hosts_override.py 0 07-26-2024 12:28 tests/__init__.py 284 07-26-2024 12:28 tests/base.py 178 07-26-2024 12:28 tests/broken_module.py 963 07-26-2024 12:28 tests/models.py 456 07-26-2024 12:28 tests/settings.py 3037 07-26-2024 12:28 tests/test_defaults.py 5982 07-26-2024 12:28 tests/test_middleware.py 4788 07-26-2024 12:28 tests/test_resolvers.py 5714 07-26-2024 12:28 tests/test_sites.py 5604 07-26-2024 12:28 tests/test_templatetags.py 644 07-26-2024 12:28 tests/test_utils.py 59 07-26-2024 12:28 tests/views.py 0 07-26-2024 12:28 tests/hosts/__init__.py 177 07-26-2024 12:28 tests/hosts/appended.py 183 07-26-2024 12:28 tests/hosts/blank.py 177 07-26-2024 12:28 tests/hosts/blank_wildcard.py 137 07-26-2024 12:28 tests/hosts/multiple.py 1038 07-26-2024 12:28 tests/hosts/simple.py 1372 07-26-2024 12:28 tests/migrations/0001_initial.py 0 07-26-2024 12:28 tests/migrations/__init__.py 0 07-26-2024 12:28 tests/urls/__init__.py 166 07-26-2024 12:28 tests/urls/complex.py 139 07-26-2024 12:28 tests/urls/multiple.py 19 07-26-2024 12:28 tests/urls/root.py 135 07-26-2024 12:28 tests/urls/simple.py 127 07-26-2024 12:32 django_hosts-0.1.dev330+g625969b.dist-info/AUTHORS 4554 07-26-2024 12:32 django_hosts-0.1.dev330+g625969b.dist-info/LICENSE 4765 07-26-2024 12:32 django_hosts-0.1.dev330+g625969b.dist-info/METADATA 91 07-26-2024 12:32 django_hosts-0.1.dev330+g625969b.dist-info/WHEEL 19 07-26-2024 12:32 django_hosts-0.1.dev330+g625969b.dist-info/top_level.txt 3518 07-26-2024 12:32 django_hosts-0.1.dev330+g625969b.dist-info/RECORD --------- ------- 76152 43 files ```

After

unzip -l dist/*.whl ``` Archive: dist/django_hosts-0.1.dev330+g625969b.d20240726-py3-none-any.whl Length Date Time Name --------- ---------- ----- ---- 418 07-26-2024 12:28 django_hosts/__init__.py 400 07-26-2024 12:28 django_hosts/apps.py 3759 07-26-2024 12:28 django_hosts/callbacks.py 696 07-26-2024 12:28 django_hosts/checks.py 5656 07-26-2024 12:28 django_hosts/defaults.py 4611 07-26-2024 12:28 django_hosts/managers.py 3385 07-26-2024 12:28 django_hosts/middleware.py 6568 07-26-2024 12:28 django_hosts/resolvers.py 435 07-26-2024 12:28 django_hosts/utils.py 0 07-26-2024 12:28 django_hosts/templatetags/__init__.py 5070 07-26-2024 12:28 django_hosts/templatetags/hosts.py 828 07-26-2024 12:28 django_hosts/templatetags/hosts_override.py 127 07-26-2024 12:33 django_hosts-0.1.dev330+g625969b.d20240726.dist-info/AUTHORS 4554 07-26-2024 12:33 django_hosts-0.1.dev330+g625969b.d20240726.dist-info/LICENSE 4775 07-26-2024 12:33 django_hosts-0.1.dev330+g625969b.d20240726.dist-info/METADATA 91 07-26-2024 12:33 django_hosts-0.1.dev330+g625969b.d20240726.dist-info/WHEEL 13 07-26-2024 12:33 django_hosts-0.1.dev330+g625969b.d20240726.dist-info/top_level.txt 1648 07-26-2024 12:33 django_hosts-0.1.dev330+g625969b.d20240726.dist-info/RECORD --------- ------- 43034 18 files ```

This is only affecting the wheel, the source distribution (sdist) still contains tests, in case downstream distribution want to be able to run the tests themselves:

tar tf dist/*.tar.gz ``` django_hosts-0.1.dev330+g625969b.d20240726/ django_hosts-0.1.dev330+g625969b.d20240726/.coveragerc django_hosts-0.1.dev330+g625969b.d20240726/.github/ django_hosts-0.1.dev330+g625969b.d20240726/.github/workflows/ django_hosts-0.1.dev330+g625969b.d20240726/.github/workflows/release.yml django_hosts-0.1.dev330+g625969b.d20240726/.github/workflows/test.yml django_hosts-0.1.dev330+g625969b.d20240726/.gitignore django_hosts-0.1.dev330+g625969b.d20240726/.pre-commit-config.yaml django_hosts-0.1.dev330+g625969b.d20240726/AUTHORS django_hosts-0.1.dev330+g625969b.d20240726/CODE_OF_CONDUCT.md django_hosts-0.1.dev330+g625969b.d20240726/CONTRIBUTING.md django_hosts-0.1.dev330+g625969b.d20240726/LICENSE django_hosts-0.1.dev330+g625969b.d20240726/MANIFEST.in django_hosts-0.1.dev330+g625969b.d20240726/Makefile django_hosts-0.1.dev330+g625969b.d20240726/PKG-INFO django_hosts-0.1.dev330+g625969b.d20240726/README.rst django_hosts-0.1.dev330+g625969b.d20240726/django_hosts/ django_hosts-0.1.dev330+g625969b.d20240726/django_hosts/__init__.py django_hosts-0.1.dev330+g625969b.d20240726/django_hosts/apps.py django_hosts-0.1.dev330+g625969b.d20240726/django_hosts/callbacks.py django_hosts-0.1.dev330+g625969b.d20240726/django_hosts/checks.py django_hosts-0.1.dev330+g625969b.d20240726/django_hosts/defaults.py django_hosts-0.1.dev330+g625969b.d20240726/django_hosts/managers.py django_hosts-0.1.dev330+g625969b.d20240726/django_hosts/middleware.py django_hosts-0.1.dev330+g625969b.d20240726/django_hosts/resolvers.py django_hosts-0.1.dev330+g625969b.d20240726/django_hosts/templatetags/ django_hosts-0.1.dev330+g625969b.d20240726/django_hosts/templatetags/__init__.py django_hosts-0.1.dev330+g625969b.d20240726/django_hosts/templatetags/hosts.py django_hosts-0.1.dev330+g625969b.d20240726/django_hosts/templatetags/hosts_override.py django_hosts-0.1.dev330+g625969b.d20240726/django_hosts/utils.py django_hosts-0.1.dev330+g625969b.d20240726/django_hosts.egg-info/ django_hosts-0.1.dev330+g625969b.d20240726/django_hosts.egg-info/PKG-INFO django_hosts-0.1.dev330+g625969b.d20240726/django_hosts.egg-info/SOURCES.txt django_hosts-0.1.dev330+g625969b.d20240726/django_hosts.egg-info/dependency_links.txt django_hosts-0.1.dev330+g625969b.d20240726/django_hosts.egg-info/top_level.txt django_hosts-0.1.dev330+g625969b.d20240726/docs/ django_hosts-0.1.dev330+g625969b.d20240726/docs/Makefile django_hosts-0.1.dev330+g625969b.d20240726/docs/callbacks.rst django_hosts-0.1.dev330+g625969b.d20240726/docs/changelog.rst django_hosts-0.1.dev330+g625969b.d20240726/docs/conf.py django_hosts-0.1.dev330+g625969b.d20240726/docs/faq.rst django_hosts-0.1.dev330+g625969b.d20240726/docs/index.rst django_hosts-0.1.dev330+g625969b.d20240726/docs/make.bat django_hosts-0.1.dev330+g625969b.d20240726/docs/reference.rst django_hosts-0.1.dev330+g625969b.d20240726/docs/requirements.txt django_hosts-0.1.dev330+g625969b.d20240726/docs/templatetags.rst django_hosts-0.1.dev330+g625969b.d20240726/setup.cfg django_hosts-0.1.dev330+g625969b.d20240726/setup.py django_hosts-0.1.dev330+g625969b.d20240726/tests/ django_hosts-0.1.dev330+g625969b.d20240726/tests/__init__.py django_hosts-0.1.dev330+g625969b.d20240726/tests/base.py django_hosts-0.1.dev330+g625969b.d20240726/tests/broken_module.py django_hosts-0.1.dev330+g625969b.d20240726/tests/hosts/ django_hosts-0.1.dev330+g625969b.d20240726/tests/hosts/__init__.py django_hosts-0.1.dev330+g625969b.d20240726/tests/hosts/appended.py django_hosts-0.1.dev330+g625969b.d20240726/tests/hosts/blank.py django_hosts-0.1.dev330+g625969b.d20240726/tests/hosts/blank_wildcard.py django_hosts-0.1.dev330+g625969b.d20240726/tests/hosts/multiple.py django_hosts-0.1.dev330+g625969b.d20240726/tests/hosts/simple.py django_hosts-0.1.dev330+g625969b.d20240726/tests/migrations/ django_hosts-0.1.dev330+g625969b.d20240726/tests/migrations/0001_initial.py django_hosts-0.1.dev330+g625969b.d20240726/tests/migrations/__init__.py django_hosts-0.1.dev330+g625969b.d20240726/tests/models.py django_hosts-0.1.dev330+g625969b.d20240726/tests/settings.py django_hosts-0.1.dev330+g625969b.d20240726/tests/test_defaults.py django_hosts-0.1.dev330+g625969b.d20240726/tests/test_middleware.py django_hosts-0.1.dev330+g625969b.d20240726/tests/test_resolvers.py django_hosts-0.1.dev330+g625969b.d20240726/tests/test_sites.py django_hosts-0.1.dev330+g625969b.d20240726/tests/test_templatetags.py django_hosts-0.1.dev330+g625969b.d20240726/tests/test_utils.py django_hosts-0.1.dev330+g625969b.d20240726/tests/urls/ django_hosts-0.1.dev330+g625969b.d20240726/tests/urls/__init__.py django_hosts-0.1.dev330+g625969b.d20240726/tests/urls/complex.py django_hosts-0.1.dev330+g625969b.d20240726/tests/urls/multiple.py django_hosts-0.1.dev330+g625969b.d20240726/tests/urls/root.py django_hosts-0.1.dev330+g625969b.d20240726/tests/urls/simple.py django_hosts-0.1.dev330+g625969b.d20240726/tests/views.py django_hosts-0.1.dev330+g625969b.d20240726/tox.ini ```