Better identification of broken Distribution objects
Dieses Issue hat noch niemand übernommen.
Bewertung
- Schwierigkeit
- 3/5
- Geschätzter Aufwand
- 1-2 Tage
- Anfängerfreundlichkeit
- 35/100
Rechercherichtung
Beginne damit, den Fehler mit den im Issue angegebenen Python 3.9-Docker- und tox-Befehlen zu reproduzieren, und lies dann normalized_name in importlib_metadata/compat/py39.py sowie normalize in importlib_metadata/init.py. Verfolge, wie die Distribution, die nur _path enthält, die Namensnormalisierung erreicht; die Arbeit ist abgeschlossen, wenn ein fehlender oder ungültiger Name eine nützliche Identifizierung der fehlschlagenden Distribution liefert und die relevanten Tests bestehen.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Beschreibung
Currently, I'm getting an error on Python 3.8 and 3.9 in https://github.com/pypa/build/pull/820:
docker run --rm -it python:3.9 bash
pip install tox
git clone https://github.com/pypa/build
cd build
tox -e py39 -- -k test_metadata_path_no_prepare -v
...
File "/build/.tox/py39/lib/python3.9/site-packages/importlib_metadata/compat/py39.py", line 23, in normalized_name
return Prepared.normalize(getattr(dist, "name", None) or dist.metadata['Name'])
File "/build/.tox/py39/lib/python3.9/site-packages/importlib_metadata/__init__.py", line 889, in normalize
return re.sub(r"[-_.]+", "-", name).lower().replace('-', '_')
File "/usr/local/lib/python3.9/re.py", line 210, in sub
return _compile(pattern, flags).sub(repl, string, count)
TypeError: expected string or bytes-like object
The problem is dist.__dict__={'_path': PosixPath('/build/tests/packages/test-no-prepare/test_no_prepare.egg-info')}. I think this is tripping up on tests/packages/test-no-prepare/test_no_prepare.egg-info/ and the local backend. But I don't know what updated to cause this to start happening.
Regardless of the solution, though, I think the handling here for a missing name should be better, there wasn't any useful info in the error message to tell me about the dist that was failing. I had to add print(f"{dist.__dict__=}") to see it. Or maybe the normalize name could return None, and let the failure happen elsewhere.
- Vorherrschende Sprache
- Python
- Sterne
- 142
- Forks
- 97
- PR-Merge-Kennzahlen
- Keine gemergten PRs in 30 T.
Beitragsleitfaden
Für dieses Repository ist kein Beitragsleitfaden indexiert
Erste Schritte
- Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
- Forken Sie das Repository und arbeiten Sie in einem Branch.
- Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.
Mehr aus python/importlib_metadata
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 68/100
python/importlib_metadata#535 ·
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 75/100
python/importlib_metadata#528 · 4 Kommentare ·
-
documentation help wanted
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 68/100
python/importlib_metadata#526 · 6 Kommentare ·
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 68/100
python/importlib_metadata#525 · 2 Kommentare ·
-
Schwierigkeit 5/5 Über eine Woche Anfängerfreundlichkeit 35/100
python/importlib_metadata#540 · 1 Kommentar ·
Alle Issues in python/importlib_metadata
Ähnliche Issues
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 78/100
syfoud/Simulated_Scepter#172 ·
-
A cancelled tests run makes the coverage comment workflow fail and reports it as a red check on main Offenarea: ci bug perceived difficulty: 3
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 78/100
Nitjsefnie-Harness-Commons/daedalus#921 · 1 Kommentar ·
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 86/100
EleutherAI/lm-evaluation-harness#4207 ·
-
Schwierigkeit 1/5 Unter einer Stunde Anfängerfreundlichkeit 92/100
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 78/100
ClickHouse/clickhouse-connect#1057 ·