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

Don't include tests in built wheel #1076

Merged
merged 1 commit into from
Jan 5, 2024

Conversation

carlsmedstad
Copy link
Contributor

@carlsmedstad carlsmedstad commented Jan 5, 2024

Tests should be included in the source distribution but there is no reason to include them in the built wheel.

Disable implicit packages (directories without an __init__.py file) altogether by setting the following in pyproject.toml:

[tool.setuptools.packages.find]
include = ["mlxtend", "mlxtend.*"]
namespaces = false

I assume the files in mlxtend/data/data are still needed so I've modified the package data to include files in that directory.

Build log extract from master:

$ git clean -fdx && python -m build --wheel --no-isolation
Removing build/
Removing dist/
Removing mlxtend.egg-info/
* Getting build dependencies for wheel...
validate_pyproject.api.load_builtin_plugin defines `tool.distutils` schema
validate_pyproject.api.load_builtin_plugin defines `tool.setuptools` schema
No `packages` or `py_modules` configuration, performing automatic discovery.
`flat-layout` detected -- analysing .
discovered packages -- ['mlxtend', 'mlxtend.classifier', 'mlxtend.math', 'mlxtend.cluster', 'mlxtend.externals', 'mlxtend._base', 'mlxtend.preprocessing', 'mlxtend.frequent_patterns', 'mlxtend.utils', 'mlxtend.text', 'mlxtend.file_io', 'mlxtend.evaluate', 'mlxtend.data', 'mlxtend.feature_extraction', 'mlxtend.feature_selection', 'mlxtend.regressor', 'mlxtend.plotting', 'mlxtend.classifier.tests', 'mlxtend.math.tests', 'mlxtend.cluster.tests', 'mlxtend.externals.pyprind', 'mlxtend._base.tests', 'mlxtend.preprocessing.tests', 'mlxtend.frequent_patterns.tests', 'mlxtend.utils.tests', 'mlxtend.text.tests', 'mlxtend.evaluate.tests', 'mlxtend.data.tests', 'mlxtend.data.data', 'mlxtend.feature_extraction.tests', 'mlxtend.feature_selection.tests', 'mlxtend.regressor.tests', 'mlxtend.plotting.tests', 'mlxtend.plotting.tests.data']
running egg_info
creating mlxtend.egg-info
writing mlxtend.egg-info/PKG-INFO
writing dependency_links to mlxtend.egg-info/dependency_links.txt
writing requirements to mlxtend.egg-info/requires.txt
writing top-level names to mlxtend.egg-info/top_level.txt
writing manifest file 'mlxtend.egg-info/SOURCES.txt'
reading manifest file 'mlxtend.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
warning: no files found matching '*.txt' under directory 'mlxtend/data'
adding license file 'LICENSE-BSD3.txt'
adding license file 'LICENSE-CC-BY.txt'
writing manifest file 'mlxtend.egg-info/SOURCES.txt'
* Building wheel...
validate_pyproject.api.load_builtin_plugin defines `tool.distutils` schema
validate_pyproject.api.load_builtin_plugin defines `tool.setuptools` schema
No `packages` or `py_modules` configuration, performing automatic discovery.
`flat-layout` detected -- analysing .
discovered packages -- ['mlxtend', 'mlxtend.classifier', 'mlxtend.math', 'mlxtend.cluster', 'mlxtend.externals', 'mlxtend._base', 'mlxtend.preprocessing', 'mlxtend.frequent_patterns', 'mlxtend.utils', 'mlxtend.text', 'mlxtend.file_io', 'mlxtend.evaluate', 'mlxtend.data', 'mlxtend.feature_extraction', 'mlxtend.feature_selection', 'mlxtend.regressor', 'mlxtend.plotting', 'mlxtend.classifier.tests', 'mlxtend.math.tests', 'mlxtend.cluster.tests', 'mlxtend.externals.pyprind', 'mlxtend._base.tests', 'mlxtend.preprocessing.tests', 'mlxtend.frequent_patterns.tests', 'mlxtend.utils.tests', 'mlxtend.text.tests', 'mlxtend.evaluate.tests', 'mlxtend.data.tests', 'mlxtend.data.data', 'mlxtend.feature_extraction.tests', 'mlxtend.feature_selection.tests', 'mlxtend.regressor.tests', 'mlxtend.plotting.tests', 'mlxtend.plotting.tests.data']
running bdist_wheel
running build
running build_py
creating build
creating build/lib
creating build/lib/mlxtend
...
adding 'mlxtend/utils/__init__.py'
adding 'mlxtend/utils/base_compostion.py'
adding 'mlxtend/utils/checking.py'
adding 'mlxtend/utils/counter.py'
adding 'mlxtend/utils/testing.py'
adding 'mlxtend/utils/tests/test_checking_inputs.py'
adding 'mlxtend/utils/tests/test_counter.py'
adding 'mlxtend/utils/tests/test_testing.py'
adding 'mlxtend-0.23.1.dist-info/LICENSE-BSD3.txt'
adding 'mlxtend-0.23.1.dist-info/LICENSE-CC-BY.txt'
adding 'mlxtend-0.23.1.dist-info/METADATA'
adding 'mlxtend-0.23.1.dist-info/WHEEL'
adding 'mlxtend-0.23.1.dist-info/top_level.txt'
adding 'mlxtend-0.23.1.dist-info/RECORD'
removing build/bdist.linux-x86_64/wheel
Successfully built mlxtend-0.23.1-py3-none-any.whl

Build log extract after my changes:

$ git clean -fdx && python -m build --wheel --no-isolation
Removing build/
Removing dist/
Removing mlxtend.egg-info/
* Getting build dependencies for wheel...
validate_pyproject.api.load_builtin_plugin defines `tool.distutils` schema
validate_pyproject.api.load_builtin_plugin defines `tool.setuptools` schema
running egg_info
creating mlxtend.egg-info
writing mlxtend.egg-info/PKG-INFO
writing dependency_links to mlxtend.egg-info/dependency_links.txt
writing requirements to mlxtend.egg-info/requires.txt
writing top-level names to mlxtend.egg-info/top_level.txt
writing manifest file 'mlxtend.egg-info/SOURCES.txt'
reading manifest file 'mlxtend.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
warning: no files found matching '*.txt' under directory 'mlxtend/data'
adding license file 'LICENSE-BSD3.txt'
adding license file 'LICENSE-CC-BY.txt'
writing manifest file 'mlxtend.egg-info/SOURCES.txt'
* Building wheel...
validate_pyproject.api.load_builtin_plugin defines `tool.distutils` schema
validate_pyproject.api.load_builtin_plugin defines `tool.setuptools` schema
running bdist_wheel
running build
running build_py
creating build
creating build/lib
creating build/lib/mlxtend
...
adding 'mlxtend/utils/__init__.py'
adding 'mlxtend/utils/base_compostion.py'
adding 'mlxtend/utils/checking.py'
adding 'mlxtend/utils/counter.py'
adding 'mlxtend/utils/testing.py'
adding 'mlxtend-0.23.1.dist-info/LICENSE-BSD3.txt'
adding 'mlxtend-0.23.1.dist-info/LICENSE-CC-BY.txt'
adding 'mlxtend-0.23.1.dist-info/METADATA'
adding 'mlxtend-0.23.1.dist-info/WHEEL'
adding 'mlxtend-0.23.1.dist-info/top_level.txt'
adding 'mlxtend-0.23.1.dist-info/RECORD'
removing build/bdist.linux-x86_64/wheel
Successfully built mlxtend-0.23.1-py3-none-any.whl

Tests should be included in the source distribution but there is no
reason to include them in the build wheel.

Disable implicit packages (directories without an __init__.py file)
altogether by setting the following in pyproject.toml:

[tool.setuptools.packages.find]
include = ["mlxtend", "mlxtend.*"]
namespaces = false

I assume the files in mlxtend/data/data are still needed so I've
modified the package data to include files in that directory.
@rasbt
Copy link
Owner

rasbt commented Jan 5, 2024

Thanks for the PR. Yes, data/data is required for the datasets. Thanks!

@rasbt rasbt merged commit 62f9e94 into rasbt:master Jan 5, 2024
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