pypa / pypa/packaging.python.org
Section on entrypoint extras could use clarification
Dieses Issue hat noch niemand übernommen.
- Vorherrschende Sprache
- Python
- Sterne
- 1.7k
- Forks
- 1.7k
- Ø Merge
- 3 T. 12 Std.
- Gemergte PRs (30 T.)
- 4
Beschreibung
the extras field related part of the entrypoints data model description currently states:
Using extras for an entry point is no longer recommended. Consumers should support parsing them from existing distributions, but may then ignore them. New publishing tools need not support specifying extras. The functionality of handling extras was tied to setuptools’ model of managing ‘egg’ packages, but newer tools such as pip and virtualenv use a different model.
a text-related question would thus be: what is that 'different model'.
my practical question is: how should i implement modules that contain entrypoints that are supposed to be only loaded when a certain extra (dependency) has bee installed upon installation? afaict, pkg_resources.Distribution.extras contains all defined extras from the metadata, not just the installed ones. so for now i can only think of designing a module that contains entrypoints like this:
# the example assumes a console_script was defined w/o tying it to an extra as recommended
# the requests module was only installed when a certain extra (for dependencies) was selected
try:
import requests
except ImportError:
def my_console_script():
raise RuntimeError("Though I'm available, I can't help you due to a missing dependency.")
else:
def my_console_script():
pass # functional code here
please note that i'm not a native tongue english speaker and might miss some subtleties.
Beitragsleitfaden
Für dieses Repository ist kein Beitragsleitfaden indexiert
Erste Schritte
- Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
- Forke das Repository und arbeite in einem Branch.
- Öffne einen Pull Request, der die Issue-Nummer nennt.
Rechercherichtung
Beginnen Sie mit dem Abschnitt extras in der verlinkten Beschreibung des Datenmodells für entry points und prüfen Sie die Verweise des Issues auf setuptools, pip, virtualenv und pkg_resources.Distribution.extras. Klären Sie, was das neuere Modell bedeutet, und erläutern Sie, wie entry points behandelt werden sollten, die an optionale Abhängigkeiten gebunden sind, einschließlich der Frage, ob die aktuelle Formulierung überarbeitet werden muss.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- python
- Bereich
- documentation
- Issue-Typ
- Dokumentation
- Schwierigkeit
- 3/5
- Geschätzter Aufwand
- 1-2 Tage
- Aktivitätsstatus
- Veraltet
- Klarheit
- Größtenteils klar
- Anfängerfreundlichkeit
- 35/100