Skip to content

fix: simplify version regex and fix rc tag handling#2296

Merged
mcm001 merged 1 commit intoPhotonVision:mainfrom
auscompgeek:fix/version-regex
Jan 13, 2026
Merged

fix: simplify version regex and fix rc tag handling#2296
mcm001 merged 1 commit intoPhotonVision:mainfrom
auscompgeek:fix/version-regex

Conversation

@auscompgeek
Copy link
Copy Markdown
Contributor

Description

The hand-rolled version generation was ignoring RC tags. When removing the RC tag filter, it broke:

$ python setup.py sdist
using dev release 2026.1.1postrc
Building version 2026.1.1postrc
Traceback (most recent call last):
  [snip]
  File "/usr/lib/python3.13/site-packages/setuptools/dist.py", line 294, in __init__
    self.metadata.version = self._normalize_version(self.metadata.version)
                            ~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.13/site-packages/setuptools/dist.py", line 330, in _normalize_version
    normalized = str(Version(version))
                     ~~~~~~~^^^^^^^^^
  File "/usr/lib/python3.13/site-packages/packaging/version.py", line 202, in __init__
    raise InvalidVersion(f"Invalid version: {version!r}")
packaging.version.InvalidVersion: Invalid version: '2026.1.1postrc'

This fixes that, and simplifies the regex slightly so it's clearer what on earth is happening. Some surrounding code to handle PEP 440 versioning is also cleaned up to squash a warning we get otherwise for RCs:

/usr/lib/python3.13/site-packages/setuptools/dist.py:294: InformationOnly: Normalizing '2026.1.1.rc.2' to '2026.1.1rc2'

Amp-Thread-ID: https://ampcode.com/threads/T-019bb77f-d3b6-7618-b511-4109f328102f

Meta

Merge checklist:

  • Pull Request title is short, imperative summary of proposed changes
  • The description documents the what and why
  • If this PR changes behavior or adds a feature, user documentation is updated
  • If this PR touches photon-serde, all messages have been regenerated and hashes have not changed unexpectedly
  • If this PR touches configuration, this is backwards compatible with settings back to v2025.3.2
  • If this PR touches pipeline settings or anything related to data exchange, the frontend typing is updated
  • If this PR addresses a bug, a regression test for it is added

- Move v prefix outside capture group in regex
- Add rc to maturity group (beta|alpha|rc)
- Fixes InvalidVersion error for rc tags

Amp-Thread-ID: https://ampcode.com/threads/T-019bb77f-d3b6-7618-b511-4109f328102f
Co-authored-by: Amp <amp@ampcode.com>
@auscompgeek auscompgeek requested a review from a team as a code owner January 13, 2026 13:51
@github-actions github-actions bot added the photonlib Things related to the PhotonVision library label Jan 13, 2026
@mcm001 mcm001 enabled auto-merge (squash) January 13, 2026 13:56
@mcm001 mcm001 merged commit 43608c5 into PhotonVision:main Jan 13, 2026
56 checks passed
@roberttuttle
Copy link
Copy Markdown

@auscompgeek ... will this fix address the current inability to load the proper latest photonlibpy via pyproject.toml in robot projects (in the next few days or next release here)? (or should I open up a separate new issue about not being able to install anything beyond "photonlibpy==2026.0.1-beta" (which still was tied to 2025 of course).

@auscompgeek
Copy link
Copy Markdown
Contributor Author

This PR only does what it says on the tin.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

photonlib Things related to the PhotonVision library

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants