-
Notifications
You must be signed in to change notification settings - Fork 78
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 sure we don't install the newest toolkit by mistake #237
Conversation
Example: https://github.com/openmm/openmmforcefields/actions/runs/3065089613/jobs/4948832540
|
Is giving us an error: |
Codecov Report
@@ Coverage Diff @@
## main #237 +/- ##
==========================================
+ Coverage 76.66% 77.08% +0.41%
==========================================
Files 5 5
Lines 840 851 +11
==========================================
+ Hits 644 656 +12
+ Misses 196 195 -1
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
A bit more context:
|
@mattwthompson I'm not sure why this is failing... |
So this kinda made things better But then later I get a failure do to this bit of code:
Which we don't really need anymore, but getting rid of that gives us yet another new error:
Which comes from this bit:
I think the big tl;dr is that the code is a bit brittle in how it does checking for units, so switching to openff.units is breaking the type checking for the openmm.unit stuff, so then the code does the wrong thing to try and add units to quantities that are unit bearing. |
I expected this to be an issue and I was somewhat confused as to why it wasn't while I was working on #227. You're right in that its selection of unit registries is brittle. I assumed (mistakenly) that the conda environment pulled down the old version and the "toolkit False" builds included the old toolkit - and thereby wasn't an issue because everything was passing. But it was just pulling down the new version. This isn't the only package that's going to run into this tension, and earlier this week I thought of a possible shortcut for downstream developers doing all of the heavy lifting themselves. Could I get some feedback on this PR? Normally I wouldn't ask for something out of scope but I think that change could make this fix easier. The idea is that we can assume only one version of the toolkit is used in a module, so once we know if that's a newer or older version, you know it'll always return and expect the same registry. Something like # At the top of the file
from openff.toolkit import __version__ as toolkit_version
from openff.units import ensure_quantity
# This logic should probably replace https://github.com/openmm/openmmforcefields/blob/35496e5095101c9db5ee8a10c7237d1c52dc7f6e/openmmforcefields/generators/template_generators.py#L247
if Version(toolkit_version) >= Version("0.11.0"):
_TOOLKIT_UNITS = "openff"
else:
_TOOLKIT_UNITS = "openmm"
# later on ...
molecule.conformers[0][0,0] += ensure_quantity(0.1*unit.angstroms, _TOOLKIT_UNITS) This solution should be scalable to any number of calls later on; since the "which version am I using" check happened once, it doesn't need to happen again. Throwing around a bunch of I'd be happy to take this on myself - but I would like a green light if this approach sounds good. |
And I guess a bit of added context - I can cut release of |
💯 my fault 🙃 on that! Let me think about it a bit, I do think we want to make it easy as possible, so I think this proposal is good! |
No rush but if you have some thoughts please do comment directly on that PR - ensuring that the units package isn't a one-person show helps safeguard against me putting mistakes out into builds |
@mattwthompson consider this a green light ✔️ |
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 am "approving" this in its current state as tests are passing (though some checks are cancelled based on concurrency, I promise they're actually passing https://github.com/openmm/openmmforcefields/actions/runs/3084042229) and it's set out to do everything I think we wanted it. AFAICT
- Version 0.10.6 is actually being pulled down
- Everything seems to work with both versions of the toolkit
- Some tests that I hard-coded to only run with "new" toolkit now work with both versions
- Version-checking cruft has been kept to a minimum
@mikemhenry one tests pass I'd like a review from you (even if brief) and I think this is good to go! |
Pinging @mikemhenry to review! |
@mattwthompson I tried to approve it but I opened the PR 🤣 This looks great! I will make sure things work in perses (and some other package that uses this) to make sure we didn't break anything, then get a release on conda-forge! |
Great! Please let me know how I can help at any step |
It looks like for the CI steps where we are not using the latest openff-toolkit, we actually are still pulling in 0.11. This PR should fix that and make sure we support both 0.11 and 0.10.x