appsignal/mono

Add Python versioning scheme

Closed this issue · 2 comments

To do

  • Add version_scheme config option, with possible value: python
  • When this version scheme is selected, the prerelease naming is as follows:
    • release candidate: 1.0.0rc1
    • beta: 1.0.0b1
    • alpha: 1.0.0a1
unflxw commented

Turns out we don't have to do this work. PEP 440, which defines version identifiers, defines normalisation rules to transform "alternative" version string formats into the one defined by the PEP. Specifically:

Pre-release separators
Pre-releases should allow a ., -, or _ separator between the release segment and the pre-release segment. The normal form for this is without a separator. This allows versions such as 1.1.a1 or 1.1-a1 which would be normalized to 1.1a1.
Pre-release spelling
Pre-releases allow the additional spellings of alpha, beta, c, pre, and preview for a, b, rc, rc, and rc respectively. This allows versions such as 1.1alpha1, 1.1beta2, or 1.1c3

And hatch version, it turns out, follows these rules flawlessly:

> hatch version 1.0.0-alpha1
Old: 0.0.1
New: 1.0.0a1

imagen

Unfortunately mono doesn't parse the shorthand python naming scheme very well for prereleases. So we should at least support that.

mono publish --alpha
The following packages will be published (or not):
- python:
  Current version: v0.0.1-a.1
  Next version:    v0.0.1-alpha.1 (patch)
  Changesets:
  - Changed - patch: ./.changesets/test2.md
      test2

Description of the output above: it tries to release another alpha.1 release, because it doesn't understand the version it parsed "0.0.1a1` as an alpha release.