-
Notifications
You must be signed in to change notification settings - Fork 82
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
Importing everything in utils module #698
Conversation
This should fix the problems importing the openmmtools utils in downstream packages, such as in choderalab/yank#1286 and choderalab/yank#1299 |
openmmtools/utils/__init__.py
Outdated
typename, | ||
with_timer, | ||
) | ||
from .utils import * |
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.
Do we really want to import everything into the namespace?
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 haven't skimmed through to make sure that we don't have collisions, if this is exactly how it was working, then that is fine.
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.
Good question, there's no easy way to know what packages downstream are using, my first attempt was trying NOT to import everything, and only the things that openmmtools itself was needing, but it's hard to tell what other packages are using from utils.py
so the easiest way is to import everything. I think in the future we probably want to remove the utils.py
file and just have submodules that make more sense (such as what we did with the gentle equilibration utility function)
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 haven't skimmed through to make sure that we don't have collisions, if this is exactly how it was working, then that is fine.
Yeah, it should be analogous to what was happening before the changes, such that users can still do import openmmtools.utils
(or similar)
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.
Okay then I think it is okay! If we ever do a big breaking change, we can cleanup the API but for now lets make downstream life easy
@ijpulidos looks like the tests need fixing (or change the import to be backwards compatible) |
I think you were right on doubting using the |
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.
Can you run a sort on these? Or can I?
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.
LGTM, I ran a sort on the imports
Description
Importing all members of the
utils.py
submodule.In previous changes we created a
openmm.utils
package/module with autils.py
sub module for the sake of organizing and modularizing many of the utility functions we have in openmmtools. By doing so I mistakenly only imported some of the members of the modules instead of importing all of them.Todos
Status
Changelog message