Skip to content

Conversation

@RonnyPfannschmidt
Copy link
Member

@RonnyPfannschmidt RonnyPfannschmidt commented Oct 18, 2025

This pull request completely restructures the project's GitHub Actions workflows for CI and deployment. It removes the old main.yml and deploy.yml workflows and introduces a new, more modular test.yml workflow. The new workflow separates build, test, and publishing steps, adds artifact verification, and improves security and reproducibility with build provenance attestation.

Key changes:

Workflow modernization and modularization:

  • Removed the legacy .github/workflows/main.yml and .github/workflows/deploy.yml workflows, consolidating their functionality into a single, clearer workflow. [1] [2]
  • Added .github/workflows/test.yml, which organizes jobs into distinct stages: build and inspect, test, publish to PyPI, and publish to TestPyPI.

Build and artifact improvements:

  • Introduced a build-and-inspect job using hynek/build-and-inspect-python-package@v2 to build the package and generate build provenance attestations, enhancing supply chain security.
  • Test jobs now explicitly verify the presence of wheel and sdist artifacts before running tests, ensuring that only valid builds proceed.

Testing enhancements:

  • Tests are run on multiple Python versions (3.8–3.13) and both Ubuntu and Windows, using the built wheel for testing to better match real-world usage.
  • Switched to using uv for Python environment management and test execution, improving speed and reproducibility.

Publishing improvements:

  • Publishing to PyPI and TestPyPI is now handled in dedicated jobs, with clearer conditions and use of GitHub environments for secrets and permissions.

These changes make the CI/CD process more robust, secure, and maintainable.- Remove pre-commit job from workflow

  • Migrate to unified test workflow with build-and-inspect

RonnyPfannschmidt and others added 16 commits October 18, 2025 14:24
The pre-commit checks are now handled by pre-commit.ci, so the
dedicated workflow job is no longer needed.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
- Replace separate main.yml and deploy.yml with unified test.yml
- Use hynek/build-and-inspect-python-package@v2 for building
- Remove SETUPTOOLS_SCM_PRETEND_VERSION hack (no longer needed)
- Test actual built wheel artifacts instead of source
- Migrate from hatch to uv for faster dependency management
- Add uv caching with astral-sh/setup-uv@v7
- Use trusted publishing with correct environment names
- Enable build provenance attestations for supply chain security

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
Add id-token, attestations, and contents permissions to the
build-and-inspect job to enable OIDC token generation for
build provenance attestations.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
Use uv's isolated environment approach instead of system-wide
installation. This is the recommended pattern for both GitHub
Actions and GitLab CI.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
- Move sparse checkout to the beginning (before uv setup)
- Include uv.lock in sparse checkout for dependency resolution
- Add verification step to assert wheel and sdist artifacts exist
- List dist/ contents for debugging if tests fail

This ensures the workflow fails fast if build artifacts are missing
or malformed.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
Set bash as the default shell for the test job to ensure glob
patterns work consistently on both Ubuntu and Windows runners.
This simplifies the workflow by avoiding platform-specific paths.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
Use the supported_python_classifiers_json_array output from
build-and-inspect-python-package instead of hardcoding Python
versions. This ensures the CI automatically tests all Python
versions declared in the package classifiers.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
- Switch from hatchling to setuptools>=77 build backend
- Use modern PEP 639 license specifiers (license-files)
- Configure setuptools_scm to write version to _version.py
- Drop Python 3.8 and 3.9 support (requires-python >= 3.10)
- Add SETUPTOOLS_SCM_OVERRIDES_FOR_INICONFIG to use no-local-version
  scheme on main branch instead of SETUPTOOLS_SCM_PRETEND_VERSION hack
- Remove hatch configuration and test environments

This modernizes the build system and uses setuptools_scm's official
override mechanism for controlling version schemes per branch.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
- Replace black and pyupgrade with ruff-check and ruff-format hooks
- Configure ruff with isort (I), bugbear (B), pyupgrade (UP),
  and pytest-style (PT) rules
- Set force-single-line imports for isort
- Auto-fix imports and code style with ruff

Ruff automatically:
- Sorted and organized imports (isort)
- Upgraded to modern Python syntax (pyupgrade)
- Applied bugbear fixes
- Fixed pytest style issues (renamed shadowing variables)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
- Remove `from __future__ import annotations` (default in Python 3.10+)
- Remove TYPE_CHECKING guard for Final imports (not needed in 3.10+)
- Import Final directly from typing module
- Use forward references for IniConfig in SectionWrapper

These patterns are no longer needed since we require Python >= 3.10
and PEP 563 postponed evaluation is the default.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
- Add CHANGELOG entry for version 2.2.0
- Add create-release job to auto-create GitHub releases on tag push
- Change publish-to-pypi to trigger on tag push (not release event)
- Auto-generate release notes and attach build artifacts

The release process is now fully automated: push a tag and the
workflow will build, test, create a GitHub release, and publish to PyPI.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
@RonnyPfannschmidt RonnyPfannschmidt merged commit 6522881 into main Oct 18, 2025
29 checks passed
@RonnyPfannschmidt RonnyPfannschmidt deleted the fix-build branch October 18, 2025 19:56
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