Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

[feature request] Exclude function (kw)args from synopsis, arguments and flags in help output

未关闭
#465 0 条评论 3 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
5/5
预计耗时
一周以上
新手友好度
30/100
Issue 类型
功能
描述清晰度
需要澄清
活跃度
停滞
技术栈
python
领域
cli

调研方向

该 issue 未指定文件、测试或入口点。首先定位构建帮助概要、参数和标志的代码,然后比较所提出的下划线排除、仅字面量排除以及类型/模块排除方案。完成的要求是确定一个一致认可的排除 API,并通过测试表明,被排除的关键字参数不再出现在每个帮助部分中。

由索引模型根据 Issue 内容生成。

描述

enhancement

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:

  1. of non-literal type, and therefore not easily provided through the means of CLI
  2. injected by a dependency injection decorator

The option to exclude (keyword) arguments could be done in a couple of ways:

  1. prefix the argument name with an underscore, e.g.
def my_function(a: bool, _complex_type: ComplexType = ComplexType()):
  ...
  1. limit args and kwargs to literal types
fire.Fire(help_include_literals_only=True)
  1. 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

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

google/python-fire 的其他 Issue

查看 google/python-fire 的全部 Issue

相似的 Issue

更多 Python Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。