Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Dec 15, 2025

Eliminates manual version file editing and reduces release process from 5 steps to 1. Follows implementation pattern from gallantlab/autoflatten.

Changes

Version Management

  • Version numbers now automatically derived from git tags via setuptools-scm
  • cortex/version.py imports from auto-generated _version.py with fallback for dev environments
  • Removed manual version parsing logic from setup.py
  • Development versions auto-increment as X.Y.Z.devN between releases

Release Workflow

  • Replaced tag-based workflow with release event trigger
  • Builds artifacts in isolated job, publishes to both PyPI and TestPyPI
  • Uses trusted publishing (OIDC) instead of API tokens
  • Added workflow_dispatch for manual TestPyPI testing
  • fetch-depth: 0 ensures setuptools-scm can access full git history

Release Process (see updated RELEASE.md)

# Before: Edit version.py, commit, tag, push, create release, revert version
# After: Create GitHub release with version tag (e.g., v1.3.0)

Prerequisites for Deployment

Repository admins must configure PyPI/TestPyPI environments with trusted publishing before workflow can publish packages.

Original prompt

This section details on the original issue you should resolve

<issue_title>Simplify release workflow</issue_title>
<issue_description>The current release workflow requires too many steps.
Follow what I implemented in https://github.com/gallantlab/autoflatten:

  1. Use setuptools-scm to automatically derive version numbers from git tags
  2. Set up a workflow to release to pypi and testpypi upon new github releases.

</issue_description>

<agent_instructions>Make sure to check how I implemented this in https://github.com/gallantlab/autoflatten. I will need to enable environments in pypi/testpypi. But you can assume that they will be available. </agent_instructions>

Comments on the Issue (you are @copilot in this section)


💡 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.

Copilot AI and others added 4 commits December 15, 2025 16:20
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
Copilot AI requested a review from mvdoc December 15, 2025 16:31
@mvdoc mvdoc marked this pull request as ready for review January 27, 2026 01:21
Copilot AI review requested due to automatic review settings January 27, 2026 01:21
@mvdoc mvdoc changed the title Automate version management with setuptools-scm and simplify release workflow MNT Automate version management with setuptools-scm and simplify release workflow Jan 27, 2026
@mvdoc mvdoc merged commit b7b0f05 into main Jan 27, 2026
19 checks passed
@mvdoc mvdoc deleted the copilot/simplify-release-workflow branch January 27, 2026 01:22
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.py and moved version management to setuptools-scm, exposing the version via cortex.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.py file.

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.

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.

Simplify release workflow

2 participants