feat: Build for Python 3.14#383
Conversation
There was a problem hiding this comment.
Pull request overview
This PR targets Python 3.14 readiness by updating CI matrices and dependency markers, and aligning GQLAlchemy’s OGM internals/tests with Pydantic v2 APIs while preserving historical OGM behavior (notably around omitted nullable fields).
Changes:
- Expand CI coverage up through Python 3.14 and adjust test selection/extras installation per interpreter.
- Update OGM internals and tests to use Pydantic v2 APIs (
model_fields,model_validate,field_validator) and add compatibility helpers for field metadata. - Refine dependency markers for optional stacks (TensorFlow/TF-GNN, PyArrow) and update docs to reflect modern Python support and Pydantic-v2 usage.
Reviewed changes
Copilot reviewed 17 out of 18 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
tests/transformations/translators/test_tfgnn_transformations.py |
Switch TF/TF-GNN imports to importorskip and add tfgnn markers. |
tests/ogm/test_validators.py |
Migrate validators to Pydantic v2 field_validator and adjust list validation logic. |
tests/ogm/test_properties.py |
Replace __fields__ assertions with model_fields. |
tests/ogm/test_loading.py |
Use Pydantic v2 ValidationError import. |
tests/ogm/test_custom_fields.py |
Use GQLAlchemy Field wrapper instead of Pydantic v1 Field. |
tests/ogm/test_class_definition.py |
Replace __fields__ assertions with model_fields. |
tests/docs/test_ogm.py |
Add module-level skip for Python 3.14+ due to behavior mismatch. |
pyproject.toml |
Add Python-version markers for pandas/TF stacks and update optional extras markers. |
gqlalchemy/vendors/memgraph.py |
Update on-disk property handling to use model-field helpers/attrs. |
gqlalchemy/models.py |
Implement Pydantic v2 migration helpers, Field wrapper metadata, and model_validate flow. |
gqlalchemy/connection.py |
Switch parse_obj usages to model_validate. |
gqlalchemy/__init__.py |
Update exported validator import to Pydantic v2 location. |
docs/reference/gqlalchemy/models.md |
Document parse_obj compatibility and recommend model_validate. |
docs/installation.md |
Update supported Python statement and clarify optional-extras availability. |
docs/index.md |
Update support note to include Python 3.14 and extras caveats. |
docs/how-to-guides/ogm.md |
Add note about omitted nullable fields being treated as None. |
.github/workflows/build-and-test.yml |
Expand Python matrices, add dispatch inputs, split dependency installs and test runs by Python version. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
antejavor
left a comment
There was a problem hiding this comment.
Massive improvements all around the places (python support, win, macos build) , with a minor downside in compatibility.
I guess at some point we will ditch most of the dependencies out and move to Memgraph QM ->GNN/TGNN, being an example, since we now have this ->https://github.com/memgraph/memgraph/blob/master/mage/python/gnn.py
That means dependencies can live inside the mage container, keeping clients cleaner and leaner. 🦾
Description
This PR updates
gqlalchemyfor Python 3.14 readiness by combining CI/dependency compatibility updates with the previously merged Pydantic v2 API migration #384. It broadens test coverage across newer Python versions, adjusts optional dependency markers for unsupported stacks (notably TensorFlow/TF-GNN on newer interpreters), and keeps OGM behavior stable for normalNode/Relationshipusage.Most users should not need code changes. One edge case remains: nullable (
Optional[...]) fields may accept omitted values asNonewhere strict “required but nullable” validation was previously relied on.Added a short smoke-test of
gqlalchemyin macOS and restored tests for Windows in CI.Pull request type
Please delete options that are not relevant.
Related issues
Delete section if this PR doesn't resolve any issues.
Closes (link to issue)
Checklist:
######################################
Reviewer checklist (the reviewer checks this part)
######################################