Skip to content

Update version pattern#2689

Closed
abdnh wants to merge 3 commits intobeeware:mainfrom
abdnh:version-pattern
Closed

Update version pattern#2689
abdnh wants to merge 3 commits intobeeware:mainfrom
abdnh:version-pattern

Conversation

@abdnh
Copy link

@abdnh abdnh commented Feb 16, 2026

The PEP 440 version regex used by Briefcase is outdated. The canonical format is now described in packaging.python.org and is provided by packaging.

Changes

  • Updated PEP440_CANONICAL_VERSION_PATTERN_RE to use packaging.version.VERSION_PATTERN.
  • Removed the test_invalid_app_version test since most strings are now valid versions according to the latest specification.

PR Checklist:

  • All new features have been tested
  • All new features have been documented
  • I have read the CONTRIBUTING.md file
  • I will abide by the code of conduct

Context

We're exploring using Briefcase for Anki and ran into an issue because Anki's calendar versioning scheme is not recognized by Briefcase:
ankitects/anki#4557

test_invalid_app_version is removed because most strings are valid with
the updated pattern.
@freakboy3742
Copy link
Member

Thanks for the PR, and the research into the underlying cause.

There's a couple of hidden issues with the "replace the regex" approach you've taken here. Most notably, the full regex accepts v1.2.3 as valid input, which will break other parts of Briefcase that expect a "clean", numbers-only version number to exist. A leading v isn't valid when generating a macOS Info.plist version number, for example.

It's also problematic to delete all the "invalid" test cases. While it's true that there are a lot of previously invalid version numbers that are now valid, there are still some invalid version numbers, and we would still need to validate those.

However - I think the better approach is to go all-in on using Version as an internal representation. That saves a bunch of effort other places where we need parts of a version number, and means we don't need to reproduce any sort of validation logic. I've implemented this approach in #2694.

@abdnh abdnh deleted the version-pattern branch February 17, 2026 01:14
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

Comments