Revisit relationship between Distribution and PathDistribution
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 5/5
- Tempo stimato
- Più di una settimana
- Idoneità per principianti
- 25/100
Direzione di ricerca
Inizia leggendo le classi Distribution e PathDistribution e i metodi indicati nell’issue: at(), metadata(), entry_points(), files(), requires(), read_text() e locate_file(). Esamina la discussione della pull request collegata per il contesto originale. Per considerare il lavoro completato, sarebbe necessario un design concordato per separare il comportamento specifico delle sottoclassi e un’implementazione che preservi le funzionalità rilevanti della distribuzione.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Should
Distributionobjects expose a method to resolve paths?
Yes, that is one solution. There is already .locate_file() which is not far off, except that its implementation in PathDistribution precisely removes the metadata directory that we need in this case.
More generally, I wonder if there is just a tad too much coupling between the Distribution and PathDistribution classes?
There is a mix of abstract and concrete methods in the Distribution base class, and several of the concrete methods seem fairly tightly bound to the PathDistribution subclass. For example, the at() static method creates and returns a PathDistribution instance outright, and the metadata(), entry_points(), files(), and requires() methods are all implemented with assumptions as to which files should be available and that the organization should resemble a dist-info or egg-info distribution.
Now, there is (AFAICS) only the one (PathDistribution) subclass of Distribution available in this project, and I don't really have enough experience with this project or its users to really imagine what other Distribution subclasses would or could exist in the wild.
Still, I would suspect that a subclass that was sufficiently different from PathDistribution to rather prefer subclassing Distribution directly, would then find itself not merely implementing the read_text() an locate_file() abstract methods, but would probably also need to _re_implement several of metadata(), entry_points(), files(), or requires() as well.
Hence, I would raise the question whether some of these methods would be better off with their concrete implementations moved into the PathDistribution subclass? (Of course leaving abstract methods behind in Distribution where that makes sense.) This would grant these concrete methods direct access to the stuff they need inside PathDistribution, instead of having to add more interfaces to Distribution for stuff that really only makes sense for PathDistribution.
Still, this is a much bigger refactoring than I set out to do, and I would not feel comfortable starting this without consulting you.
Originally posted by @jherland in https://github.com/python/importlib_metadata/pull/437#discussion_r1141220985
- Lingua principale
- Python
- Stelle
- 142
- Fork
- 97
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Guida per i contributori
Nessuna guida per i contributori indicizzata per questo repository
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di python/importlib_metadata
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
python/importlib_metadata#535 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
python/importlib_metadata#528 · 4 commenti ·
-
documentation help wanted
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
python/importlib_metadata#526 · 6 commenti ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
python/importlib_metadata#525 · 2 commenti ·
-
Difficoltà 5/5 Più di una settimana Idoneità per principianti 35/100
python/importlib_metadata#540 · 1 commento ·
Tutte le issue di python/importlib_metadata
Issue simili
-
triage/confirmed
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
agentscope-ai/agentscope#2775 ·
-
comp/desktop P3 type/bug
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 92/100
NousResearch/hermes-agent#118866 ·
-
bug
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 90/100
apache/cloudstack#14222 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100