Modernize build system: migrate to hatchling + hatch-vcs#25
Modernize build system: migrate to hatchling + hatch-vcs#25ruaan-deysel wants to merge 1 commit intokclif9:mainfrom
Conversation
ruaan-deysel
commented
Feb 23, 2026
- Migrate from setuptools/requirements.txt to hatchling + hatch-vcs
- Remove legacy setup.py and requirements.txt
- Add py.typed marker (PEP 561) for downstream type information
- Add _version.py using importlib.metadata (syncs with distribution)
- Update publish.yml to use python -m build with latest action versions
- Add CHANGELOG.md
- Add tests for version and py.typed marker
- Migrate from setuptools/requirements.txt to hatchling + hatch-vcs - Remove legacy setup.py and requirements.txt - Add py.typed marker (PEP 561) for downstream type information - Add _version.py using importlib.metadata (syncs with distribution) - Update publish.yml to use python -m build with latest action versions - Add CHANGELOG.md - Add tests for version and py.typed marker
There was a problem hiding this comment.
Pull request overview
Migrates the project’s packaging/build workflow from setuptools to a PEP 517/518 setup using hatchling + hatch-vcs, adds typed-package metadata, and updates CI/docs to match the new release process.
Changes:
- Switch build backend to
hatchlingwith VCS-driven dynamic versioning and addactron_neo_api.__version__. - Add
py.typedmarker (PEP 561) plus tests for version/typing marker presence. - Remove legacy
setup.py/requirements.txt, update pre-commit and publish workflow, and add a changelog.
Reviewed changes
Copilot reviewed 12 out of 14 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
tests/test_models.py |
Adds packaging/version tests alongside existing model tests. |
src/actron_neo_api/py.typed |
Introduces PEP 561 marker file for downstream typing. |
src/actron_neo_api/_version.py |
Provides runtime version lookup via importlib.metadata. |
src/actron_neo_api/__init__.py |
Exposes __version__ at package level. |
setup.py |
Removed legacy setuptools entrypoint. |
requirements.txt |
Removed legacy dependency list (moved to pyproject.toml). |
pyproject.toml |
Defines hatchling/hatch-vcs build + project metadata/deps and adds bandit config. |
README.md |
Minor markdown whitespace/formatting adjustments. |
CHANGELOG.md |
Adds initial changelog following Keep a Changelog format. |
.vscode/settings.json |
Reformats and updates editor settings (ruff formatter). |
.pre-commit-config.yaml |
Adds bandit and prettier hooks; minor formatting tweak. |
.github/workflows/publish.yml |
Updates actions versions and builds via python -m build. |
.github/release-drafter.yml |
YAML quoting/formatting normalization. |
.github/copilot-instructions.md |
Markdown formatting/spacing adjustments. |
| "python.linting.enabled": true, | ||
| "python.linting.flake8Enabled": true, | ||
| "python.linting.lintOnSave": true, | ||
| "python.linting.flake8Args": ["--max-line-length=88"], |
There was a problem hiding this comment.
VS Code settings still enable Flake8 linting and set an 88-char max line length, but the repo has migrated to ruff (and pyproject.toml sets line-length = 100 with no Flake8 dependency). This mismatch can lead to inconsistent local feedback vs CI/pre-commit. Consider removing the Flake8-specific keys and/or aligning the editor line-length to the ruff config.
| "python.linting.enabled": true, | |
| "python.linting.flake8Enabled": true, | |
| "python.linting.lintOnSave": true, | |
| "python.linting.flake8Args": ["--max-line-length=88"], |
| description="Python API wrapper for the Actron Neo API." | ||
| description = "Python API wrapper for the Actron Neo API." | ||
| readme = "README.md" | ||
| license = "MIT" |
There was a problem hiding this comment.
license = "MIT" is not PEP 621–compliant in many build/metadata validators (they expect license to be a table like { text = "MIT" } or { file = "LICENSE" }). With hatchling/PEP517 builds this can cause python -m build/metadata generation to fail in stricter environments. Consider switching to a PEP 621-compatible license table to avoid build-time validation errors.
| license = "MIT" | |
| license = { text = "MIT" } |
| def test_py_typed_exists(self) -> None: | ||
| """py.typed marker should exist in the package directory.""" | ||
| package_dir = pathlib.Path(__file__).resolve().parent.parent / "src" / "actron_neo_api" | ||
| assert (package_dir / "py.typed").exists() |
There was a problem hiding this comment.
This test hard-codes the repository src/actron_neo_api path, so it only checks that py.typed exists in the working tree—not that it’s actually accessible from the installed package (wheel/sdist). To validate PEP 561 packaging, resolve the package directory via the installed module (e.g., importlib.resources / actron_neo_api.__file__) and assert py.typed exists there.