ipython / ipython/traitlets

using traitlets.config.get_config() in python config file breaks load_config_file

未关闭
#379 4 条评论 1 个 reaction 已指派 0 人 在 GitHub 查看
主要语言
Python
星标
653
派生
217
平均合并
2 天 21 小时
30 天内合并 PR
2

描述

I put these lines at the top of a python config file:

from traitlets.config import get_config

c = get_config()

I did this so my editor would stop bugging me about c or get_config not being defined.

Unfortunately, this subtly broke load_config_file, because that sets up global with `get_config` and `c`, both of which I just accidentally destroyed.

I suggest that in the comments that are automatically generated when generate_config_file is used, a very explicit warning be placed to guard against this. Or perhaps there's some way to check if get_config or c has been mangled/modified accidentally

贡献指南

打开贡献指南

调研方向

Begin by tracing generate_config_file and load_config_file, focusing on how the generated Python configuration defines get_config and c. Check the generated comments and the configuration-loading behavior when those names are imported or reassigned. Done means the accidental overwrite is clearly guarded against and the affected loading behavior is covered by a regression test.

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

评估

技术栈
python
领域
tooling
Issue 类型
缺陷
难度
3/5
预计耗时
1-2 天
活跃度
停滞
描述清晰度
基本清楚
新手友好度
38/100

把新 issue 发到你的邮箱

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