Skip to content
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

Add a just-the-tag version scheme #1002

Closed
thejcannon opened this issue Jan 18, 2024 · 12 comments · Fixed by #1005
Closed

Add a just-the-tag version scheme #1002

thejcannon opened this issue Jan 18, 2024 · 12 comments · Fixed by #1005

Comments

@thejcannon
Copy link
Contributor

Howdy! 👋

Love the tool/library. Hoping to use it for https://github.com/pantsbuild/pants versioning.

One thing is that we use .devN versions for the development series, so (most) of the version schemes that exist are incompatible if there's any kind of distance from the tag (the only ones that don't assert either create an illegal version like .devN.postM or blast the dev number).

Really, the distance is nice to know, but also isn't crucial to us, so meh.

@thejcannon
Copy link
Contributor Author

Alternatively, what if version_scheme behavior defaulted to version.format_with(<version_scheme>) if it doesn't match an entrypoint?

E.g. The fallback implementation is to just see if the value is itself a format string.

@thejcannon
Copy link
Contributor Author

(FYI I'd love to PR this, just let me know which side of the fence you find yourself leaning to 😄 )

@RonnyPfannschmidt
Copy link
Contributor

I need more input on the use case

Currently custom dev releases are intentionally not supported to avoid tricky mess while still ensuring one valid version per commit

@thejcannon
Copy link
Contributor Author

(Thanks for the speedy response)

Our very specific use-case is that we're mostly just interested in:

  1. Getting the version from the tag, so we don't have to "check in" the version with each release
  2. Knowing if the user is running some kind on unreleased version

Otherwise, knowing the "distance" is nice-to-have, but ultimately doesn't help us much. The existence of the commit SHA will tell us:

  • if the user is running the code at some "known" commit (e.g. that sha exists on origin). In this case, I can calculate the distance if I cared (although if I know the SHA I don't really care about the distance)
  • otherwise, they're running on some commit we don't know about. The distance doesn't tell us anything since we have no clue where their branch starts branching from a "known" commit. They could have 1000 commits locally that just fix typos or add newlines.

@RonnyPfannschmidt
Copy link
Contributor

The distance is to ensure the valid version has a non build tag part that is reasonably unique per checkout/commit, this is a help/indicator for both developers and ci

This also helps if distance is suddenly Orders of magnitude different from what's sensible

@thejcannon
Copy link
Contributor Author

I don't follow, exactly. Wouldn't the SHA as part of the local scheme be good enough for uniqueness? Or are you suggesting that information being encoded in the non-local part is a requirement? At some point, given PEP 440, some information is going to be lost (since I don't think switching from .dev releases is an option). There just simply isn't a way to encode this much information in a "sane" way (if there was another suffix we could use after .dev we'd use that, but there isn't 😞 )

Either way, even if it does have very good use-cases shouldn't I, the user, ultimately get to decide how I want these situations to be handled?

@thejcannon
Copy link
Contributor Author

(Maybe it's worth mentioning. We publish .dev releases)

@RonnyPfannschmidt
Copy link
Contributor

It's important to keep some balance between flexibility and the support/maintenance burden it triggers

Letting users do everything they want is a sure fail

It's important to negotiate a sane boundary

The version scheme you proposed has potential fallout in a number of internal features that now would need a change/Bugfixes

@thejcannon
Copy link
Contributor Author

The version scheme you proposed has potential fallout in a number of internal features that now would need a change/Bugfixes

Can you help me understand? I'd love to find a middle ground here, since right now our choices are either of the "-semver" schemes, and those end up with misleading versions.

@RonnyPfannschmidt
Copy link
Contributor

I do agree however that support for chosen dev releases is a worthwhile feature to add

@thejcannon
Copy link
Contributor Author

Let's go back to the top, then. Would you support a "just-tag" version scheme?

Obviously it's opt-in so users can self-select to use it. And I'd be surprised if simply using the tag broke any downstream code (seeing as how that's the behavior when distance is 0)

@RonnyPfannschmidt
Copy link
Contributor

That should be a good start

Its also a chance to revise the way local schemes work

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 a pull request may close this issue.

2 participants