feat: migrate to modern PyPI packaging (v2.1.0)#119
Open
feat: migrate to modern PyPI packaging (v2.1.0)#119
Conversation
Replace legacy setup.py with pyproject.toml-only build using hatchling and versioningit. Add CI workflow (tests + lint on Python 3.9-3.12), publish workflow (trusted publishing to TestPyPI/PyPI), MANIFEST.in for sdist, and PEP 561 py.typed marker. Pin dependency lower bounds and update Python baseline from 3.8 to 3.9. Co-Authored-By: Claude Opus 4 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4 <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
Migrates madengine packaging and release automation to a modern, pyproject.toml-driven build using Hatchling + Versioningit, adds CI/publish workflows, and updates project metadata (including Python >=3.9 and dependency lower bounds).
Changes:
- Remove legacy
setup.pyand rely on Hatchling (pyproject.toml) with dynamic git-tag-based versioning viaversioningit. - Add GitHub Actions workflows for CI (tests + lint on 3.9–3.12) and publishing to (Test)PyPI using trusted publishing.
- Add packaging metadata/files (
py.typed,MANIFEST.in, updated classifiers/keywords,.gitignoredist artifacts).
Reviewed changes
Copilot reviewed 5 out of 7 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
setup.py |
Removed legacy setuptools-based build/compat layer. |
pyproject.toml |
Updates metadata (Python>=3.9, deps lower bounds), dynamic versioning config, and Hatch build configuration. |
src/madengine/py.typed |
Adds PEP 561 marker for downstream type checkers. |
MANIFEST.in |
Adds sdist inclusion rules (note: may not be used by Hatchling). |
.github/workflows/ci.yml |
New CI workflow running tests and linting. |
.github/workflows/publish.yml |
New build/test-install/publish workflow for (Test)PyPI. |
.gitignore |
Ignores wheel/tarball outputs. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Add fetch-depth: 0 to lint job so versioningit can derive version - Create .flake8 config with max-line-length=88 matching black - Add package asset verification step to publish workflow - Ignore pre-existing lint categories (E501, F541, etc.) that need separate cleanup Co-Authored-By: Claude Opus 4 <noreply@anthropic.com>
Hatchling ignores MANIFEST.in — sdist/wheel inclusion is configured via [tool.hatch.build] in pyproject.toml. Keeping it creates false confidence about what gets packaged. Co-Authored-By: Claude Opus 4 <noreply@anthropic.com>
- Apply black formatting across all src/ and tests/ files - Sort imports with isort (profile=black) - Remove unused imports (F401): os, sys, Path, argparse, Context, GPUInstallationError, validate_rocm_installation - Remove unused variables (F841): exception aliases, manifest_file, result, BASE_DIR, gpu_info, job, pull_error - Fix shadowed import (F402): rename loop var 'field' to 'field_name' in mongodb.py Co-Authored-By: Claude Opus 4 <noreply@anthropic.com>
E2e tests run `madengine run` which needs Docker and GPU access, neither available on GitHub Actions runners. Exclude tests/e2e/ from CI to avoid 50 false failures. Co-Authored-By: Claude Opus 4 <noreply@anthropic.com>
… e2e tests pytest.ini defined testpaths including tests/e2e/, which took precedence over pyproject.toml and caused e2e tests to run in CI despite --ignore. Consolidate all pytest config into pyproject.toml with the correct markers, fix python_paths → pythonpath, and add --strict-markers. Co-Authored-By: Claude Opus 4 <noreply@anthropic.com>
Typer/Rich injects ANSI escape sequences into --help output that can split option names mid-word on CI runners, causing string-in-string assertions to fail despite the flag being present. Co-Authored-By: Claude Opus 4 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
setup.py(307 lines) withpyproject.toml-only build usinghatchling+versioningitpublish workflow (trusted publishing)
core dependencies
Changes
Packaging
setup.pyremoved — all configuration lives inpyproject.tomlversioningit: version isderived from git tags automatically; no hardcoded strings
py.typedadded (PEP 561) — enables type checkersupport for downstream consumers
MANIFEST.inadded — ensures scripts, templates,presets, LICENSE, and README are included in sdist
pandas>=1.3,sqlalchemy>=1.4) for better reproducibilityCI/CD
.github/workflows/ci.yml— runspytest -m "not slow and not integration"and lint (black, isort, flake8) acrossPython 3.9/3.10/3.11/3.12 on every push/PR to
develop/main.github/workflows/publish.yml— builds sdist + wheel,verifies install and
madengine --helpacross all Pythonversions, then publishes via PyPI trusted publishing (no
stored API tokens needed); manual dispatch to TestPyPI for
pre-release validation
Test plan
python -m buildproduces valid sdist and wheelpy.typedpip install dist/*.whl && madengine --helpworksimport madengine; print(madengine.__version__)returnsgit-tag-derived version
pytest -m "not slow and not integration")