Skip to content

pypi-build-default stamps NBGV's four-part AssemblyFileVersion into the PyPI version, so the package never matches its release tag #1521

Closed

Description

@ptr727

Defect

.github/actions/pypi-build-default computes the PEP 440 package version from NBGV's AssemblyFileVersion (M.N.P.B). For a version.json declaring a two-part base, NBGV fills B from the commit id rather than from anything version-shaped, so the fourth segment is a number with no ordering meaning, and the package version never matches the SemVer2 the github-release job uses as the release tag.

Constructed example, a repository declaring "version": "1.2" at git height 34 on main:

Output Value
SemVer2, the release tag 1.2.34
AssemblyFileVersion 1.2.34.51234
PyPI version the hub default stamps 1.2.34.51234
PyPI version the same build on develop stamps 1.2.34.51234.dev0

The package on PyPI is then 1.2.34.51234 while the GitHub release beside it is 1.2.34. The step's own comment says the height sits in the release segment, which holds, but the segment after it is not zero and not stable across commits at equal height.

Why it has not surfaced

The fleet's one PyPI release repository carried its own build task, which derives the version from SemVer2 with the -g<sha> prerelease segment stripped and states why it avoids AssemblyFileVersion. So the hub default has not yet built a release anywhere. It surfaced while adopting build-release-task.yml there, and that adoption carries a caller build-pypi hook to keep the three-part version rather than taking the default.

A related interface gap

The build-pypi hook receives branch, smoke, assembly-file-version, and project-dir, but not semver2, which the dotnet-publish and build-nuget hooks both receive. A caller hook wanting the release-tag version therefore has to reconstruct it by dropping the fourth segment of AssemblyFileVersion, which works only because NBGV's first three segments happen to equal SemVer2's core for a two-part base.

Possible fix

Derive the default's version from SemVer2 with any prerelease segment stripped, the shape the downstream task already used, and forward semver2 to the build-pypi hook the way the other two hooks get it. Either change alters the version any future adopter of the default publishes, so it wants deciding before a second PyPI repository adopts.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions