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

RunOptions dataclass uses mutable default value #160

Open
jakirkham opened this issue Dec 9, 2023 · 3 comments
Open

RunOptions dataclass uses mutable default value #160

jakirkham opened this issue Dec 9, 2023 · 3 comments

Comments

@jakirkham
Copy link

Recently ran into this error ( conda-forge/meld-feedstock#24 (comment) ). Appears other users have seen it as well ( #133 (comment) )

ValueError: mutable default <class 'openmm.unit.quantity.Quantity'> for field pressure is not allowed: use default_factory

Looks like it traces back to this line

pressure: float = 1.0 * u.bar

Based on the Python docs, think we want to use a pattern like this. Could also wrap it in a lambda or use functools.partial to bind arguments to operator.mul. Something that gives us a no option function to use with default_factory for this field

@jlmaccal
Copy link
Contributor

jlmaccal commented Dec 9, 2023

This is already fixed on the master branch.

@jakirkham
Copy link
Author

Ah I see. Thanks Justin! 🙏

pressure: u.Quantity = field(default_factory=lambda: 1.0 * u.bar)

Is there a rough idea of when the next release might be?

@jlmaccal
Copy link
Contributor

jlmaccal commented Dec 9, 2023

Not really. I suspect we have some work to do to with the packaging scripts. We also need to move to OpenMM 8. I don't think it's too difficult, but I have very little time to work on this right now.

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

No branches or pull requests

2 participants