[feature request] Exclude function (kw)args from synopsis, arguments and flags in help output
还没有人认领这个 Issue。
评估
调研方向
该 issue 未指定文件、测试或入口点。首先定位构建帮助概要、参数和标志的代码,然后比较所提出的下划线排除、仅字面量排除以及类型/模块排除方案。完成的要求是确定一个一致认可的排除 API,并通过测试表明,被排除的关键字参数不再出现在每个帮助部分中。
由索引模型根据 Issue 内容生成。
描述
The help output lists all function (keyword) arguments in the synopsis, arguments and flags.
In my specific use case, I would like to exclude some of those arguments, because they are:
- of non-literal type, and therefore not easily provided through the means of CLI
- injected by a dependency injection decorator
The option to exclude (keyword) arguments could be done in a couple of ways:
- prefix the argument name with an underscore, e.g.
def my_function(a: bool, _complex_type: ComplexType = ComplexType()):
...
- limit args and kwargs to literal types
fire.Fire(help_include_literals_only=True)
- provide the means to exclude arguments based on module or instance type, e.g.
def my_function(a: bool, s: service.ComplexType):
...
fire.Fire(
help_exclude_arg_types=[service.ComplexType],
help_exclude_arg_modules=[service]
)
- 主要语言
- Python
- 星标
- 28.2k
- 派生
- 1.5k
- PR 合并指标
- 30 天内没有已合并 PR
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
google/python-fire 的其他 Issue
-
难度 2/5 1-3 小时 新手友好度 85/100
google/python-fire#693 ·
-
Release 0.7.2? 未关闭
难度 3/5 1-2 天 新手友好度 38/100
google/python-fire#698 ·
-
难度 3/5 1-2 天 新手友好度 58/100
google/python-fire#672 · 5 条评论 ·
-
难度 4/5 3-5 天 新手友好度 45/100
google/python-fire#665 · 2 条评论 ·
-
难度 4/5 3-5 天 新手友好度 55/100
google/python-fire#659 · 1 条评论 ·
查看 google/python-fire 的全部 Issue
相似的 Issue
-
enhancement
难度 2/5 1-3 小时 新手友好度 70/100
canonical/paas-charm#368 · 1 条评论 ·
-
难度 2/5 1-3 小时 新手友好度 75/100
-
tech debt
难度 2/5 1-3 小时 新手友好度 75/100
-
难度 1/5 1 小时以内 新手友好度 90/100
StevenBlack/hosts#3256 ·
-
难度 1/5 1 小时以内 新手友好度 90/100
qualcomm/qai-appbuilder#275 ·