-
-
Notifications
You must be signed in to change notification settings - Fork 529
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[FIX] TOML set_env
from file
#3478
base: main
Are you sure you want to change the base?
Conversation
|
||
def replacer(raw_: str, args_: ConfigLoadArgs) -> str: | ||
if conf is None: | ||
replaced = raw_ # no replacement supported in the core section |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TBH this condition I've just taken from the INI correspondant... Pls double-check if it makes sense in TOML parsing context. Thanks.
ab08b87
to
30ad161
Compare
10c8e9c
to
7dc1f78
Compare
set_env
from fileset_env
from file
("conf_type", "config"), | ||
[ | ||
("ini", "[testenv]\npackage=skip\nset_env=file|A{/}a.txt\nchange_dir=C"), | ||
("toml", '[env_run_base]\npackage="skip"\nset_env="file|A{/}a.txt"\nchange_dir="C"'), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would make more sense that this to be a dictionary key rather than we just unroll a string. Something like 'set_env = [ { file= "a.txt"}] `.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just to make sure that I'm following correctly. Could you pls confirm that the following is what you suggest?
INI:
The current syntax supported for tox.ini
for set_env
:
[testenv]
set_env=file|<path>
TOML:
Moving away from the file|
syntax introduced for tox.ini
, benefitting from embedded data structures instead such as:
[env_run_base]
set_env=[{file=<path>}]
While this would raise an ERROR in TOML:
[env_run_base]
set_env="file|<path>"
Is this the direction you would like to take? Not to support file|
terminology when TOML configuration is used?
(Sorry, I understood that a PR was welcome for the issue as raised -- which my attempt was aiming to respond. Of course, I'm glad to modify the code alongside a different design, if preferred. I agree that the above solution is more elegant.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, with the TOML format we generally are trying to move away from embedding information into strings, and instead use the rich type system and structure of the TOML language instead.
You still plan to tackle this? |
This code change is addressing #3474, making sure that TOML config has the same support to apply
set_env
from file, as INI configuration does.