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

Add v5 upgrader scripts for XZInterpolation #1919

Conversation

ZedThree
Copy link
Member

Two BOUT++ v4->v5 upgrader scripts for the XZInterpolation rename PR: one for the Interpolation types, one for the input files. Plus changes to boutdata.data.BoutOptions required for the latter.

1cdf2d1 is a PEP8 formatting commit, so touches a bunch of lines in boutdata/data.py

The type upgrader optionally uses the python libclang bindings. These allow more powerful/accurate refactorings, but need libclang and the python bindings installed. Best installed through your system package manager.

I had to change BoutOptions to keep track of comments and the original case of keys so that writing to file resulted in a minimal diff. Unfortunately, it still results in some changes even if no input options need renaming:

  • nested sections are moved to be under their parent section, while preserving relative order
  • empty sections are removed
  • floating point numbers may have their format changed, although the value will not change
  • consecutive blank lines will be reduced to a single blank line
  • whitespace around equals signs will be changed to exactly one space
  • trailing whitespace will be removed

Because of this, the input file upgrader first shows the diff between the original and the "canonical" version.

I consider "canonicalising" all the input files in the repo, but there's a lot and it's mostly whitespace changes.

@ZedThree ZedThree added this to the BOUT-5.0 milestone Feb 25, 2020
@johnomotani
Copy link
Contributor

Probably it would be good to start a section in the manual listing the breaking changes in 4->5, and the updater scripts that can be used to fix code/input files. @ZedThree could you add to this PR?

@johnomotani
Copy link
Contributor

Probably it would be good to start a section in the manual listing the breaking changes in 4->5, and the updater scripts that can be used to fix code/input files. @ZedThree could you add to this PR?

Actually, might be better to add the section to the manual in #1920 as that will probably get merged first. Then we could merge next/#1920 and add the scripts from here before #1896 is merged.

@ZedThree
Copy link
Member Author

There's a section in CHANGELOG.md that lists breaking changes. I'll just copy-paste that into the manual.

Might be an idea to set up a PR template to remind us of things like this? I certainly forgot about it!

@johnomotani
Copy link
Contributor

There's a section in CHANGELOG.md that lists breaking changes. I'll just copy-paste that into the manual.

Can we just import CHANGELOG.md into the manual somehow, or link to it from an 'upgrading from v4 to v5' section? Would be easier to keep the list up to date in only one place!

@ZedThree
Copy link
Member Author

I think something like that should work. I'll do it in a separate PR though, and just note the breaking changes in CHANGELOG.md for now

@ZedThree ZedThree merged commit 87e8277 into parallel-transform-interpolation-options Feb 28, 2020
@ZedThree ZedThree deleted the pylib-options-file-preserve-comments branch February 28, 2020 16:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants