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

Field 'is_plugin' defined on a base class was overridden by a non-annotated attribute #1098

Open
SimonBoothroyd opened this issue Nov 10, 2024 · 2 comments

Comments

@SimonBoothroyd
Copy link
Contributor

Description

Interchange 0.4.0 seems to have introduced an odd incompatibility with pydantic

Reproduction

Please include a minimally reproducing example of this bug.

import openff.interchange
import openff.toolkit


openff.interchange.Interchange.from_smirnoff(
    openff.toolkit.ForceField("openff-2.0.0.offxml"),
    openff.toolkit.Molecule.from_smiles("CCO").to_topology(),
)

Output

Please include the output, including full tracebacks of any errors, resulting from the reproduction.

Traceback (most recent call last):
  File "/xxx/scratch/repro.py", line 13, in <module>
    main()
  File "/xxx/scratch/repro.py", line 6, in main
    openff.interchange.Interchange.from_smirnoff(
  File "/xxx/envs/smee/lib/python3.12/site-packages/openff/interchange/components/interchange.py", line 148, in from_smirnoff
    from openff.interchange.smirnoff._create import _create_interchange
  File "/xxx/envs/smee/lib/python3.12/site-packages/openff/interchange/smirnoff/_create.py", line 48, in <module>
    for collection_plugin in load_smirnoff_plugins():
                             ^^^^^^^^^^^^^^^^^^^^^^^
  File "/xxx/envs/smee/lib/python3.12/site-packages/openff/interchange/plugins/__init__.py", line 21, in load_smirnoff_plugins
    plugin_handlers.append(entry_point.load())
                           ^^^^^^^^^^^^^^^^^^
  File "/xxx/envs/smee/lib/python3.12/site-packages/importlib_metadata/__init__.py", line 189, in load
    module = import_module(match.group('module'))
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/xxx/envs/smee/lib/python3.12/importlib/__init__.py", line 90, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/xxx/envs/smee/lib/python3.12/site-packages/smirnoff_plugins/collections/vsites.py", line 17, in <module>
    class _VsitePlugin(SMIRNOFFVirtualSiteCollection, abc.ABC):
  File "/xxx/envs/smee/lib/python3.12/site-packages/pydantic/_internal/_model_construction.py", line 115, in __new__
    private_attributes = inspect_namespace(
                         ^^^^^^^^^^^^^^^^^^
  File "/xxx/envs/smee/lib/python3.12/site-packages/pydantic/_internal/_model_construction.py", line 418, in inspect_namespace
    raise PydanticUserError(
pydantic.errors.PydanticUserError: Field 'is_plugin' defined on a base class was overridden by a non-annotated attribute. All field definitions, including overrides, require a type annotation.

For further information visit https://errors.pydantic.dev/2.9/u/model-field-overridden

Software versions

  • Which operating system and version are you using? OSX
  • How did you install Interchange? conda
  • What is the output of running conda list?
griffe-pydantic           1.1.0              pyh3cfb1c2_0    conda-forge
pydantic                  2.9.2              pyhd8ed1ab_0    conda-forge
pydantic-core             2.23.4          py312he431725_0    conda-forge
pydantic-units            0.0.2              pyh3cfb1c2_0    conda-forge
openff-amber-ff-ports     0.0.4              pyhca7485f_0    conda-forge
openff-forcefields        2024.09.0          pyhff2d567_0    conda-forge
openff-interchange-base   0.4.0              pyhd8ed1ab_0    conda-forge
openff-models             0.1.2              pyhca7485f_0    conda-forge
openff-toolkit-base       0.16.6             pyhd8ed1ab_0    conda-forge
openff-units              0.2.2              pyhca7485f_0    conda-forge
openff-utilities          0.1.12             pyhd8ed1ab_0    conda-forge

@mattwthompson
Copy link
Member

You should already have this in your inbox, but tagging for any future explorers of the corners of the Internet that Google nudges people toward: openforcefield/smirnoff-plugins#75

@mattwthompson
Copy link
Member

This'll be fixed by the next smirnoff-plugins release, probably 2024.12.0

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