python / python/importlib_metadata
Using entry-point `value` for non-object references
Personne n'a encore pris cette issue.
- Langage dominant
- Python
- Étoiles
- 142
- Forks
- 97
- Métriques de merge des PR
- Aucune PR mergée en 30 j
Description
napari uses the entry-point value for non-object references, i.e. a file path to load metadata from (i.e. as module:file_path).
This pattern seemed like a good idea for certain use cases. The main idea is that only reading metadata effectively ensures that we do no costly imports until we actually need to (which may be never).
Now, I noticed that since gh-518 such (ab)use is more heavily policed, since loading will fail immediately and not just when EntryPoint.load() is actually called.
So I suppose I have to comments/questions:
- The idea of (ab)using the entry-point for a metadata file seems neat to me. Would it be OK to accept it as use (even if not common or advertised) or is there a reason against it?
- Raising an error at
EntryPointconstruction itself fails already atimportlib_metadata.entry_points(group="my_group"), which means that a bad entry-point cannot be skipped (unlike if it fails forEntryPoint.load()which may be guarded with a try/except).
EDIT: I just noticed thatgroup=seems to be applied afterEntryPointcreation. So a single bad entry-point will break any project loading entry-points.
Neither of these are big issues, in practice a filename usually conforms (or can be made to conform) to a Python object reference, so there is nothing stopping us from just keeping to use it. But it seemed like a good thing to check in, if just for awareness that this pattern exists in the wild.
Guide de contribution
Aucun guide de contribution indexé pour ce dépôt
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Piste de recherche
Commencez par lire la construction de EntryPoint et le comportement de entry_points(group=...) décrits dans l’issue, puis examinez les modifications de gh-518. Déterminez si les valeurs de points d’entrée qui ne sont pas des objets doivent être acceptées et si les entrées invalides peuvent être ignorées lors de la sélection du groupe ; le travail est terminé lorsqu’une décision documentée et le comportement ou les tests correspondants sont disponibles.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Évaluation
- Stack technique
- python
- Domaine
- tooling
- Type d'issue
- Fonctionnalité
- Difficulté
- 5/5
- Temps estimé
- Plus d'une semaine
- Activité
- À l'abandon
- Clarté
- À clarifier
- Accessibilité débutants
- 25/100