Migrate to pyproject.toml - #36
Merged
Merged
Conversation
- Add pyproject.toml with build configuration and metadata - Simplify setup.py to only define C extension with platform flags - Add uv.lock for reproducible dependency resolution - Move dev dependencies to dependency-groups in pyproject.toml - Move pytest config to pyproject.toml - Remove requirements-dev.txt (now in pyproject.toml) - Remove pytest.ini (now in pyproject.toml) - Update MANIFEST.in for new file structure - Reformat code with black
- Swap black for ruff in dev dependencies (faster, includes linting) - Add ruff configuration to pyproject.toml - Fix duplicate test function name caught by ruff linter
- Update Python versions: drop 3.6-3.8 (EOL), add 3.11-3.13 - Update runner images: ubuntu-24.04, macos-13/14, windows-2022 - Use native ARM runners for macOS arm64 builds - Use uv for sdist job (setup-uv action) - Replace requirements-dev.txt with direct pip install of test deps - Use unique artifact names to avoid conflicts with v4 upload action - Update artifact download to use pattern matching for multiple artifacts
CIBW_BEFORE_TEST now installs uv first, then uses uv to install pytest and pytest-benchmark (faster dependency resolution).
Prevents pytest from adding project directory to sys.path, which was causing it to find the hexhamming/ source directory instead of the installed wheel.
The hexhamming/ directory containing C++ sources was being found by Python as a package, shadowing the installed wheel during tests.
Use CIBW_TEST_REQUIRES instead of CIBW_BEFORE_TEST to properly install test dependencies into the isolated test virtualenv. Also remove --import-mode=importlib which is no longer needed.
Use {text = "MIT"} format instead of plain string to avoid PEP 639
metadata (license-expression, license-file) that older twine versions
don't recognize. Also add License classifier for better compatibility.
Twine 6.0+ supports the license-file and license-expression fields. Also removed redundant license field since classifier is sufficient.
Setuptools auto-detects LICENSE and generates license-file metadata, which requires packaging>=24.2 to validate. Disable this by setting license-files = [] in [tool.setuptools]. The license is still declared via the classifier.
mrecachinas
marked this pull request as ready for review
February 12, 2026 03:22
📊 Benchmark Comparison Results
➖ 23 benchmarks within noise (click to expand)
Legend: ✅ Faster (>5%) · |
- Use SPDX license expression (license = 'MIT') instead of deprecated classifier - Remove deprecated tool.setuptools.license-files in favor of auto-detection - Bump setuptools requirement to >=77.0.0 for SPDX support - Add Python 3.13 classifier - Fix MANIFEST.in: include LICENSE, exclude *.pyc/*.pyo/*.so/__pycache__ - Add check-manifest config to ignore uv.lock - Verified: twine check passes, check-manifest passes, wheel and sdist both install and work correctly Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
setuptools>=77 emits License-Expression (Metadata 2.4) which requires twine>=6.1.0 (with packaging>=24.2) to validate. twine 6.0.x rejects these fields as unrecognized. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
CI had twine 6.2.0 but packaging 24.0 — Metadata 2.4 (License-Expression) requires packaging>=24.2. Explicitly pin it in all pip install lines. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.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.
This pull request introduces several major improvements to the project, including a migration to a modern Python packaging standard, updates to the CI workflow for broader compatibility and maintainability, a switch to a more permissive license, and general code and test modernization. The most important changes are grouped by theme below.
Project packaging and build system modernization:
pyproject.tomlfile to define build requirements, project metadata, and development dependencies, moving away from legacysetup.py-only configuration. The build now usessetuptoolsas the backend, and test/dev dependencies are clearly specified.setup.pyto only handle the C extension build with platform-specific flags; all metadata and dependencies are now inpyproject.toml. Source files are now referenced from thesrcdirectory.MANIFEST.into includepyproject.tomland migrate source and test directory structure.requirements-dev.txtandpytest.iniin favor of configuration inpyproject.toml. [1] [2]Licensing:
LICENSEfile accordingly.Continuous Integration and Distribution:
.github/workflows/pythonpackage.ymlto:uvfor dependency management and building on macOS.twine>=6.0.0and show version before checks.cibuildwheel. [1] [2]Testing improvements:
test/test_hexhamming.pyto use consistent string and byte literals, improved parameterization, updated function and variable names for clarity, and improved assertion and error handling. [1] [2] [3] [4] [5] [6] [7] [8] [9]Summary of most important changes:
1. Packaging and Build System:
pyproject.tomlfor modern, standardized project configuration, including build system, metadata, and dev dependencies.src/, updatedsetup.pyto only handle extension build, and removed legacy files (requirements-dev.txt,pytest.ini). [1] [2] [3] [4]2. Licensing:
LICENSEfile.3. CI/CD and Distribution:
uvfor dependency management, and improved artifact handling and naming. [1] [2]4. Testing: