Support entrypoint references in -m
Dieses Issue hat noch niemand übernommen.
- Vorherrschende Sprache
- Python
- Sterne
- 77.2k
- Forks
- 35.9k
- PR-Merge-Kennzahlen
- PR-Kennzahlen ausstehend
Beschreibung
Feature or enhancement
Proposal:
I'd like to adopt entry-points more at my company (we currently have top-level .py files that are often simple redirects to entry-point-style functions), but concern has been raised that there's no simple way for devs to mimic an entry-point invocation without installing their module, which is a hurdle to training. I'd like to extend -m to support entry-point syntax, i.e.
python -m importable.module:entrypoint_function [args...]
This should be roughly equivalent to adding this as a console_scripts entry-point, installing the module, and calling the entry-point from the bin dir:
- the function will be expected to look at
sys.argvto see what's been passed in - the first three elements in
argvwill be replaced with a single entry, so[args...]will be inargv[1:]
Has this already been discussed elsewhere?
No response given
Links to previous discussion of this feature:
No response
Beitragsleitfaden
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
Beginne damit, CPython's Befehlszeilenverarbeitung für -m nachzuverfolgen und sie mit dem im Vorschlag beschriebenen Verhalten von Packaging-Entry-Points und console_scripts zu vergleichen. Bestätige, wie sys.argv umgeschrieben werden sollte und was bei python -m importable.module:entrypoint_function [args...] geschieht; als erledigt gilt, dass die Syntax die Funktion mit den angegebenen Argumenten aufruft und den festgelegten argv-Vertrag beibehält.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- python
- Bereich
- cli
- Issue-Typ
- Feature
- Schwierigkeit
- 5/5
- Geschätzter Aufwand
- Über eine Woche
- Aktivitätsstatus
- Veraltet
- Klarheit
- Größtenteils klar
- Anfängerfreundlichkeit
- 35/100