Skip to content

chore: Bump version to 0.3.0 and derive __version__ from package metadata - #18

Merged
shenxianpeng merged 2 commits into
mainfrom
chore/bump-version-0.3.0
Sep 1, 2026
Merged

chore: Bump version to 0.3.0 and derive __version__ from package metadata#18
shenxianpeng merged 2 commits into
mainfrom
chore/bump-version-0.3.0

Conversation

@shenxianpeng

Copy link
Copy Markdown
Owner

Summary

Prepares the 0.3.0 release, and removes the hand-maintained version constant
that made the last release ship a wrong version string.

Two commits

1. chore: Bump version from 0.2.0 to 0.3.0

File Before After
Cargo.toml 0.2.0 0.3.0
Cargo.lock (own package entry) 0.2.0 0.3.0
python/gitoxide/__init__.py 0.1.0 0.3.0

Note the third row: __version__ was still 0.1.0. It was missed during the
0.2.0 release, so the published 0.2.0 package reports 0.1.0 at runtime.

2. chore: derive __version__ from installed package metadata

Rather than leave a constant that has to be remembered on every release,
__version__ is now read from the installed distribution metadata, which
maturin populates from the Cargo.toml version at build time:

try:
    __version__ = _version("gitoxide")
except PackageNotFoundError:  # pragma: no cover - source tree without an install
    __version__ = "0.0.0+unknown"

Cargo.toml becomes the single place a release version is written —
pyproject.toml already sources it from there. A test_version case guards
against the metadata lookup silently degrading to the sentinel value.

Verification

Built and installed into a clean venv via pip install . (the same PEP 517
path CI uses), then imported from outside the source tree:

gitoxide.__version__      = 0.3.0
包元数据 version          = 0.3.0

pytest -q16 passed. cargo metadata --locked confirms Cargo.lock
stays in sync with Cargo.toml.

Release ordering

publish.yml triggers on v* tags and builds the version from Cargo.toml,
so this must merge before the v0.3.0 tag is pushed — tagging first is
what produced the earlier mismatch.

Also corrects python/gitoxide/__init__.py, whose __version__ was still
0.1.0. It was missed during the 0.2.0 release, so the published 0.2.0
package reports 0.1.0 at runtime.
Hard-coding __version__ in python/gitoxide/__init__.py meant it had to be
bumped by hand on every release, and it silently fell out of sync: the
published 0.2.0 package reports 0.1.0 at runtime.

Read it from the installed distribution metadata instead, which maturin
populates from the Cargo.toml version at build time. Cargo.toml becomes
the single place a release version is written. A test guards against the
metadata lookup silently falling back to the sentinel value.
@shenxianpeng shenxianpeng added the chore Chores update label Sep 1, 2026
@shenxianpeng
shenxianpeng merged commit 0605a71 into main Sep 1, 2026
13 checks passed
@shenxianpeng
shenxianpeng deleted the chore/bump-version-0.3.0 branch September 1, 2026 05:29
shenxianpeng added a commit that referenced this pull request Sep 1, 2026
v0.3.0 can never be released from this repository. The tag name was
consumed by an immutable release that was published and then deleted,
and GitHub reserves such names permanently ("tag name was used by an
immutable release, published releases must have a valid tag"). Turning
the setting off does not free an already-consumed name.

0.4.0 rather than 0.3.1: main now carries the blame binding (#19), which
is a feature and warrants a minor bump, and 0.3.0 never reached PyPI —
publishing a 0.3.1 with no 0.3.0 preceding it would only confuse.

Only Cargo.toml (and the lockfile) change here. Since #18 the Python
`__version__` is read from installed package metadata, so it follows
along on its own.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

chore Chores update

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant