Here's quick (but detailed !) update focused on recently proposed changed that affect the way we interact with yt as developers.
1) Code style (mostly f-strings)
Corentin has been doing some excellent work to enable the use of f-strings throughout the code base. This is the most readable (and performant) way to format strings in Python since version 3.6.0 and was originally defined here https://www.python.org/dev/peps/pep-0498/
flynt (https://github.com/ikamensh/flynt) is a tool that, as black or isort, changes the code in-place to automate the transition
The reasons we didn’t push for this change in YTEP-0037 were the following: a) f-strings are not recommended in logger entries flynt doesn’t have a functionality to filter those. Corentin solved this by detecting and manually updating all compromised calls to “mylog” (yt’s logger) to use the only correct string formatting syntax for such calls. This is the (merged) PR in question https://github.com/yt-project/yt/pull/2820 If you’re curious why this was necessary:
mylog.warning(“my string %s”, msg)
allows for lazy evaluations of strings, and won't compute the resulting string unless the call is actually used (depending on the current logger’s level).
b) lack of a reliable tool for linting and automated code updates - flynt didn’t have a dry-mode option until recently (thanks to Corentin’s upstream contribution https://github.com/ikamensh/flynt/pull/72) - flynt also lacked a pre-commit hook definition that would work for us as isort, black or flake8 for check (if you missed out on pre-commit hooks, they are documented here https://yt-project.org/docs/dev/developing/developing.html#pre-commit-hooks) I just solved this problem upstream (see https://github.com/ikamensh/flynt/pull/73)
2) Refactors (moving stuff around)
Matt has started an effort to relocate some of yt’s functionalities to more appropriate places in the file tree, or use more sensible coding patterns enabled by most recent version of Python (taking 3.6.0 as the earliest supported version) For instance https://github.com/yt-project/yt/pull/2823 (merged) https://github.com/yt-project/yt/pull/2828 https://github.com/yt-project/yt/pull/2829
On a related topic, I proposed we stop using the yt.units module, which is now mostly a wrapper around unyt, and enforce importing directly from unyt wherever possible. Here’s the issue for discussion, a PR where this is enforced can be found therein. https://github.com/yt-project/yt/issues/2788
note that we have a new GitHub label for this kind of contributions: “refactor” !
Stay out of trouble and enjoy the summer
Cheers ! Clément