chore(build): migrate from setuptools to hatchling#94
Conversation
Replace setuptools/wheel build backend with hatchling. Simplifies package discovery config — hatchling automatically includes py.typed and all package data without explicit declarations. Made-with: Cursor
There was a problem hiding this comment.
Pull request overview
This PR migrates the project’s Python build backend from setuptools/wheel to hatchling, aiming to simplify package discovery and packaging configuration.
Changes:
- Switch
[build-system]backend fromsetuptools.build_metatohatchling.build. - Replace
tool.setuptoolspackage discovery/package-data configuration withtool.hatch.buildwheel/sdist target configuration.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
|
||
| package-data = { albucore = [ "py.typed" ] } | ||
| [tool.hatch.build.targets.wheel] | ||
| packages = ["albucore"] |
There was a problem hiding this comment.
With hatchling, non-.py package data is not always included unless explicitly selected by the wheel file selection rules. To avoid accidentally dropping PEP 561 typing support, explicitly include albucore/py.typed in the wheel build configuration (or configure wheel include/artifacts/shared-data accordingly) so the marker file is guaranteed to be present in the built wheel.
| packages = ["albucore"] | |
| packages = ["albucore"] | |
| include = ["albucore/py.typed"] |
pyproject.toml
Outdated
| [tool.setuptools.exclude-package-data] | ||
| "*" = [ "tests*", "benchmarks*", "benchmark*", "conda.recipe*" ] | ||
| [tool.hatch.build.targets.sdist] | ||
| exclude = ["tests", "benchmarks", "benchmark", "conda.recipe"] |
There was a problem hiding this comment.
[tool.hatch.build.targets.sdist].exclude entries look like plain directory names; hatchling expects glob patterns, so this may not exclude the directory contents from the sdist. Consider switching these to directory globs (e.g., tests/**, benchmarks/**, etc.) so unwanted sources are reliably excluded from the sdist artifact.
| exclude = ["tests", "benchmarks", "benchmark", "conda.recipe"] | |
| exclude = ["tests/**", "benchmarks/**", "benchmark/**", "conda.recipe/**"] |
Explicitly include albucore/py.typed in wheel target and use glob patterns for sdist excludes so hatchling reliably strips test/benchmark dirs. Made-with: Cursor
Replace setuptools/wheel build backend with hatchling. Simplifies package discovery config — hatchling automatically includes py.typed and all package data without explicit declarations.
Made-with: Cursor