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

More robust version handling: Take 2: Taking max version as "latest" #29

Closed
thorwhalen opened this issue Jun 28, 2024 · 0 comments
Closed

Comments

@thorwhalen
Copy link
Member

thorwhalen commented Jun 28, 2024

First read More robust version handling. The current issue is a continuation of this.

The solution implemented to close #11 was to separate some concerns, cleaning things up a bit, and introducing a versions_from_different_sources which would then be validated via the validate_versions.

The idea was to get earlier failures when the different versions weren't aligned (which would cause later on harder failures to debug). And from there, the idea was to change the mechanics of how versions are created to avoid divergence in the first place. This would be the cleaner solution. We'll do that maybe, one day. See #30 for this.

But we don't have time to look into a cleaner solution, so instead we'll try to implement a solution focusing on reducing current and future failures.

The proposed solution is:

Demote validation to something softer:
Change validate_versions so we can control the action when invalid (to be able to raise, ignore, warn etc.), and then, in get_new_version, use it with a action_when_versions_not_valid=warn default:

    validate_versions(versions, action_when_not_valid=action_when_versions_not_valid)

Use the max of all the version "opinions" as the "current" (or rather "latest") version that will be bumped.

    # Take the highest version from the different sources to be the latest version
    latest_version = max(filter(None, versions.values()), key=semver.VersionInfo.parse)
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

No branches or pull requests

1 participant