Support entrypoint references in -m
還沒有人認領這個 Issue。
- 主要語言
- Python
- 星號
- 77.2k
- 分支
- 35.9k
- PR 合併指標
- PR 指標待擷取
描述
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
貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
研究方向
首先追蹤 CPython 對 -m 的命令列處理,並將其與提案中描述的 Packaging entry-points 和 console_scripts 行為進行比較。確認應如何重寫 sys.argv,以及執行 python -m importable.module:entrypoint_function [args...] 時會發生什麼;完成的標準是該語法使用指定的引數呼叫函式,並保留所述的 argv 約定。
由索引模型根據 Issue 內容生成。
評估
- 技術堆疊
- python
- 領域
- cli
- Issue 類型
- 功能
- 難度
- 5/5
- 預估耗時
- 一週以上
- 活躍度
- 停滯
- 描述清晰度
- 基本清楚
- 新手友好度
- 35/100