argv parsing in 5.x to pass a set, how to
还没有人认领这个 Issue。
评估
调研方向
首先重现所示的 Voila 命令,并检查 argparse 对 TagRemovePreprocessor.remove_cell_tags 的处理。确定在 5.x 的行为中,集合值选项是如何解析的,然后验证当命令接受该选项且不引发 TraitError 时能够成功完成;issue 未提及任何仓库文件或测试。
由索引模型根据 Issue 内容生成。
描述
After upgrading to 5.x I can no longer use the command I once was with voila - after having read through other issues and the docs I see the parsing has changed.
https://github.com/voila-dashboards/voila/issues/813
The difficulty I am running into - is I don't see how to pass a set as an option?
For example, I used to use:
voila --no-browser --ExecutePreprocessor.timeout=300 --theme=dark --TagRemovePreprocessor.remove_cell_tags='{"hide"}'
but I get the below error when opening notebooks with voila:
Jan 21 16:56:38 abc-123-086427 voila[2580]: File "/home/ubuntu/miniconda3/envs/data_analysis_lab/lib/python3.8/site-packages/traitlets/traitlets.py", line 610, in _validate
Jan 21 16:56:38 abc-123-086427 voila[2580]: value = self.validate(obj, value)
Jan 21 16:56:38 abc-123-086427 voila[2580]: File "/home/ubuntu/miniconda3/envs/data_analysis_lab/lib/python3.8/site-packages/traitlets/traitlets.py", line 2496, in validate
Jan 21 16:56:38 abc-123-086427 voila[2580]: value = super(Container, self).validate(obj, value)
Jan 21 16:56:38 abc-123-086427 voila[2580]: File "/home/ubuntu/miniconda3/envs/data_analysis_lab/lib/python3.8/site-packages/traitlets/traitlets.py", line 1845, in validate
Jan 21 16:56:38 abc-123-086427 voila[2580]: self.error(obj, value)
Jan 21 16:56:38 abc-123-086427 voila[2580]: File "/home/ubuntu/miniconda3/envs/data_analysis_lab/lib/python3.8/site-packages/traitlets/traitlets.py", line 690, in error
Jan 21 16:56:38 abc-123-086427 voila[2580]: raise TraitError(e)
Jan 21 16:56:38 abc-123-086427 voila[2580]: traitlets.traitlets.TraitError: The 'remove_cell_tags' trait of a TagRemovePreprocessor instance expected a set, not the str '{"hide"}'.
Jan 21 16:56:38 abc-123-086427 voila[2580]: ERROR:tornado.access:500 GET /voila/render/beta/BSR/Computational_Thinking/what_is_an_algorithm.ipynb (::1) 204.10ms
So for --TagRemovePreprocessor.remove_cell_tags the error is now saying it is expecting a set and not a str
I have tried many combinations such as:
voila --no-browser --ExecutePreprocessor.timeout=300 --theme=dark --TagRemovePreprocessor.remove_cell_tags=hide
Searching through cli options in argparse I don't see a way to pass a set from the cli that TagRemovePreprocessor.remove_cell_tags is expecting.
- 主要语言
- Python
- 星标
- 653
- 派生
- 217
- 平均合并
- 2 天 21 小时
- 30 天内合并 PR
- 2
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
ipython/traitlets 的其他 Issue
-
难度 1/5 1 小时以内 新手友好度 65/100
-
难度 1/5 1-3 小时 新手友好度 65/100
-
good first issue
难度 1/5 1 小时以内 新手友好度 85/100
-
documentation
难度 1/5 1 小时以内 新手友好度 65/100
-
难度 3/5 1-2 天 新手友好度 45/100
查看 ipython/traitlets 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 75/100
anthropics/skills#1811 · 1 条评论 ·
-
难度 2/5 1-3 小时 新手友好度 75/100
speaches-ai/speaches#678 ·
-
bug
难度 2/5 1-3 小时 新手友好度 75/100
datalayer/mcp-compose#42 ·
-
难度 2/5 1-3 小时 新手友好度 75/100
conda-forge/spacy-feedstock#177 ·
-
难度 2/5 1-3 小时 新手友好度 70/100
UKGovernmentBEIS/inspect_evals#2523 ·