Skip to content

Dynamic versioning for postrelease versions #465

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 13 commits into from
Jun 4, 2025
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion MAINTAINERS.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ We need to ensure backward compatibility and thus we need to make some changes.
5. Also implement these changes in the old `vX.py` scripts (at the moment these are `v1.py` and `v2.py`).

> **Note**: We call the unreleased eko version `v0.0`. EKO's created with unpublished versions (`0.0.0` versions) are not part of this backward compatibility system.
> They have version `0.0.0-{commit}`, and they cannot necessarily be read by newer eko versions.
> They have version `0.0.0-{commit}` or `0.0.0`, and they cannot necessarily be read by newer eko versions.

### Instructions on how to update the test assets:

Expand Down
16 changes: 3 additions & 13 deletions src/eko/io/metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,27 +73,17 @@ def load(cls, path: os.PathLike):
elif version.major == 0 and version.minor == 14:
raw = v2.update_metadata(paths, raw)
elif (
version.major == 0
and version.minor == 0
and version.micro == 0
and version.is_postrelease
and vmod.__version__
!= f"{version.base_version}-post.{version.post}+{version.local}"
version.base_version == str(version) == '0.0.0'
):
raise NotImplementedError(
"Unsupported version; use an eko from a published eko version!"
)
else:
if (
version.major == 0
and version.minor == 0
and version.micro == 0
and version.is_postrelease
and vmod.__version__
!= f"{version.base_version}-post.{version.post}+{version.local}"
version.base_version == str(version) == '0.0.0'
):
raise NotImplementedError(
"Unsupported version; use an eko from a published eko version!"
"Unsupported version; use an eko from a published eko version!"
)

# now we are ready
Expand Down
2 changes: 1 addition & 1 deletion tests/eko/io/test_struct.py
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ def test_version(self, tmp_path: pathlib.Path, eko_factory: EKOFactory):

version = parse(read_closed.metadata.version)
assert (
version.major + version.minor + version.micro >= 0
version.major + version.minor + version.micro > 0
and not version.is_postrelease
) or (
version.major == 0
Expand Down
Loading