Skip to content

Commit e0176c7

Browse files
committed
Update version to 2.11.12 in version.py and modify config loading logic in config.py to prioritize local configuration file over default, enhancing configuration management.
1 parent 7b16ff8 commit e0176c7

2 files changed

Lines changed: 8 additions & 4 deletions

File tree

qulab/cli/config.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
import click
88
from loguru import logger
99

10-
CONFIG_PATH = os.path.expanduser("~/.qulab.ini")
10+
DEFAULT_CONFIG_PATH = os.path.expanduser("~/.qulab.ini")
1111
ENV_PREFIX = "QULAB_"
1212

1313

@@ -36,8 +36,12 @@ def _get_config_value(option_name,
3636
config = configparser.ConfigParser()
3737
# 先加载默认配置防止段不存在
3838
config.read_dict({config_section: {}})
39-
if Path(CONFIG_PATH).exists():
40-
config.read(CONFIG_PATH)
39+
40+
config_path = Path.cwd() / "qulab.ini"
41+
if config_path.exists():
42+
config.read(config_path)
43+
elif DEFAULT_CONFIG_PATH.exists():
44+
config.read(DEFAULT_CONFIG_PATH)
4145

4246
# 从对应配置段读取
4347
if config.has_section(config_section):

qulab/version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = "2.11.11"
1+
__version__ = "2.11.12"

0 commit comments

Comments
 (0)