-
Notifications
You must be signed in to change notification settings - Fork 279
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
Migrate config to toml #2981
Migrate config to toml #2981
Conversation
looks like a lot of the changes are just flynt running lose on documentation (which was not done already, to my surprise ?). It's nice but I maybe it's out of scope here, or am I missing something ? |
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.
I like this. One question I had, since we're in a mood to add the occasional dependency, is if there is a config library out there (that perhaps we even have a transitive dependence on) that would be a good idea to migrate to.
yt/config.py
Outdated
def get(self, section, *path, strict=True, **kwargs): | ||
config = self.values[section] | ||
|
||
# This works as follow: if we try to access |
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.
Does this leave open the opportunity to do frontend-specific config?
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.
yt/config.py
Outdated
if len(path) == 0: | ||
return config | ||
|
||
ok = False |
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.
wow this statement is a real mood, I have to say
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.
Changed it, sorry!
yt/config.py
Outdated
ytcfg.read(CURRENT_CONFIG_FILE) | ||
cwd = Path(".").absolute() | ||
while cwd.parent != cwd: | ||
cfg_file = cwd / "yt.toml" |
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.
love pathlib
yt/config.py
Outdated
if cfg_file.exists(): | ||
ytcfg.read(cfg_file) | ||
break | ||
cwd = cwd.parent |
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.
I'm looking at this and trying to figure out if it's possible to get to the root, or to get into an infinite loop, and I can't quite tell. Is it ever possible we'll see an exception for trying to get to the parent of a non-parented path?
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.
I think the code is correct, but I'll let others weigh in.
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.
I updated this bit as it was causing me headache to make sure it will work in any case.
c37e1e5
to
4b708ef
Compare
I've moved them to #2983 |
0623390
to
e980756
Compare
I could not find any library that was relying on toml, but given the size of our configuration, this may be a bit overkill. Currently, the config manager repropduces part of the ConfigParser API. |
I have a general question here: is it still relevant to store the global config file in |
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.
Still 2 files to go but here are my first comments. I'll finish this tomorrow !
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.
some more minor comments. I'll approve when we converge on the global VS local config file discussion :-)
@yt-fido test this please |
8670ee1
to
fc943de
Compare
Co-authored-by: Clément Robert <cr52@protonmail.com>
b51bf77
to
1ba0398
Compare
@munkm any chance you review this? Otherwise, I'm fine with it being merged in. |
The Jenkins failure are due to the fact Jenkins does not install the requirements listed in |
@Xarthisius Can that be fixed without your intervention? I think otherwise this may be ready to go, once the tests pass. |
Following the merging of #2981 , I need to patch this with the new deprecation utilities. Then I believe it will finally be ready for going in :) |
I'll merge this when the tests finish. |
PR Summary
PR Checklist
black --check yt/
isort . --check --diff
flake8 yt/
flynt yt/ --fail-on-change --dry-run -e yt/extern