python / python/importlib_metadata
Using entry-point `value` for non-object references
Nadie ha tomado este issue todavía.
- Lenguaje dominante
- Python
- Estrellas
- 142
- Forks
- 97
- Métricas de merge de PR
- Sin PR fusionados en 30 d
Descripción
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.
Guía de contribución
No hay ninguna guía de contribución indexada para este repositorio
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Línea de trabajo
Comienza leyendo la construcción de EntryPoint y el comportamiento de entry_points(group=...) descritos en el issue; después, inspecciona los cambios de gh-518. Determina si se deben aceptar valores de entry-point que no sean objetos y si se pueden omitir las entradas no válidas durante la selección del grupo; el trabajo estará terminado cuando haya una decisión documentada y el comportamiento o las pruebas correspondientes.
Escrito por el modelo de indexación a partir del texto del issue.
Evaluación
- Stack tecnológico
- python
- Área
- tooling
- Tipo de issue
- Nueva funcionalidad
- Dificultad
- 5/5
- Tiempo estimado
- Más de una semana
- Estado de actividad
- Estancado
- Claridad
- Necesita aclaración
- Aptitud para principiantes
- 25/100