-
Notifications
You must be signed in to change notification settings - Fork 280
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
Rename BoxLib frontend as AMReX #4845
Conversation
Hi! Welcome, and thanks for opening this pull request. We have some guidelines for new pull requests, and soon you'll hear back about the results of our tests and continuous integration checks. Thank you for your contribution! |
This is great! |
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.
To avoid having to maintain both path forever, I suggest deprecating the historic frontend (while of course keeping compatibility shims for now !).
This should be done using yt._maintainance.deprecation.issue_deprecation_warning
@neutrinoceros Sounds good!
Would this be the correct place for the warning? Thank you. |
I'm not sure. It should be somewhere that users are expected to access, but not internal machinery, which would be a job for the |
@neutrinoceros, thank you for your help. Because the underlying classes and functions haven't changed but have just moved, I have been thinking that the How does the following look for the desired behavior? It would be nice to issue a warning upon
Of course since the warning is issued in
I'm not sure if a single warning is desired. As can be seen I left the Note I have just pushed these updates mostly to try the full test suite build again as I failed it most recently. |
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.
The warnings seem fine (although to be nitpicky I should point out that not just "future work" should be advised to switch to drop deprecated APIs).
I would like that we try to refactor this to avoid repeating code though. Otherwise we might miss some of the repetitions when/if we need to edit the warning.
Not using Regarding CI, you'll need to edit
greping for "boxlib" in these files should give you an idea what is needed there. |
That makes sense, thanks for the help! I have added a
Then in the
|
Let's make this module explicitly private while we can then |
As for the CI tasks, I have added |
@@ -3,6 +3,28 @@ answer_tests: | |||
local_art_004: # PR 3081, 3101 | |||
- yt/frontends/art/tests/test_outputs.py:test_d9p | |||
|
|||
#copied from boxlib frontend | |||
local_amrex_012: |
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 it make sense, for the purposes of this PR, to make sure the answer tests pass with this named 'local_boxlib_012
, and same for below, and then change the name to local_amrex_012
in a follow-on PR? What do you think @Xarthisius?
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 this is the last point we're waiting for on this PR, so let me ping @Xarthisius again.
Actually for the boxlib answer tests, does it make sense to still have a |
IIRC These tests are quite expensive to run, so I don't think we should double them. However, adding a minimal test to check that the backward compatibility layer still works (and properly raises the warning) would indeed be useful. |
I just ran a small check locally and discovered that a loading a AMRex dataset triggers a /Users/clm/dev/yt-project/yt/yt/frontends/boxlib/data_structures/__init__.py:18: DeprecationWarning: The historic 'boxlib' frontend is
deprecated as it has been renamed 'amrex'. Existing and future work should instead reference the 'amrex' frontend.
Deprecated since yt TBD
boxlib_deprecation()
/Users/clm/dev/yt-project/yt/yt/frontends/amrex/data_structures.py:701: ResourceWarning: unclosed file <_io.TextIOWrapper name='/Users/clm/dev/yt-project/yt/amrex_test/plt.Cavity00010/inputs' mode='r' encoding='UTF-8'>
lines = [line.lower() for line in open(cparam_filepath).readlines()]
ResourceWarning: Enable tracemalloc to get the object allocation traceback
/Users/clm/dev/yt-project/yt/yt/frontends/amrex/data_structures.py:728: ResourceWarning: unclosed file <_io.TextIOWrapper name='/Users/clm/dev/yt-project/yt/amrex_test/plt.Cavity00010/Header' mode='r' encoding='UTF-8'>
self._parse_header_file()
ResourceWarning: Enable tracemalloc to get the object allocation traceback specifically I used the import yt
from yt.frontends.boxlib.data_structures import AMReXDataset
ds = yt.load("plt.Cavity00010") this needs to be fixed before we can merge this PR. |
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.
It looks like the ResourceWarnings are due to the warnings filter not being restored properly.
yt/frontends/boxlib/_deprecation.py
Outdated
warnings.simplefilter("always") | ||
issue_deprecation_warning( | ||
"The historic 'boxlib' frontend is \n" | ||
"deprecated as it has been renamed 'amrex'. " | ||
"Existing and future work should instead reference the 'amrex' frontend.", | ||
stacklevel=3, | ||
since="TBD", | ||
) | ||
warnings.resetwarnings() |
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.
This block needs to be put inside a with warnings.catch_warnings():
, so as to not clobber the user's warning settings (leading to the extra ResourceWarnings @neutrinoceros noticed).
issubclass(w[2].category, DeprecationWarning), | ||
] | ||
) | ||
warnings.resetwarnings() |
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.
This resetwarnings()
call should be deleted, as it may affect other tests. catch_warnings()
will restore the original warnings filter when it exits.
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.
Ok made these changes. Thanks!
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.
This one still needs updating
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.
Sorry looks like I didn't get here, just needs the warnings.resewarnings()
deleted.
Thanks to @yut23, I understand now that the problem exists on main too, so I want to clarify that it's not a blocker to this PR after all. However Eric's suggestions would still avoid making the situation worse. |
Ok great, thank you @yut23 for investigating. How should I go about reconciling this branch and the new PR #4891 ? I am happy to copy those changes over to the |
On second thought I will wait until the bug fix PR is merged and then merge those changes into the |
Or we could go with this one first and then rebase @yut23's, which I expect would be less risky and easier to follow, if that's okay with you both. |
I'm fine with rebasing mine. |
I made the requested changes to the |
yt/frontends/boxlib/_deprecation.py
Outdated
"The historic 'boxlib' frontend is \n" | ||
"deprecated as it has been renamed 'amrex'. " | ||
"Existing and future work should instead reference the 'amrex' frontend.", | ||
stacklevel=3, |
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.
Should point to the import line rather than boxlib_deprecation()
stacklevel=3, | |
stacklevel=4, |
Looks like the branch got mixed up with #4848. Also, I don't think the |
Thanks, sorry I missed that. Now I get no differences with |
can you please rebase again to fix a new conflict ? I think we should be able to merge after that, sorry for the inconvenience and thank you for your patience ! |
pyproject.toml
Outdated
@@ -116,7 +117,7 @@ http-stream = ["requests>=2.20.0"] | |||
idefix = ["yt_idefix[HDF5]>=2.3.0"] # externally packaged frontend | |||
moab = ["yt[HDF5]"] | |||
nc4-cm1 = ["yt[netCDF4]"] | |||
open-pmd = ["yt[HDF5]"] | |||
open-pmd = ["yt[openpmd_api]"] |
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.
This snuck in from my other PR and should be back to HDF5.
issubclass(w[2].category, DeprecationWarning), | ||
] | ||
) | ||
warnings.resetwarnings() |
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.
Sorry looks like I didn't get here, just needs the warnings.resewarnings()
deleted.
You can apply these changes yourself. If you're hesitant about how to get back in sync after my rebase, here's how you can do it git checkout main
git branch -D boxlib_to_amrex
git fetch origin
git checkout boxlib_to_amrex |
92b6c59
to
537c578
Compare
Ok I have fixed my two issues and done this process. I am not sure why your rebase looked like only one commit while mine shows every commit, but clearly I have a lot of git learning to do. I wish the log looked nicer but I think its good? |
You can just squash on merge for the PR and it will look clean. |
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.
Looks good to me! 😄
Hooray! Congratulations on your first merged pull request! We hope we keep seeing you around! 🎆 |
PR Summary
This PR renames the
boxlib
frontend toamrex
as BoxLib is deprecated and has been superseded by AMReX. A containerboxlib
frontend which points to the renamedamrex
frontend has been added for backwards compatibility.PR Checklist