pypa / pypa/packaging.python.org
Cover PEP 420 namespace packages in "Creating and discovering plugins" guide
Nessuno ha ancora preso questa issue.
- Lingua principale
- Python
- Stelle
- 1.7k
- Fork
- 1.7k
- Merge medio
- 3g 12h
- PR unite (30g)
- 4
Descrizione
Using namespace packages is not explicit whether it talks about native PEP 420 namespace packages, or pkg-style namespace packages.
I tried to apply it for PEP 420 namespace packages and stumbled over two issues:
First, the given example doesn't wrap import myapp.plugin in try/except, but actually ModuleNotFoundError should be handled because, as a core package maintainer, you can't know how many plugins will be installed at runtime. In case of zero plugins installed, how would you guarantee a myapp.plugins namespace will exists anyways? At least setuptools won't let you install empty directories.
Second, the guide says
include the namespace-package style init.py in the namespace sub-package directory
But PEP 420 explicitly requires the absence of __init__.py files. Then, what is a namespace-package style __init__.py in the context of PEP 420? I believe @theacodes had pkg-style namespace packages in mind when adding that sentence with #296.
Could we make it either more clear the guide is not 1:1 applicable for native namespace packages, or even better, find a suggested minimal working PEP 420 example and adapt the guide accordingly?
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.
Direzione di ricerca
Inizia con la sezione “Using namespace packages” della guida Creating and discovering plugins, quindi confronta il suo esempio con PEP 420 e la guida packaging namespace-packages. Chiarisci se le istruzioni esistenti descrivono native o pkg-style namespaces e documenta un esempio minimo corretto di native namespace, se appropriato. Il lavoro è completato quando la guida non è più in conflitto con PEP 420 e spiega il caso senza plugin.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- python
- Ambito
- documentation
- Tipo di issue
- Documentazione
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Stato di attività
- Ferma
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 35/100