Skip to content

Fix compatibility with Pydantic 2.13#1501

Draft
mattwthompson wants to merge 5 commits into
mainfrom
fix-pydantic
Draft

Fix compatibility with Pydantic 2.13#1501
mattwthompson wants to merge 5 commits into
mainfrom
fix-pydantic

Conversation

@mattwthompson
Copy link
Copy Markdown
Member

Description

Possible fix for #1346

Checklist

  • Add tests
  • Lint
  • Update docstrings

@mattwthompson
Copy link
Copy Markdown
Member Author

De-serialization of collections is failing by not picking up non-default values. The fix is probably straightforward but I don't have more time to work on this today

@codecov
Copy link
Copy Markdown

codecov Bot commented May 19, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 94.07%. Comparing base (90e49b8) to head (dfeb1a4).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1501   +/-   ##
=======================================
  Coverage   94.07%   94.07%           
=======================================
  Files          73       73           
  Lines        6055     6058    +3     
=======================================
+ Hits         5696     5699    +3     
  Misses        359      359           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@mattwthompson
Copy link
Copy Markdown
Member Author

Failure is at a serialization time, not de-serialization

In [32]: state1.collections['Electrostatics'].scale_14
Out[32]: 0.8333333333

In [33]: with open("test.json", "w") as f:
    ...:     f.write(state1.model_dump_json())
    ...:

In [34]: json.loads(open('test.json').read())['collections']['Electrostatics'].keys()
Out[34]: dict_keys(['type', 'is_plugin', 'expression', 'key_map', 'potentials'])

In [35]: json.loads(open('test.json').read())['collections']['Electrostatics']['scale_14']
---------------------------------------------------------------------------
KeyError                                  Traceback (most recent call last)
Cell In[35], line 1
----> 1 json.loads(open('test.json').read())['collections']['Electrostatics']['scale_14']

KeyError: 'scale_14'

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

Successfully merging this pull request may close these issues.

1 participant