Skip to content
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

Unnecessary config file creation #3045

Closed
neutrinoceros opened this issue Jan 28, 2021 · 1 comment · Fixed by #3626
Closed

Unnecessary config file creation #3045

neutrinoceros opened this issue Jan 28, 2021 · 1 comment · Fixed by #3626
Labels
enhancement Making something better proposal Proposals for enhancements, changes, etc UX user-experience

Comments

@neutrinoceros
Copy link
Member

neutrinoceros commented Jan 28, 2021

Bug report

As discussed in #3044, we are still creating a yt config file at import time when none is already available, but this is an implementation detail inherited from before we switch to toml config files and apparently is not necessary any more (according to @cphyc).
I think there is no good reason to keep this behaviour now.

Additionally, this behaviour makes working with a local configuration file pretty clunky. For instance if one doesn't have a global file (yet), but runs

echo "[yt]\nserialize = false" > yt.toml
yt config list

they get

Yt detected a local and a global configuration file, refusing to proceed.
Local config file: /Users/robcleme/dev/yt-project/yt/yt.toml
Global config file: /Users/robcleme/.config/yt/yt.toml
Specify which one you want to use using the `--local` or the `--global` flags.
@neutrinoceros
Copy link
Member Author

neutrinoceros commented Oct 28, 2021

I attempted to fix this in #3223, but it seems that solving this problem would require spending more time decoupling the following:

  • yt/__init__.py
  • yt/utilities/configure.py
  • yt/utilities/logger.py
  • yt/config.py

and probably other modules.
In short, I think the root problem is that a bunch of code is run at import time that require the globale ytcfg object to be set, forcing us to parse configuration mid initialisation. Forcing a config file to exists is part of the current solution to make this work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Making something better proposal Proposals for enhancements, changes, etc UX user-experience
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant