MNT Automate version management with setuptools-scm and simplify release workflow#587
Merged
MNT Automate version management with setuptools-scm and simplify release workflow#587
Conversation
Co-authored-by: mvdoc <6150554+mvdoc@users.noreply.github.com>
Co-authored-by: mvdoc <6150554+mvdoc@users.noreply.github.com>
Co-authored-by: mvdoc <6150554+mvdoc@users.noreply.github.com>
Co-authored-by: mvdoc <6150554+mvdoc@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Simplify release workflow with setuptools-scm
Automate version management with setuptools-scm and simplify release workflow
Dec 15, 2025
Contributor
There was a problem hiding this comment.
Pull request overview
This PR aims to switch pycortex to automatic versioning via setuptools-scm and to simplify the release process so that publishing to PyPI/TestPyPI happens automatically from GitHub releases.
Changes:
- Removed manual version parsing from
setup.pyand moved version management tosetuptools-scm, exposing the version viacortex.version. - Introduced a new GitHub Actions workflow that builds distributions once and publishes them to both PyPI and TestPyPI using trusted publishing, with support for manual TestPyPI-only runs.
- Updated release documentation and .gitignore to reflect the new automated workflow and generated
_version.pyfile.
Reviewed changes
Copilot reviewed 6 out of 7 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
setup.py |
Removed the custom get_version() machinery and the explicit version argument to setup(), intending to let setuptools-scm supply the version instead. |
pyproject.toml |
Declared setuptools-scm as a build requirement and added a [tool.setuptools_scm] section to configure writing a generated version file under cortex/. |
cortex/version.py |
Replaced the previous git-describe-based dynamic version logic with a simple import from cortex._version (generated by setuptools-scm) and a hardcoded development fallback. |
RELEASE.md |
Rewrote the release instructions to describe the new “create a GitHub release” workflow and how versions are derived from tags and published to PyPI/TestPyPI. |
.gitignore |
Ignored the generated cortex/_version.py file produced during builds. |
.github/workflows/publish_to_pypi.yml |
Removed the old tag-based, token-based PyPI publishing workflow. |
.github/workflows/publish.yml |
Added a new workflow that builds distributions once, uploads them as artifacts, and publishes to PyPI on release events and to TestPyPI on both releases and manual workflow_dispatch runs using trusted publishing. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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.
Eliminates manual version file editing and reduces release process from 5 steps to 1. Follows implementation pattern from gallantlab/autoflatten.
Changes
Version Management
cortex/version.pyimports from auto-generated_version.pywith fallback for dev environmentssetup.pyX.Y.Z.devNbetween releasesRelease Workflow
workflow_dispatchfor manual TestPyPI testingfetch-depth: 0ensures setuptools-scm can access full git historyRelease Process (see updated RELEASE.md)
Prerequisites for Deployment
Repository admins must configure PyPI/TestPyPI environments with trusted publishing before workflow can publish packages.
Original prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.