Skip to content

Commit

Permalink
Refactor PackageVersion based on PEP440Version
Browse files Browse the repository at this point in the history
This commit switches package versioning scheme from SemVer to PEP 440.

Main reasons:

1. SemVer handles pre-releases choreographically with unexpected outcome.
   e.g.: ``1.0.0-rc2 < 1.0.0-rc10`` evaluates to ``False``.

2. Libraries are evaluated against PEP 440 to be able to install WHEELs.
   They have however also been evaluated as SemVer as all repository
   providers (JSON, Github, Gitlab, Bitbucket) only know that scheme.

3. Maintaining 2 possibly conflicting versioning schemes for packages and
   libraries is not desirable.

4. A major release such as PC 4.0.0 with all its other major changes
   is a good chance to make the switch.

Notes:

1. all final SemVer versions are compatible with PEP 440.
   PEP 440 versions even handle missing minor,micro parts out of the box.

2. most commonly used SemVer pre-release tags are compatible with PEP 440,
   if possibly different sorting order is not taken into account.

   As users actively need to opt-int to `install_prereleases`, the number of
   effected users and the chance to break something seems rather moderate.

3. incompatible SemVer pre-releases are converted to PEP 440 dev-releases with
   the incompatible SemVer pre-release tag converted to a PEP 440 local-version.

   e.g.: 1.0.0-incompatible1 => 1.0.0-dev0+incompatible1

   About 6 packages on packagecontrol.io are effected, none of them breaking.

4. The `_pre_semver_pattern` is removed as no package registered on
   packagecontrol.io is using it and SemVer has been introduced about 10 years
   ago.
  • Loading branch information
deathaxe committed Aug 20, 2023
1 parent b24f3b3 commit 358a1f7
Show file tree
Hide file tree
Showing 9 changed files with 104 additions and 1,036 deletions.
2 changes: 1 addition & 1 deletion package_control/clients/bitbucket_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ def _get_releases(user_repo, tag_prefix, page_size=100):

output.append(self._make_download_info(user_repo, tag, str(version), timestamp))

num_releases += not version.prerelease
num_releases += version.is_final
if max_releases > 0 and num_releases >= max_releases:
break

Expand Down
2 changes: 1 addition & 1 deletion package_control/clients/github_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ def _get_releases(user_repo, tag_prefix=None, page_size=1000):

output.append(self._make_download_info(user_repo, tag, str(version), timestamp))

num_releases += not version.prerelease
num_releases += version.is_final
if max_releases > 0 and num_releases >= max_releases:
break

Expand Down
2 changes: 1 addition & 1 deletion package_control/clients/gitlab_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ def _get_releases(user_repo, tag_prefix=None, page_size=1000):

output.append(self._make_download_info(user_name, repo_name, tag, str(version), timestamp))

num_releases += not version.prerelease
num_releases += version.is_final
if max_releases > 0 and num_releases >= max_releases:
break

Expand Down
Loading

0 comments on commit 358a1f7

Please sign in to comment.