Skip to content

Fix parallel notebook#443

Draft
ChristopherMayes wants to merge 5 commits into
mainfrom
update_parallel_notebook
Draft

Fix parallel notebook#443
ChristopherMayes wants to merge 5 commits into
mainfrom
update_parallel_notebook

Conversation

@ChristopherMayes

Copy link
Copy Markdown
Collaborator

Summary

This PR fixes two Pydantic warnings that appeared when running Xopt on Python 3.14, and adds the missing gest-api dependency to the conda environment.

Changes

  • Replaced the deprecated from pydantic.v1.json import custom_pydantic_encoder import in xopt/pydantic.py with a small, self-contained encoder. This removes the repeated "Core Pydantic V1 functionality isn't compatible with Python 3.14 or greater" warning while preserving the original encoding behavior.
  • Declared _loaded_population and _toolbox as PrivateAttr in xopt/generators/ga/cnsga.py. These attributes were previously set in __init__ without being declared, which caused Pydantic to emit PydanticSerializationUnexpectedValue warnings during serialization.
  • Added gest-api to environment.yml so the dependency is installed with the conda environment.

Testing

  • Restarted the notebook kernel and re-ran docs/examples/basic/xopt_parallel.ipynb. The previously affected cells now run cleanly with no warnings.
  • Verified in a fresh interpreter that importing xopt.pydantic no longer raises the Pydantic v1 warning and that the custom encoder correctly serializes NumPy values.

@codecov

codecov Bot commented Jul 6, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 36.36364% with 7 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
xopt/pydantic.py 12.50% 7 Missing ⚠️

📢 Thoughts on this report? Let us know!

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