TLDR; We recently migrated yt's configuration system from the yt-3
format to a new and more flexible format in yt-4 (the toml format, see
https://github.com/yt-project/yt/pull/2981). *This requires a manual
intervention to perform the migration (see details below).*
*What does it change for users?*
The new configuration system is documented online here:
*Performing the migration*
The change requires a one-time manual intervention on your side to
perform the migration automatically. To perform the migration, simply
type in your console
yt config migrate
This should migrate your old configuration to the new format (stored in
~/.config/yt/yt.toml) and store a backup of your old configuration file
in ~/.config/yt/ytrc.bak should any error happen. Please report any
issue you may encounter in the migration procedure so that we can fix
them before releasing officially yt-4.
If you get an error about a missing toml package, you may also have to
install the toml package manually|
| conda install -c conda-forge toml # if you are using conda
pip install toml # otherwise
The new configuration system allows you to configure yt per-folder. In
particular, if a file named yt.toml is present in your current working
folder, this file will override the global configuration. You can easily
configure yt from the command line using
yt config set yt log_level 40 --global # this will write in
yt config set yt log_level 40 --local # this will write in ./yt.toml
We have also rationalized the naming convention of configurable keys in
the configuration file: all keys now use snake case (i.e. words
separated by an underscore). For example loglevel has become log_level.
This is handled automatically by the configuration script, but bear that
in mind if you modify the configuration file. For reference, all
configurable keys can currently be found online
https://github.com/yt-project/yt/blob/main/yt/config.py#L12 and the most
important ones are documented online
What does it change for developers?
The new format should allow more flexible configuration options. In
particular, it supports nested configuration blocks and allows to find
the most specific key in the configuration file
cmap = "arbre"
cmap = "viridis"
cmap = "plasma"
In Python, you can then query the "most specific" key matching a given path:
from yt.config import ytcfg
ytcfg.get_most_specific("fields", "gas", "temperature", "cmap") == "plasma"
ytcfg.get_most_specific("fields", "gas", "density", "cmap") == "viridis"
ytcfg.get_most_specific("fields", "io", "velocity_x", "cmap") == "arbre"
This isn't used anywhere /yet/. The other breaking change compared to
the old configuration system is that ytcfg.get returns typed quantities
(as read by the toml parser) instead of strings.
Dr. Corentin Cadiou
Post Doctoral Research Assistant
Cosmoparticle Initiative Hub, desk 27
University College London (UCL)
Gower St, Bloomsbury, London WC1E 6BT
In January, Github is making it easier to change the default branch name
with a toggle on the website:
I know lots of other projects have done this (including maestro) and we
could do it ourselves, but I'd like to propose that we do this as soon as
GH has the tooling in place to handle it for us.
If anyone objects we can dig into this during a team meeting or something,
but personally this kind of seems uncontroversial and should be easy to
I recently found out about https://pre-commit.ci, and I'd like to propose we adopt this tool as
part of our CI for linting/auto-fixing.
The idea is that this automatically runs
$ pre-commit run --all-files
on each pull request and commits to the corresponding branch to auto-fix errors with
pre-commit hooks (black, isort and flynt in our case).
I'm reaching out to you because this would have small repercusions on everyone's
workflow. Let me try to give a comprehensive description of gains and costs in the following.
what it gets us
a simplification of our CI tooling, namely:
all become useless
`.github/PULL_REQUEST_TEMPLATE.yaml` will also be simplified as all linting items in `PR
Checklist` become redundant.
On top of this, new hooks could be seamlessly added in the future without increasing the
entry barrier for occasional contributors (as installing pre-commit hooks locally is and
remains an opt-in).
what it costs us
- "zero" configuration: the only requirement is `.pre-commit.yaml`, which is already part
of the repo.
- minor updates to .pre-commit-config.yaml, namely :
- bumping black's version
(reason: black's `--exclude` flag is overidden by pre-commit's `--all-files`, but more
recent versions of black have a `--force-exclude` flag that overcomes this)
this will require a new PR to adopt black's latest (minor) updates in code styling
- signing up tohttps://pre-commit.ci (free)
what this changes to your workflow
PRs will be automatically fixed by the bot, so you'll either need to occasionally run `git pull` or `git push
--force` to account for it.
Note that this can be avoided completely by installing pre-commit hooks locally which is
and will remain an opt-in, see
Let me know what you think. Take care, and happy new year !