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

Remove support for LegacyVersion #2497

Closed
jaraco opened this issue Dec 21, 2020 · 2 comments · Fixed by #2822
Closed

Remove support for LegacyVersion #2497

jaraco opened this issue Dec 21, 2020 · 2 comments · Fixed by #2822

Comments

@jaraco
Copy link
Member

jaraco commented Dec 21, 2020

In #2466 and pypa/packaging#368, it's become apparent that Setuptools should get out of the business of supporting the LegacyVersion.

@yan12125
Copy link
Contributor

yan12125 commented Dec 25, 2020

I had a look into the debt/remove-legacy-version branch - the first failure (Invalid version: '51.1.0.post20201221.post-20201221') is because setuptools itself generates non-PEP440 versions. Other issues are from the package_index module, which accepts non-PEP440 versions. Seems package_index is used by easy_install only? If so, dropping LegacyVersion might be related to dropping easy_install: #917.

With some patches (https://github.com/yan12125/setuptools/commits/debt/remove-legacy-version), the number of failed tests goes down to 3: https://github.com/yan12125/setuptools/runs/1607790124. Notably, test_pbr in test_integration.py failed because there is a non-PEP 440 version of pbr https://pypi.org/project/pbr/0.5.2.5.g5b3e942/ and package_index picks it.

@yan12125
Copy link
Contributor

There is an ongoing PR on removing LegacyVersion: pypa/packaging#407

jaraco added a commit that referenced this issue Nov 14, 2021
jaraco added a commit that referenced this issue Nov 14, 2021
abuccts added a commit to microsoft/superbenchmark that referenced this issue Mar 1, 2023
Pin setuptools version to
[v65.7.0](https://setuptools.pypa.io/en/latest/history.html#v65-7-0) to
avoid breaking changes pypa/setuptools#2497 since v66.0.0, reference
pypa/setuptools#3772.
copybara-service bot pushed a commit to tensorflow/examples that referenced this issue May 16, 2023
…P 404

Please approve this CL. It will be submitted automatically, and its GitHub pull request will be marked as merged.

Imported from GitHub PR #456

Recently I tried installing this repo through pip, and it failed with the following message:

```
raise InvalidVersion(f"Invalid version: '{version}'")
pkg_resources.extern.packaging.version.InvalidVersion: Invalid version: 'b4eb09b4a3d167557d999723f7c2ed0d53a1bb7d-'
```

After some googling, I found that this is by design:

* pypa/setuptools#2497
* pypa/setuptools#3772

Apparently, `Setuptools` only supports version numbering in accordance with [PEP 404](https://peps.python.org/pep-0440/) from version 66 onwards. So I created a fork of this repo, changing the version numbering scheme so that it can be installed through pip.

The idea is essentially the same as it is currently, with only some minor modifications. Currently, the version number is simply the hash of the most recent commit, so there isn't any pattern or sequence to be worried about. PEP 404 required the version number to be in base 10, so I changed the base 16 representation of the commit hash to base 10. By keeping the commit hash, the commit can still be retrieved through the version number. I also prepended the commit's timestamp, so that the more recent commits have higher version numbering.

Copybara import of the project:

  - db7542d Change version numbering to be in accordance with PEP 440... by Eduardo <eduardoscsouza@gmail.com>
  - 94860f6 Minor changes for clarity and add explanatory comments. by Eduardo <eduardoscsouza@gmail.com>
  - f0d9155 Merge 94860f6 into b4eb0... by Eduardo Santos Carlos de Souza <eduardoscsouza@gmail.com>

PiperOrigin-RevId: 532326489
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