If the $CONFIG_PATH environment variable is set this is treated as a config file being passed via the -c option and causes and error if the $CONFIG_PATH is provided as an argument. Not exactly sure what the correct treatment is here, I don't think we just want to take the union of the two generically, but maybe carve out this special case where only one config file is provided and it's the same? Could also check the $CONFIG_PATH env variable and if present in the arguments then remove from the options prior to this ValueError? I think the later is more robust.
To Reproduce
A bit contrived:
(flepimop-env) [twillard@longleaf-login4 flepimop_sample]$ echo $CONFIG_PATH
/work/users/t/w/twillard/flepimop_sample/config_sample_2pop_inference.yml
(flepimop-env) [twillard@longleaf-login4 flepimop_sample]$ flepimop patch $CONFIG_PATH
Traceback (most recent call last):
File "/nas/longleaf/home/twillard/.conda/envs/flepimop-env/bin/flepimop", line 8, in <module>
sys.exit(cli())
^^^^^
File "/nas/longleaf/home/twillard/.conda/envs/flepimop-env/lib/python3.11/site-packages/click/core.py", line 1157, in __call__
return self.main(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/nas/longleaf/home/twillard/.conda/envs/flepimop-env/lib/python3.11/site-packages/click/core.py", line 1078, in main
rv = self.invoke(ctx)
^^^^^^^^^^^^^^^^
File "/nas/longleaf/home/twillard/.conda/envs/flepimop-env/lib/python3.11/site-packages/click/core.py", line 1688, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/nas/longleaf/home/twillard/.conda/envs/flepimop-env/lib/python3.11/site-packages/click/core.py", line 1434, in invoke
return ctx.invoke(self.callback, **ctx.params)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/nas/longleaf/home/twillard/.conda/envs/flepimop-env/lib/python3.11/site-packages/click/core.py", line 783, in invoke
return __callback(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/nas/longleaf/home/twillard/.conda/envs/flepimop-env/lib/python3.11/site-packages/click/decorators.py", line 33, in new_func
return f(get_current_context(), *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/work/users/t/w/twillard/flepiMoP/flepimop/gempyor_pkg/src/gempyor/cli.py", line 27, in patch
parse_config_files(config, ctx, **kwargs)
File "/work/users/t/w/twillard/flepiMoP/flepimop/gempyor_pkg/src/gempyor/shared_cli.py", line 303, in parse_config_files
raise ValueError(
ValueError: Exactly one config file source option must be provided; got {'config_files': (PosixPath('/work/users/t/w/twillard/flepimop_sample/config_sample_2pop_inference.yml'),), 'config_filepath': (PosixPath('/work/users/t/w/twillard/flepimop_sample/config_sample_2pop_inference.yml'),)}.
Although the same issue will appear when using gempyor.shared_cli.parse_config_files in other CLIs.
Label
bug, config, gempyor
Priority Label
medium priority
Describe the bug/issue
If the
$CONFIG_PATH
environment variable is set this is treated as a config file being passed via the-c
option and causes and error if the$CONFIG_PATH
is provided as an argument. Not exactly sure what the correct treatment is here, I don't think we just want to take the union of the two generically, but maybe carve out this special case where only one config file is provided and it's the same? Could also check the$CONFIG_PATH
env variable and if present in the arguments then remove from the options prior to thisValueError
? I think the later is more robust.To Reproduce
A bit contrived:
Although the same issue will appear when using
gempyor.shared_cli.parse_config_files
in other CLIs.Environment, if relevant
dev branch, Python 3.11.10, R version 4.3.3