-
Notifications
You must be signed in to change notification settings - Fork 12
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
Make setup rundir more robust #177
Conversation
I'd feel more comfortable if @angus-g had a look here. |
To be more verbose: If you install from conda, then Hence with my fix I just go back one directory if we detect that the path doesn't exist. For the second point, I've made a default placeholder for the |
Honestly I think the better approach here would be to move
That just requires an additional modification to the diff --git a/pyproject.toml b/pyproject.toml
index e427db4..beee91a 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -26,9 +26,6 @@ build-backend = "setuptools.build_meta"
[tool.setuptools]
packages = ["regional_mom6", "regional_mom6.demos.premade_run_directories"]
-[tool.setuptools.package-dir]
-"regional_mom6.demos" = "demos"
-
[tool.setuptools.package-data]
"regional_mom6.demos.premade_run_directories" = ["**/*"]
|
Let's do that then? New PR -- this one? |
Ok cool good to know! I need to learn more about these conventions rather than making it up all the time. so this way it will import correctly whether installed via conda or imported directly from a folder (as might be the case for testing) |
That's right, although it's also better for testing to do an editable install with |
even with Conda? That's the preferred install now right? |
For actually using the package, yes, but we're talking about the development case. I would suggest the best way for development is to create a conda environment for regional MOM6 (or use an existing one with all the right dependencies in place), and then use an editable install of your working copy of the repository into that environment. Then any changes within the repository are immediately available without needing any additional install, or modifications to path. |
How should we move forward for this? |
For now I'd be happy with merging this PR as is (since it does address the two issues I outline in the description, however clunkily), and making an issue pointing out that a cleaner implementation would be changing the folder location and doing whatever needs to be done on the Conda side. It's a bit of an edge case issue so I'm not going to prioritise implementing a 'clean' solution right now |
I would remove the special-casing code (i.e. the added lines 1429-1447) and perhaps make a documentation suggestion for development to use editable installs. |
5eb1c79
to
1a1ae2c
Compare
I've got a headache because I tried to change the directory structure to match @angus-g 's suggestion. However, testing failed before it even needed the premade run directories! I force reset to two different commits that previously passed the tests, and they now throw this new error. Is it possible that our tests / code aren't frozen to specific versions, and so will change over time? The current commit passed pytest 3 weeks ago. I guess the evidence of that is now hidden by my overwriting of the git history by forcing the head back in time... |
The answers are the same, but retriggering the test has pulled in numpy 2.0.0, which has updated in the meantime. The only difference is that it's being more strict about the expected types in the test. I can quickly fix that and you can rebase on there. |
I also wasn't sure how to update the
|
…f still not raise valueerror
…n't have access to a cpu layout rather than throw generic error
1a1ae2c
to
65bf6f7
Compare
a test broke? |
Yes, we still need it as package data. We essentially just stop "remapping" where the demos directory is. The only modification you need is here: #177 (comment) |
Check out this pull request on See visual diffs & provide feedback on Jupyter Notebooks. Powered by ReviewNB |
97c02a6
to
65bf6f7
Compare
>>> dz[-1] / dz[0] | ||
3.9721960481753706 | ||
np.float64(3.9721960481753706) |
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.
what is this np.float64
thing?
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's elsewhere also....
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.
That was required as part of the numpy 2.0.0 compatibility to make the doctest pass: it prints out the types of return values. I think that is useful, but given we're not going to use numpy 2.0.0 for a little bit, it'll disappear for now anyway!
After merging from main, we still have what looks like a numpy 2.0 issue stopping the test. This is really confusing me! Looking at the files changed tab, this PR only really messes around the |
It's because the docstring changes that I was experimenting with in #178 got merged in here. In the end, we needed to pin numpy < 2.0.0, so the changes to docstrings can be reverted. |
@ashjbarnes can you open an issue linking to the discussion in this PR regarding the improved method that @angus-g suggested so we don't forget about it? |
The
setup_run_directory
method has two problems:premade_run_directories
path.These issues are addressed via some simple if-statement error handing.