Skip to content

Simplifies version tracking and release procedures - #3331

Merged
PTNobel merged 7 commits into
masterfrom
prototype/setuptools-scm
Jun 18, 2026
Merged

PTNobel merged 7 commits into
masterfrom
prototype/setuptools-scm

Conversation

@PTNobel

@PTNobel PTNobel commented May 19, 2026

Copy link
Copy Markdown
Collaborator

Description

I was reworking the CVXPYlayers release procedures, and realized we could generate version numbers from the version control system via setuptools-scm; I went ahead and had Claude prototype the change. I think it looks nice and seems like an improvement and figured I'd check what others think.

Type of change

  • New feature (backwards compatible)
  • New feature (breaking API changes)
  • Bug fix
  • Other (Documentation, CI, ...)

Contribution checklist

  • Add our license to new files.
  • Check that your code adheres to our coding style.
  • Write unittests.
  • Run the unittests and check that they’re passing.
  • Run the benchmarks to make sure your change doesn’t introduce a regression.

@PTNobel
PTNobel requested a review from SteveDiamond May 19, 2026 06:33
Comment thread pyproject.toml
Comment thread PROCEDURES.md Outdated
@SteveDiamond

Copy link
Copy Markdown
Collaborator

This is a nice idea!

@PTNobel

PTNobel commented May 20, 2026

Copy link
Copy Markdown
Collaborator Author

⚠️ Manual step required after merge: create the dummy-v1.9.0 anchor tag

The CI failures on this PR (test_derivative, test_backends, pyright, etc. — all failing at uv sync) come from a tag-reachability problem with the new setuptools-scm setup, and one manual git step is required after this PR merges for master to compute a correct version.

The problem

semver-pep440-release-branch derives the version from the nearest git describe tag. But cvxpy's release tags (v1.7.x–v1.9.0) live on release/* branches and are not ancestors of master. So git describe from master skips them and falls back to the ancient v1.1.18:

describe config master version
--match v* (this PR, before fix) 1.2.0.dev805+g… ❌
--match v* --match dummy-v* (this PR, after fix) + anchor tag 1.10.0.dev1+g… ✅

A wrong base version (1.2.0) also fails diffcp's cvxpy>=1.6.3 requirement during resolution, which is the proximate cause of the red CI.

What this PR now does

  • describe_command also matches dummy-v* — an anchor tag on master that makes the most recent minor release reachable. This is additive: it does not move or touch the published v1.9.0 tag.
  • build.yml tag builds + the DEPLOY gate are restricted to v*, so dummy-v* tags can never trigger a PyPI deploy.

Required manual step after merge

Create the anchor tag on the master commit release/1.9.x was branched from (eb1fea237, the parent of cd95b324c):

git tag -a dummy-v1.9.0 eb1fea237 -m "setuptools-scm anchor: master 1.9 branch point"
git push origin dummy-v1.9.0

This adds no commits to master — it is a ref only. Verified locally: with this tag, master HEAD resolves to 1.10.0.dev1+gcd95b324c, and release/1.9.x still resolves to the real v1.9.0 (it is closer). Going forward, the procedure in PROCEDURES.md tags v1.10.0 directly on master, so once 1.10.0 ships no further anchor tags are needed.

@github-actions

github-actions Bot commented May 20, 2026 •

Copy link
Copy Markdown
Contributor

