-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
[BUG] Setuptools crashes when implementing find_distributions
in a custom Finder in python 3.8
#3319
Comments
find_distributions
in a custom Finder in python 3.8
The reported issue is not with Setuptools, except for the fact that Setuptools is using importlib_metadata 4.3+. Your description is correct. The issue is that importlib_metadata 4.3+ and as found in Python 3.10+ is expecting a _normalized_name to be present on PathDistributions. Perhaps importlib_metadata could be more lenient and provide a compatibility layer when newer versions of importlib metadata encounter distributions without a _normalized_name. That wouldn't be necessary, however, if you updated the reproducer to rely on importlib_metadata>=4.3 on Python <3.10. That would be my preference - to reduce/eliminate reliance on the implementation as found in python 3.8 and 3.9 (because it was inadequate for that and other concerns). I understand that it's awkward that setuptools has access to a newer version of importlib_metadata that you can't use. That's an unfortunate consequence of having these vendored dependencies. I created python/importlib_metadata#396 to track the broader issue within importlib_metadata, but I'd love to know more about your use case and how feasible it might be to simply depend on the more modern implementations of importlib metadata. |
Depending on importlib_metadata would be feasible through vendoring; It's a bit of a pity though because I otherwise get away with zero dependencies. I'm more concerned about how to make sure that the version I depend on matches what setuptools uses (or whatever other tool calls |
This seems to be possible to solve with #3832: > docker run --rm -it python:3.8 /bin/bash
git clone https://github.com/konstin/setuptools-reproducer /tmp/setuptools-reproducer
cd /tmp/setuptools-reproducer/
python3.8 -m venv .venv
sed -i 's~setuptools==62.2.0~setuptools @ git+https://github.com/abravalheri/setuptools@update-importlib~' requirements.txt
sed -i 's~joinpath("tqdm_folder").~~' main.py # this patch to be required (maybe some debugging that was left behind)
.venv/bin/pip install -r requirements.txt
.venv/bin/python main.py
# 4.64.0
# 20.14.1 |
Will this remain fixed as setuptools and importlib_metadata/importlib.metadata get updated and the signature of |
For this specific error, I added a regression test to If you want to ensure any other backward compatibility, I suggest opening a PR to |
oh i missed that, thanks! |
setuptools version
setuptools==62.2.0
Python version
3.8
OS
Ubuntu 20.04
Additional environment information
No response
Description
When implementing
find_distributions
on a custom Finder, setuptools crashes because it expects the returnedPathDistribution
instances to have attributes only present in its vendored importlib_metadata but not in python 3.8's importlib.metadata.See https://github.com/konstin/setuptools-reproducer:
virtualenv -p 3.8 .venv .venv/bin/pip install -r requirements.txt # pinned versions of setuptools and virtualenv .venv/bin/python main.py
Latest main is also affected
Expected behavior
setuptools accepts
importlib.metadata.PathDistribution
instances.How to Reproduce
See https://github.com/konstin/setuptools-reproducer
reproduce.sh
Output
The text was updated successfully, but these errors were encountered: