Conversation
anoadragon453
left a comment
There was a problem hiding this comment.
Thank you very much for filing this - it saves the dev team a ton of effort ❤️
The sytest failures appear to be due to Sytest not following the spec - hooray for validation!
I've started on fixing them - by converting the tests to Complement and debugging them there, starting with: matrix-org/complement#811
Some minor comments below.
pyproject.toml
Outdated
| # We need packaging.verison.Version(...).major added in 20.0. | ||
| packaging = ">=20.0" | ||
| pydantic = "~=2.1" | ||
| pydantic = "~=2.12" |
There was a problem hiding this comment.
Do we require 2.12?
Several Linux distributions do not carry that version, so will struggle to package Synapse: https://repology.org/project/python%3Apydantic/versions
In general we should aim to specify the lowest possible version in pyproject.toml that's compatible with the code. Then in poetry.lock we specify highest possible (so those distributing Synapse using pyenv's can get the latest fixes and improvements).
There was a problem hiding this comment.
It’s dependent on the Python version. Pydantic 2.7.4 was the first version to give correct results. For Python 3.13 and Python 3.14 later versions are required, with Pydantic 2.12 being the first version to support Python 3.14.
We could discriminate based on Python version, something like pydantic>=2.7.4;python_version<'3.13', etc.
There was a problem hiding this comment.
Pydantic 2.8 added support for Python 3.13. Because most of the distros in the table packaged at least Pydantic 2.8, I’d suggest the following:
pydantic = [
{ version = "~= 2.8", python = "< 3.14" },
{ version = "~= 2.12", python = ">= 3.14" },
]There was a problem hiding this comment.
I see, I didn't realise >=2.7.4 was necessary. Indeed, I don't see any distros in that list with 2.7.*, so it would make sense to go to the next minor version up, 2.8*.
Your suggestion looks sound!
There was a problem hiding this comment.
Oh man, trial-olddeps is complaining. But I don’t get what’s going on just yet.
Edit: My first guess is a logic error in check_dependencies.py.
There was a problem hiding this comment.
You're correct. check_dependencies.py doesn't take the python attribute into account when determining which dependencies it needs to install. It then fails when attempting to install 2.12.x even though it's on Python 3.9.
I did some preliminary work on updating it in a separate branch. Let me bring that up into a PR.
Co-authored-by: Andrew Morgan <1342360+anoadragon453@users.noreply.github.com>
Committing this to this branch to check whether it fixes `tests-olddeps`. If so, will extract this to a separate PR for review from the team.
This appears to be tripping old-deps. First, see if removing fixes it.
|
@V02460 I believe I've bypassed the previous old-deps errors and now we've moved on to something else (likely just changing a Heading to bed now, and can pick it up in the morning. |
JSON has no way to translate to `set`, and the type is converted to a `set` below anyways.
A regression test for the issue we were seeing in #19071 (comment)
anoadragon453
left a comment
There was a problem hiding this comment.
#19110 has now merged, and I've updated this branch to latest develop. Assuming CI now passes, this should be ready to merge!
|
Looks like it. Nice work! 🎉 |
Update Pydantic to v2.
Steps I took to create this change:
check_pydantic_models.pyNotable changes are
_metadata_urland_introspection_endpointAnyEventIdtupleandsettypesCloses #15858
Closes #15979
Pull Request Checklist
EventStoretoEventWorkerStore.".code blocks.