Benchmarks that have stayed the same:

   before           after         ratio
 [6a27fc27]       [5fcf5a13]
      1.39±0s          1.40±0s     1.01  matrix_stuffing.ParamConeMatrixStuffing.time_compile_problem
      4.52±0s          4.56±0s     1.01  svm_l1_regularization.SVMWithL1Regularization.time_compile_problem
      1.57±0s          1.59±0s     1.01  tv_inpainting.TvInpainting.time_compile_problem
      2.81±0s          2.83±0s     1.01  simple_QP_benchmarks.ParametrizedQPBenchmark.time_compile_problem
      20.8±0s          20.9±0s     1.00  sdp_segfault_1132_benchmark.SDPSegfault1132Benchmark.time_compile_problem
      1.99±0s          1.99±0s     1.00  semidefinite_programming.SemidefiniteProgramming.time_compile_problem
      1.94±0s          1.95±0s     1.00  simple_LP_benchmarks.SimpleScalarParametrizedLPBenchmark.time_compile_problem
      751±0ms          753±0ms     1.00  simple_LP_benchmarks.SimpleFullyParametrizedLPBenchmark.time_compile_problem
      3.68±0s          3.69±0s     1.00  matrix_stuffing.ParamSmallMatrixStuffing.time_compile_problem
      3.75±0s          3.75±0s     1.00  simple_QP_benchmarks.UnconstrainedQP.time_compile_problem
      12.6±0s          12.6±0s     1.00  finance.CVaRBenchmark.time_compile_problem
      3.98±0s          3.98±0s     1.00  huber_regression.HuberRegression.time_compile_problem
      1.92±0s          1.92±0s     1.00  finance.FactorCovarianceModel.time_compile_problem
      1.41±0s          1.41±0s     1.00  gini_portfolio.Yitzhaki.time_compile_problem
      2.10±0s          2.10±0s     1.00  simple_QP_benchmarks.LeastSquares.time_compile_problem
      10.4±0s          10.4±0s     1.00  simple_LP_benchmarks.SimpleLPBenchmark.time_compile_problem
      3.48±0s          3.47±0s     1.00  matrix_stuffing.ConeMatrixStuffingBench.time_compile_problem
      2.52±0s          2.51±0s     1.00  slow_pruning_1668_benchmark.SlowPruningBenchmark.time_compile_problem
      4.24±0s          4.21±0s     0.99  simple_QP_benchmarks.SimpleQPBenchmark.time_compile_problem
      5.31±0s          5.26±0s     0.99  optimal_advertising.OptimalAdvertising.time_compile_problem
      2.47±0s          2.44±0s     0.99  matrix_stuffing.SmallMatrixStuffing.time_compile_problem
      1.24±0s          1.23±0s     0.99  gini_portfolio.Murray.time_compile_problem
      5.35±0s          5.28±0s     0.99  gini_portfolio.Cajas.time_compile_problem
      166±0ms          163±0ms     0.99  high_dim_convex_plasticity.ConvexPlasticity.time_compile_problem
      3.05±0s          2.98±0s     0.98  quantum_hilbert_matrix.QuantumHilbertMatrix.time_compile_problem

@PTNobel
PTNobel force-pushed the prototype/setuptools-scm branch from 8073f32 to a536afd Compare June 6, 2026 02:23
@PTNobel

PTNobel commented Jun 6, 2026

Copy link
Copy Markdown
Collaborator Author

@SteveDiamond can we merge this PR?

PTNobel and others added 7 commits June 8, 2026 12:51
Replace the hand-maintained MAJOR/MINOR/MICRO/IS_RELEASED constants in
setup/versioning.py with setuptools-scm. The version is now derived from
git tags at build time and written to cvxpy/_version.py.

PROCEDURES.md updated: release now means tagging master at the cut point
instead of editing a constant. Patch tags continue to live on release/*
branches; minor tags must be reachable from master so setuptools-scm's
release-branch-semver scheme can find them.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Rename version_scheme from `release-branch-semver` (deprecated entry point
name) to `semver-pep440-release-branch`, and move `git_describe_command`
under the `scm.git` namespace as `describe_command`. Both deprecations were
flagged by setuptools-scm 8.x.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
- Add fetch-depth: 0 to actions/checkout in every workflow that builds
  or installs CVXPY from source, so setuptools-scm can find git tags.
  Without this, the shallow clone hides all tags and setuptools-scm
  falls back to a 0.x version, which then prevents uv from resolving
  diffcp>=1.1.5 (those wheels require cvxpy>=1.6.3) and downgrades
  to a binary-incompatible diffcp 1.1.4.
- Add fallback_version = "0.0.0" so non-git source builds (GitHub
  tarball downloads, which aren't proper sdists) produce a working
  version instead of erroring out.
- Fix PROCEDURES.md to reference the current scheme name
  semver-pep440-release-branch (matches pyproject.toml).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1.1.4 ships a pybind11 M_operator binding that is incompatible with
current scipy/numpy and breaks test_optional_solvers at runtime.
1.1.5 is also the first release that declares cvxpy>=1.6.3 as a runtime
dep, which gives uv a second line of defense if setuptools-scm ever
falls back to a 0.x version.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Real release tags live on release/* branches and are not ancestors of
master, so `git describe` falls back to an ancient tag and master computes
a wrong version (e.g. 1.2.0.devN instead of 1.10.0.devN).

Match `dummy-v*` anchor tags in describe_command so a tag placed on the
master branch point makes the most recent minor release reachable.

Restrict build.yml tag builds (and the DEPLOY gate) to `v*` so dummy-v*
anchor tags cannot trigger a PyPI deploy.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
diffcp 1.1.5-1.1.8 declare a `cvxpy` runtime dependency, creating a
circular dependency that uv cannot resolve against the cvxpy workspace
project. diffcp 1.1.9 drops that dependency.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@PTNobel
PTNobel force-pushed the prototype/setuptools-scm branch from a536afd to 4ad56cd Compare June 8, 2026 19:52

@rileyjmurray rileyjmurray left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM!

(G = gorgeous.)

@PTNobel
PTNobel merged commit c048719 into master Jun 18, 2026
55 checks passed
@PTNobel
PTNobel deleted the prototype/setuptools-scm branch June 18, 2026 17:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants