Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
111 commits
Select commit Hold shift + click to select a range
30f0059
drop pydantic v1 imports
IAlibay Jul 15, 2025
c314f75
drop v1 import from models
IAlibay Jul 16, 2025
65f15f0
drop some v1 things
IAlibay Jul 16, 2025
36c8366
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jul 16, 2025
9d9d521
pin pydantic version
atravitz Jul 16, 2025
16006cf
adding type hint for nonbonded_method
atravitz Jul 16, 2025
9dde3ab
bump to autodoc_pydantic 2.0
atravitz Jul 16, 2025
5a03216
remove autodoc_pydantic from base env
atravitz Jul 16, 2025
8b7ec9c
Update gufe/settings/models.py
atravitz Jul 16, 2025
403a862
notes
atravitz Jul 21, 2025
e903f48
vendor interchange basemodel and annotations
atravitz Jul 21, 2025
48a92c4
dont need config class
atravitz Jul 21, 2025
0db3cf9
use _Quantity
atravitz Jul 21, 2025
824ca3a
temporary None workaround
atravitz Jul 21, 2025
72c7030
address pydantic v2 deprecation warnings
atravitz Jul 22, 2025
3cc7f45
addressing more pydantic v2 deprecation warnings
atravitz Jul 22, 2025
3ee2e27
addressing more pydantic v2 deprecation warnings
atravitz Jul 22, 2025
4a30210
add mode serialization to model json schema
atravitz Jul 22, 2025
27b6181
no longer vendor openff models
atravitz Jul 22, 2025
a8474fc
adding more quantity types
atravitz Jul 22, 2025
d82d361
updating nonbonded_cutoff parameter behavior
atravitz Jul 25, 2025
3210530
more strict about nonbonded cutoff methods
atravitz Jul 25, 2025
1c74c03
require units for temperature
atravitz Jul 25, 2025
19ffdb7
presure requires units
atravitz Jul 25, 2025
d2db96f
schema -> model_json_schema
atravitz Jul 25, 2025
f59972e
validator -> field_validator
atravitz Jul 25, 2025
c0e4bb9
Revert "validator -> field_validator"
atravitz Jul 25, 2025
7a56f36
add TODO
atravitz Jul 25, 2025
65e3b16
addressing deprecations
atravitz Jul 28, 2025
d413189
update schema for v2
atravitz Jul 28, 2025
4db6d6f
add TODO
atravitz Jul 28, 2025
3f5f0c5
reproduce v1 equality check
atravitz Jul 28, 2025
096b537
updating gufe token (need to doublecheck validity)
atravitz Jul 28, 2025
ea51c46
adding docs
atravitz Jul 28, 2025
6ce52fe
add nanometer quantity
atravitz Jul 28, 2025
812b45d
update todo
atravitz Jul 29, 2025
11e7b40
keep vendored code clean
atravitz Jul 29, 2025
cb5a7ac
push equality workaround to child class
atravitz Jul 29, 2025
66ec81f
make custom annotations
atravitz Jul 29, 2025
8943eb3
switch to atm quantity
atravitz Jul 29, 2025
48474de
add InstanceOf for extra validation
atravitz Jul 29, 2025
3c62f26
comment out schema regression check for now since things will change
atravitz Jul 29, 2025
08b27b6
add kelvin quantity, make public type
atravitz Jul 29, 2025
013d8f5
adding case insensitive enum
atravitz Jul 29, 2025
1e4fcb3
try using annotated literal instead of enum
atravitz Jul 29, 2025
115125f
make nonbonded method case insensitive
atravitz Jul 29, 2025
fee7e11
use annotated type for nonbonded cutoff
atravitz Jul 30, 2025
4af2a58
remove resolved todo
atravitz Jul 30, 2025
db59755
trying dynamic enum
atravitz Jul 30, 2025
519d4f0
Revert "make nonbonded method case insensitive"
atravitz Jul 30, 2025
28e11b8
revert nonbonded cutoff check due to serialization headaches
atravitz Jul 30, 2025
6d27819
remove unused import
atravitz Jul 30, 2025
9543c46
setting to make pydantic use enum values
atravitz Jul 30, 2025
ffdb1f0
resolve mypy errors
atravitz Jul 30, 2025
92abfcf
add todo
atravitz Jul 30, 2025
fad6504
comment out unused code
atravitz Jul 30, 2025
f168ca4
add case to check for non str handling in _to_lower
atravitz Jul 30, 2025
5c6f689
fix packaging
atravitz Jul 30, 2025
d77d896
fix angular quantity
atravitz Jul 30, 2025
d7766c4
bump docs python version from 3.10 to 3.12
atravitz Jul 30, 2025
498d3b9
Attributes -> Properties
atravitz Jul 30, 2025
cb53964
trying array type
atravitz Jul 30, 2025
56c93f6
Merge branch 'bump_docs_python' into drop_pydanticv1
atravitz Aug 1, 2025
10283c2
pip install autodoc_pydantic
atravitz Aug 1, 2025
5f88d43
Merge branch 'main' into drop_pydanticv1
atravitz Aug 6, 2025
5103d7d
revert env files to try to fix docs
atravitz Aug 12, 2025
70a1a9a
Revert "revert env files to try to fix docs"
atravitz Aug 12, 2025
949c723
uncomment some test cases
atravitz Aug 12, 2025
4bf3cc3
add openff-toolkit to docs env
atravitz Aug 13, 2025
cbe1e39
turn off some autodoc pydantic things for now
atravitz Aug 13, 2025
577791c
Update gufe/settings/models.py
atravitz Aug 13, 2025
9c3d55f
update autodoc pydantic settings
atravitz Aug 13, 2025
1886ee8
Merge branch 'drop_pydanticv1' of github.com:OpenFreeEnergy/gufe into…
atravitz Aug 13, 2025
9037249
simplify into PydanticQuantity
atravitz Aug 14, 2025
44f8f13
comment out what's unneeded
atravitz Aug 14, 2025
ec26064
array quantity
atravitz Aug 14, 2025
5c0e46d
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Aug 14, 2025
298c957
adding helper function
atravitz Aug 14, 2025
30d41c2
Merge branch 'drop_pydanticv1' of github.com:OpenFreeEnergy/gufe into…
atravitz Aug 14, 2025
60f3a2c
move some specific classes to openfe
atravitz Aug 14, 2025
1a7faf7
format
atravitz Aug 14, 2025
ae10254
add back picosecond
atravitz Aug 14, 2025
de2ae54
tests pass, but i don't trust it
atravitz Aug 15, 2025
be261c2
add dict schema
atravitz Aug 15, 2025
bdf4fbc
float schema for backwards compatiblity
atravitz Aug 15, 2025
36f98e8
everybody is a typealias
atravitz Aug 15, 2025
e400fe2
wrap into nicer function
atravitz Aug 15, 2025
228df16
Merge branch 'main' into drop_pydanticv1
atravitz Aug 18, 2025
6be5f72
update news items
atravitz Aug 18, 2025
29d638a
ArrayQuantity -> GufeArrayQuantity
atravitz Aug 20, 2025
c18c9b0
remove unused code
atravitz Aug 20, 2025
5fe9d25
Apply suggestions from code review
atravitz Aug 20, 2025
c7c6bc6
remove unneeded TODO
atravitz Aug 20, 2025
997e22d
Merge branch 'drop_pydanticv1' of github.com:OpenFreeEnergy/gufe into…
atravitz Aug 20, 2025
96a4cbf
remove straggling comments
atravitz Aug 20, 2025
6e92221
add annotated type docstring
atravitz Aug 20, 2025
af0e399
updating config
atravitz Aug 20, 2025
16803d1
update docstrings
atravitz Aug 20, 2025
a6e7071
format
atravitz Aug 20, 2025
b8308b4
remove unused comment
atravitz Aug 21, 2025
51cf535
define redox potential units as mV
atravitz Aug 21, 2025
977f91f
add note about default params not getting captured by validator
atravitz Aug 21, 2025
b89bbc1
use a plain serializer for a bettter chance at getting default serial…
atravitz Aug 21, 2025
b568923
defined nonbonded_cutoff as field
atravitz Aug 21, 2025
90143aa
test validation schema
atravitz Aug 21, 2025
108e153
define all parameters as fields so that descriptions get included in …
atravitz Aug 21, 2025
fe0231a
don't import toolkit when building docs
atravitz Aug 21, 2025
278219f
back to using vendored serialization until we move to annotated
atravitz Aug 21, 2025
dd3bc61
Revert "define all parameters as fields so that descriptions get incl…
atravitz Aug 21, 2025
0193c08
expose BoxQuantity
atravitz Aug 21, 2025
088e875
copying over templates from openfe-sphinx-theme
atravitz Aug 21, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions docs/_templates/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# `templates` directory

This directory is appended to the `templates_path` Sphinx config variable in `conf.py`. Jinja templates in this directory are available to Sphinx. This is used to provide an Autosummary template that supports an automatic API reference.

Note that templates used for the *theme itself* are not placed in this directory!
15 changes: 15 additions & 0 deletions docs/_templates/autosummary/base.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{% block title -%}

{{ ("``" ~ objname ~ "``") | underline}}

{%- endblock %}
{% block base %}

.. currentmodule:: {{ module }}

.. auto{{ objtype }}:: {{ objname }}
{% if objtype in ["attribute", "data"] -%}
:no-value:
{%- endif %}

{%- endblock %}
65 changes: 65 additions & 0 deletions docs/_templates/autosummary/class.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
{% block title -%}

.. raw:: html

<div style="display: None;">

{{ ("``" ~ objname ~ "``") | underline('=')}}

.. raw:: html

</div>

{%- endblock %}
{% block base %}

.. currentmodule:: {{ module }}

.. autoclass:: {{ objname }}
:members:
:member-order: alphabetical {# For consistency with Autosummary #}
{% if show_inherited_members %}:inherited-members:
{% endif %}{% if show_undoc_members %}:undoc-members:
{% endif %}{% if show_inheritance %}:show-inheritance:
{% endif %}

{% block methods %}

{%- set doc_methods = [] -%}
{%- for item in methods -%}
{%- if item not in ["__new__", "__init__"] and (show_inherited_members or item not in inherited_members) -%}
{%- set _ = doc_methods.append(item) -%}
{%- endif -%}
{%- endfor %}

{% if doc_methods %}
.. rubric:: {{ _('Methods') }}

.. autosummary::
:nosignatures:
{% for item in doc_methods %}
~{{ name }}.{{ item }}
{%- endfor %}
{% endif %}
{% endblock %}

{% block attributes %}

{%- set doc_attributes = [] -%}
{%- for item in attributes -%}
{%- if show_inherited_members or item not in inherited_members -%}
{%- set _ = doc_attributes.append(item) -%}
{%- endif -%}
{%- endfor %}

{% if doc_attributes %}
.. rubric:: {{ _('Attributes') }}

.. autosummary::
:nosignatures:
{% for item in doc_attributes %}
~{{ name }}.{{ item }}
{%- endfor %}
{% endif %}
{% endblock %}
{% endblock %}
106 changes: 106 additions & 0 deletions docs/_templates/autosummary/module.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
{% block title -%}

{{ ("``" ~ objname ~ "``") | underline('=')}}

{%- endblock %}
{% block base %}

.. automodule:: {{ fullname }}
:no-members:
:no-inherited-members:
:no-special-members:

{% block modules %}

{%- set included_modules = [] -%}
{%- for item in modules -%}
{%- if item not in exclude_modules -%}
{%- set _ = included_modules.append(item) -%}
{%- endif -%}
{%- endfor -%}

{% if included_modules %}
.. rubric:: Modules

.. autosummary::
:caption: Modules
:toctree:
:recursive:
{% for item in included_modules %}
~{{ item }}
{%- endfor %}

{% endif %}
{% endblock %}

{% block attributes %}
{% if attributes %}
.. rubric:: {{ _('Module Attributes') }}

.. autosummary::
:caption: Attributes
:toctree:
:nosignatures:
{% for item in attributes %}
{{ item }}
{%- endfor %}
{% endif %}
{%- endblock -%}

{% block functions %}
{% if functions %}
.. rubric:: {{ _('Functions') }}

.. autosummary::
:caption: Functions
:toctree:
:nosignatures:
{% for item in functions %}
{{ item }}
{%- endfor %}
{% endif %}
{% endblock %}

{% block classes %}

{%- set types = [] -%}
{%- for item in members -%}
{%- if not item.startswith('_') and not (
item in functions
or item in attributes
or item in exceptions
or fullname ~ "." ~ item in modules
or item in methods
) -%}
{%- set _ = types.append(item) -%}
{%- endif -%}
{%- endfor %}

{% if types %}
.. rubric:: {{ _('Classes') }}

.. autosummary::
:caption: Classes
:toctree:
:nosignatures:
{% for item in types %}
{{ item }}
{%- endfor %}
{% endif %}
{% endblock %}

{% block exceptions %}
{% if exceptions %}
.. rubric:: {{ _('Exceptions') }}

.. autosummary::
:caption: Exceptions
:toctree:
:nosignatures:
{% for item in exceptions %}
{{ item }}
{%- endfor %}
{% endif %}
{% endblock %}

{% endblock %}
12 changes: 6 additions & 6 deletions docs/concepts/tokenizables.rst
Original file line number Diff line number Diff line change
Expand Up @@ -238,9 +238,9 @@ Any nested ``GufeTokenizable``\s are left as-is.
ChemicalSystem(name=phenol-solvent, components={'ligand': SmallMoleculeComponent(name=phenol), 'solvent': SolventComponent(name=O, K+, Cl-)})
],
'edges': [
Transformation(stateA=ChemicalSystem(name=benzene-solvent, components={'ligand': SmallMoleculeComponent(name=benzene), 'solvent': SolventComponent(name=O, K+, Cl-)}), stateB=ChemicalSystem(name=toluene-solvent, components={'ligand': SmallMoleculeComponent(name=toluene), 'solvent': SolventComponent(name=O, K+, Cl-)}), protocol=<Protocol-d01baed9cf2500c393bd6ddb35ee38aa>, name=None),
Transformation(stateA=ChemicalSystem(name=benzene-solvent, components={'ligand': SmallMoleculeComponent(name=benzene), 'solvent': SolventComponent(name=O, K+, Cl-)}), stateB=ChemicalSystem(name=styrene-solvent, components={'ligand': SmallMoleculeComponent(name=styrene), 'solvent': SolventComponent(name=O, K+, Cl-)}), protocol=<Protocol-d01baed9cf2500c393bd6ddb35ee38aa>, name=None),
Transformation(stateA=ChemicalSystem(name=benzene-solvent, components={'ligand': SmallMoleculeComponent(name=benzene), 'solvent': SolventComponent(name=O, K+, Cl-)}), stateB=ChemicalSystem(name=phenol-solvent, components={'ligand': SmallMoleculeComponent(name=phenol), 'solvent': SolventComponent(name=O, K+, Cl-)}), protocol=<Protocol-d01baed9cf2500c393bd6ddb35ee38aa>, name=None)
Transformation(stateA=ChemicalSystem(name=benzene-solvent, components={'ligand': SmallMoleculeComponent(name=benzene), 'solvent': SolventComponent(name=O, K+, Cl-)}), stateB=ChemicalSystem(name=toluene-solvent, components={'ligand': SmallMoleculeComponent(name=toluene), 'solvent': SolventComponent(name=O, K+, Cl-)}), protocol=<Protocol-489fb1395a32c5183bcc1d43fa521960>, name=None),
Transformation(stateA=ChemicalSystem(name=benzene-solvent, components={'ligand': SmallMoleculeComponent(name=benzene), 'solvent': SolventComponent(name=O, K+, Cl-)}), stateB=ChemicalSystem(name=styrene-solvent, components={'ligand': SmallMoleculeComponent(name=styrene), 'solvent': SolventComponent(name=O, K+, Cl-)}), protocol=<Protocol-489fb1395a32c5183bcc1d43fa521960>, name=None),
Transformation(stateA=ChemicalSystem(name=benzene-solvent, components={'ligand': SmallMoleculeComponent(name=benzene), 'solvent': SolventComponent(name=O, K+, Cl-)}), stateB=ChemicalSystem(name=phenol-solvent, components={'ligand': SmallMoleculeComponent(name=phenol), 'solvent': SolventComponent(name=O, K+, Cl-)}), protocol=<Protocol-489fb1395a32c5183bcc1d43fa521960>, name=None)
],
'name': None,
'__qualname__': 'AlchemicalNetwork',
Expand Down Expand Up @@ -310,7 +310,7 @@ To show the structure of a keyed chain, below we have redacted all information e
('SmallMoleculeComponent-3b51f5f92521c712049da092ab061930', {...}),
('SmallMoleculeComponent-ec3c7a92771f8872dab1a9fc4911c795', {...}),
('SmallMoleculeComponent-8225dfb11f2e8157a3fcdcd673d3d40e', {...}),
('Protocol-d01baed9cf2500c393bd6ddb35ee38aa', {...}),
('Protocol-489fb1395a32c5183bcc1d43fa521960', {...}),
('ChemicalSystem-ba83a53f18700b3738680da051ff35f3', {
'components': {
'ligand': {':gufe-key:': 'SmallMoleculeComponent-3b51f5f92521c712049da092ab061930'},
Expand All @@ -332,12 +332,12 @@ To show the structure of a keyed chain, below we have redacted all information e
('Transformation-e8d1ccf53116e210d1ccbc3870007271', {
'stateA': {':gufe-key:': 'ChemicalSystem-3c648332ff8dccc03a1e1a3d44bc9755'},
'stateB': {':gufe-key:': 'ChemicalSystem-ba83a53f18700b3738680da051ff35f3'},
'protocol': {':gufe-key:': 'DummyProtocol-d01baed9cf2500c393bd6ddb35ee38aa'},
'protocol': {':gufe-key:': 'DummyProtocol-489fb1395a32c5183bcc1d43fa521960'},
...}),
('Transformation-4d0f802817071c8d14b37efd35187318', {
'stateA': {':gufe-key:': 'ChemicalSystem-3c648332ff8dccc03a1e1a3d44bc9755'},
'stateB': {':gufe-key:': 'ChemicalSystem-655f4d0008a537fe811b11a2dc4a029e'},
'protocol': {':gufe-key:': 'DummyProtocol-d01baed9cf2500c393bd6ddb35ee38aa'},
'protocol': {':gufe-key:': 'DummyProtocol-489fb1395a32c5183bcc1d43fa521960'},
...}),
('AlchemicalNetwork-f8bfd63bc848672aa52b081b4d68fadf', {
'nodes': [
Expand Down
4 changes: 3 additions & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,9 @@
"undoc-members": True,
}

# TODO: temporary workaround to get docs to build I figure out why only OpenMMSystemGeneratorFFSettings GufeQuantities won't serialize.
autodoc_pydantic_model_show_json_error_strategy = "coerce"

autosummary_generate = True

intersphinx_mapping = {
Expand All @@ -68,7 +71,6 @@
"rdkit",
]


# -- Options for HTML output -------------------------------------------------

# The theme to use for HTML and HTML Help pages. See the documentation for
Expand Down
2 changes: 1 addition & 1 deletion docs/environment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ channels:
- https://conda.anaconda.org/jaimergp/label/unsupported-cudatoolkit-shim
- https://conda.anaconda.org/conda-forge
dependencies:
- autodoc-pydantic
- autodoc-pydantic >=2.0
- openff-units
- python=3.12
- sphinx
Expand Down
4 changes: 2 additions & 2 deletions environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ dependencies:
- pint
- pip
- pooch
- pydantic >1
- pydantic >=2.0
- pytest
- pytest-cov
- pytest-xdist
Expand All @@ -25,4 +25,4 @@ dependencies:
- sphinx-jsonschema==1.15
- sphinx <7.1.2
- pip:
- autodoc_pydantic<2.0.0
- autodoc_pydantic>=2.0.0
14 changes: 7 additions & 7 deletions gufe/components/proteincomponent.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@


# ions and charges pulled from amber:
# https://github.com/Amber-MD/AmberClassic/blob/42e88bf9a2214ba008140280713a430f3ecd4a90/dat/leap/lib/atomic_ions.lib#L1C1-L68C6
ions_dict = {
# see `amber list <https://github.com/Amber-MD/AmberClassic/blob/42e88bf9a2214ba008140280713a430f3ecd4a90/dat/leap/lib/atomic_ions.lib#L1C1-L68C6`_
_ions_dict = {
"AG": 1,
"Ag": 2,
"AL": 3,
Expand Down Expand Up @@ -268,15 +268,15 @@ def _from_openmmPDBFile(cls, openmm_PDBFile: PDBFile | PDBxFile, name: str = "")
def _get_ion_charge(ion_key):
ik = ion_key.strip() # strip b/c we never want whitespace

if charge := ions_dict.get(ik):
if charge := _ions_dict.get(ik):
return charge
elif charge := ions_dict.get(ik.upper()):
elif charge := _ions_dict.get(ik.upper()):
return charge
elif charge := ions_dict.get(ik.strip(digits)):
elif charge := _ions_dict.get(ik.strip(digits)):
return charge
elif charge := ions_dict.get(ik.strip(digits).upper()):
elif charge := _ions_dict.get(ik.strip(digits).upper()):
return charge
elif charge := ions_dict.get(ik.strip(digits).title()):
elif charge := _ions_dict.get(ik.strip(digits).title()):
return charge

# raise an error if we can't find a match
Expand Down
2 changes: 1 addition & 1 deletion gufe/serialization/json.py
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,7 @@ def is_legacy_path_dict(dct: dict) -> bool:

SETTINGS_CODEC = JSONCodec(
cls=SettingsBaseModel,
to_dict=lambda obj: {field: getattr(obj, field) for field in obj.__fields__},
to_dict=lambda obj: {field: getattr(obj, field) for field in obj.model_fields},
from_dict=default_from_dict,
is_my_dict=functools.partial(inherited_is_my_dict, cls=SettingsBaseModel),
)
Expand Down
2 changes: 1 addition & 1 deletion gufe/serialization/msgpack.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ def pack_default(obj) -> msgpack.ExtType:
return msgpack.ExtType(MPEXT.NPGENERIC, npg_payload)

case SettingsBaseModel():
settings_data = {field: getattr(obj, field) for field in obj.__fields__}
settings_data = {field: getattr(obj, field) for field in obj.model_fields}
settings_data.update({"__class__": obj.__class__.__qualname__, "__module__": obj.__class__.__module__})
settings_payload: bytes = msgpack.packb(settings_data, default=pack_default)
return msgpack.ExtType(MPEXT.SETTINGS, settings_payload)
Expand Down
Loading
Loading