Repository navigation
Synapse does not take advantage of Pydantic 2.0 #15858
Description
Activity
Workaround: run
pip install 'pydantic<2.0'in the virtual environment.Workaround: run
pip install 'pydantic<2.0'in the virtual environment.Suggest we specify this in pyproject.toml, or change
Lines 209 to 210 in 07fd6d8
# This is the most recent version of Pydantic with available on common distros. pydantic = ">=1.7.4" to
^=1.7.4.Not sure why I didn't do this when starting to use Pydantic. I think because generally speaking it makes packagers' lives easier if we don't impose upper bounds?
- addedX-Release-BlockerMust be resolved before making a releaseMust be resolved before making a releaseX-RegressionSomething broke which worked on a previous releaseSomething broke which worked on a previous release
on Jul 2, 2023 Just encountered this, and in other projects as well on Friday morning. I agree with pinning to
<2.0.0as a workaround; hoping to make a PR for this shortly.Just created: #15862
- added a commit that references this issue
on Jul 5, 2023 Closing this as it looks like it is resolved by #15862
- added a commit that references this issue
on Jul 12, 2023 Hi! We're currently blocked by matrix-synapse in our pydantic 2 rebuild for Arch Linux. Please reopen this ticket so that discussion around how/when/if to switch to pydantic2 can happen.
The change in #15862 is merely a workaround and not the solution to this ticket (which would be "be compatible with pydantic >= 2").
Thanks! :)
Re-opening per the above -- pinning to <= 2.0 isn't supporting Pydantic 2.0.
- removedX-Release-BlockerMust be resolved before making a releaseMust be resolved before making a releaseX-RegressionSomething broke which worked on a previous releaseSomething broke which worked on a previous release
on Jul 25, 2023 - addedS-MinorBlocks non-critical functionality, workarounds exist.Blocks non-critical functionality, workarounds exist.T-TaskRefactoring, removal, replacement, enabling or disabling functionality, other engineering tasks.Refactoring, removal, replacement, enabling or disabling functionality, other engineering tasks.O-OccasionalAffects or can be seen by some users regularly or most users rarelyAffects or can be seen by some users regularly or most users rarely
on Jul 25, 2023 Pydantic V2 includes V1 built-in to help migration.
We could use the following all over the place as a transitional measure.
try: from pydantic import v1 as pydantic except ImportError: import pydantic
Given that V1 and V2 use the same Python package name (⇒ you can't have them both installed at the same time), we sadly can expect some trouble with distro packages that would make switching to using V2 proper difficult for some time.
We could use the following all over the place as a transitional measure.
I'm not sure if that really works as intended. There are some implied breakages AFAIK irt the validators.
I can earliest look at my open PR again after 2023-08-21. If someone manages to fix this earlier and create a new release, that would be much appreciated, as synapse is currently the only package blocking us from moving to pydantic v2 on Arch Linux: https://archlinux.org/todo/python-pydantic-2/
- added a commit that references this issue
on Aug 21, 2023 We could use the following all over the place as a transitional measure.
I'm not sure if that really works as intended. There are some implied breakages AFAIK irt the validators.
The
pydantic.v1module is simply a copy of the old pydantic v1 code, so there should not be breakages there.I opened #16332 to add support for pydantic v2 while maintaining support for v1.
Reacted by Patrick Cloke- changed the title
[-]Synapse is incompatible with Pydantic 2.0[/-][+]Synapse does not take advantage of Pydantic 2.0[/+]on Oct 2, 2023 I opened #16332 to add support for pydantic v2 while maintaining support for v1.
I re-titled this since Synapse is now compatible, but not taking advantage of pydantic v2.
Description
After upgrading the PIP packages, Synapse failed to launch.
Steps to reproduce
matrix-synapseusing the "virtualenv" approach with the most recent dependency versionsHomeserver
another homeserver
Synapse Version
1.87.0rc1
Installation Method
pip (from PyPI)
Database
PostgreSQL
Workers
Single process
Platform
Raspberry Pi OS (Debian)
Configuration
No response
Relevant log output
Anything else that would be useful to know?
pydantic2.0 was released yesterday