Skip to content

[FIX] Python 3.13 / Debian Trixie compatibility#219270

Closed
xmo-odoo wants to merge 10 commits intoodoo:17.0from
odoo-dev:17.0-trixie-compat-xmo
Closed

[FIX] Python 3.13 / Debian Trixie compatibility#219270
xmo-odoo wants to merge 10 commits intoodoo:17.0from
odoo-dev:17.0-trixie-compat-xmo

Conversation

@xmo-odoo
Copy link
Copy Markdown
Collaborator

No description provided.

xmo-odoo added 10 commits July 16, 2025 13:18
Werkzeug 3.0 deprecated `werkzeug.__version__` and 3.1 removed it.

Trixie bundles werkzeug 3.1.3. So use `importlib.metadata.version` to
retrieve the package's version. It was made final (non-provisional) in
Python 3.10 which is the minver for odoo 17 so no need for a
conditional.

Also remove the unnecessary fallback in `test_misc`.
When 3.11 added PEP 657 fine-grained error locations, squiggles were
already possible[^1] but apparently we missed that in the cleanup
regex because those didn't show up in the messages we cared about.

With Python 3.13's improvements (sic...)[^2] this is not the case
anymore, and the tracebacks from testing the test suite do get a bunch
of squiggles which we need to learn to clean.

[^1]: https://docs.python.org/3/whatsnew/3.11.html#whatsnew311-pep657
[^2]: https://docs.python.org/3/whatsnew/3.13.html#improved-error-messages
Some libraries need to be bumped to be compatible with Python 3.13 (as
used in Trixie). In that case we update the requirements to the Trixie
version if possible, even if a lower version would be compatible with
3.13 itself.

- babel needs to be at least [2.11 to avoid usage of cgi][2] removed
  from 3.13
- freezegun needs to be [at least 1.5.0][3] to not call the
  now-removed `uuid._load_system_functions()`
- trixie ships gevent 24.11.1 and greenlet 3.1.0, but upstream [gevent
  24.11.1 requires greenlet 3.1.1][1] so basing the requirements off
  of trixie doesn't even install
- zeep needs to be [at least 4.3.0][4] to not use the `cgi` module

[1]: https://github.com/gevent/gevent/blob/24.11.1/setup.py#L200-L214
[2]: https://babel.pocoo.org/en/latest/changelog.html#version-2-11-0
[3]: spulec/freezegun#534
[4]: mvantellingen/python-zeep#1364
python/cpython#131568

Adapt the regex to handle both < 3.13 and >= 3.13 for this specific
test case.
Need to accept and forward size parameters in `addBlankPage`, used
by a test for some reason.
Doesn't work anymore in 3.13, unclear why.

spulec/freezegun#568
Newer babel versions get newer CLDR which change some of the
formatting patterns, especially whitespace. Normalise whitespace to
just standard spaces to fix the discrepancy.
Not sure why odoo#186799 used a super complicated lookup and matching with
inconsistent types just to find the recipient for the subtest, or why
it was replaced by something straightforward in odoo#189071 but that was
never backported.

In 3.13 this triggers a warning from the ORM, not sure why not
before (can't see anything in the changelog, but it might be from a
side-effect e.g. `locals()` ordering changed and now a non-empty dict
is tested before we find our target recipient, or since
`BaseModel.__eq__` ignores falsy objects maybe a dict which was falsy
in previous versions isn't anymore).
OrderedMultiDict is deprecated in Werkzeug 3.1 (pallets/werkzeug#2975)
which is what Trixie bundles.

While the entire thing was straight up removed in
5229cc8, pretty much keep the
semantics by more or less inlining the way OrderedMultiDicts are
compared.
@robodoo
Copy link
Copy Markdown
Contributor

robodoo commented Jul 16, 2025

Pull request status dashboard

@xmo-odoo
Copy link
Copy Markdown
Collaborator Author

@robodoo rebase-merge r+

@robodoo
Copy link
Copy Markdown
Contributor

robodoo commented Jul 16, 2025

Merge method set to rebase and merge, using the PR as merge commit message.

@xmo-odoo xmo-odoo changed the title Trixie compatibility [FIX] Python 3.13 / Debian Trixie compatibility Jul 16, 2025
@C3POdoo C3POdoo requested review from a team, adgu-odoo and jbw-odoo and removed request for a team July 16, 2025 12:45
robodoo pushed a commit that referenced this pull request Jul 16, 2025
Werkzeug 3.0 deprecated `werkzeug.__version__` and 3.1 removed it.

Trixie bundles werkzeug 3.1.3. So use `importlib.metadata.version` to
retrieve the package's version. It was made final (non-provisional) in
Python 3.10 which is the minver for odoo 17 so no need for a
conditional.

Also remove the unnecessary fallback in `test_misc`.

Part-of: #219270
Related: odoo/enterprise#90352
Signed-off-by: Xavier Morel (xmo) <xmo@odoo.com>
robodoo pushed a commit that referenced this pull request Jul 16, 2025
When 3.11 added PEP 657 fine-grained error locations, squiggles were
already possible[^1] but apparently we missed that in the cleanup
regex because those didn't show up in the messages we cared about.

With Python 3.13's improvements (sic...)[^2] this is not the case
anymore, and the tracebacks from testing the test suite do get a bunch
of squiggles which we need to learn to clean.

[^1]: https://docs.python.org/3/whatsnew/3.11.html#whatsnew311-pep657
[^2]: https://docs.python.org/3/whatsnew/3.13.html#improved-error-messages

Part-of: #219270
Related: odoo/enterprise#90352
Signed-off-by: Xavier Morel (xmo) <xmo@odoo.com>
robodoo pushed a commit that referenced this pull request Jul 16, 2025
Some libraries need to be bumped to be compatible with Python 3.13 (as
used in Trixie). In that case we update the requirements to the Trixie
version if possible, even if a lower version would be compatible with
3.13 itself.

- babel needs to be at least [2.11 to avoid usage of cgi][2] removed
  from 3.13
- freezegun needs to be [at least 1.5.0][3] to not call the
  now-removed `uuid._load_system_functions()`
- trixie ships gevent 24.11.1 and greenlet 3.1.0, but upstream [gevent
  24.11.1 requires greenlet 3.1.1][1] so basing the requirements off
  of trixie doesn't even install
- zeep needs to be [at least 4.3.0][4] to not use the `cgi` module

[1]: https://github.com/gevent/gevent/blob/24.11.1/setup.py#L200-L214
[2]: https://babel.pocoo.org/en/latest/changelog.html#version-2-11-0
[3]: spulec/freezegun#534
[4]: mvantellingen/python-zeep#1364

Part-of: #219270
Related: odoo/enterprise#90352
Signed-off-by: Xavier Morel (xmo) <xmo@odoo.com>
robodoo pushed a commit that referenced this pull request Jul 16, 2025
python/cpython#131568

Adapt the regex to handle both < 3.13 and >= 3.13 for this specific
test case.

Part-of: #219270
Related: odoo/enterprise#90352
Signed-off-by: Xavier Morel (xmo) <xmo@odoo.com>
robodoo pushed a commit that referenced this pull request Jul 16, 2025
Need to accept and forward size parameters in `addBlankPage`, used
by a test for some reason.

Part-of: #219270
Related: odoo/enterprise#90352
Signed-off-by: Xavier Morel (xmo) <xmo@odoo.com>
robodoo pushed a commit that referenced this pull request Jul 16, 2025
Doesn't work anymore in 3.13, unclear why.

spulec/freezegun#568

Part-of: #219270
Related: odoo/enterprise#90352
Signed-off-by: Xavier Morel (xmo) <xmo@odoo.com>
robodoo pushed a commit that referenced this pull request Jul 16, 2025
Newer babel versions get newer CLDR which change some of the
formatting patterns, especially whitespace. Normalise whitespace to
just standard spaces to fix the discrepancy.

Part-of: #219270
Related: odoo/enterprise#90352
Signed-off-by: Xavier Morel (xmo) <xmo@odoo.com>
robodoo pushed a commit that referenced this pull request Jul 16, 2025
Not sure why #186799 used a super complicated lookup and matching with
inconsistent types just to find the recipient for the subtest, or why
it was replaced by something straightforward in #189071 but that was
never backported.

In 3.13 this triggers a warning from the ORM, not sure why not
before (can't see anything in the changelog, but it might be from a
side-effect e.g. `locals()` ordering changed and now a non-empty dict
is tested before we find our target recipient, or since
`BaseModel.__eq__` ignores falsy objects maybe a dict which was falsy
in previous versions isn't anymore).

Part-of: #219270
Related: odoo/enterprise#90352
Signed-off-by: Xavier Morel (xmo) <xmo@odoo.com>
robodoo pushed a commit that referenced this pull request Jul 16, 2025
OrderedMultiDict is deprecated in Werkzeug 3.1 (pallets/werkzeug#2975)
which is what Trixie bundles.

While the entire thing was straight up removed in
5229cc8, pretty much keep the
semantics by more or less inlining the way OrderedMultiDicts are
compared.

Part-of: #219270
Related: odoo/enterprise#90352
Signed-off-by: Xavier Morel (xmo) <xmo@odoo.com>
robodoo added a commit that referenced this pull request Jul 16, 2025
closes #219270

Related: odoo/enterprise#90352
Signed-off-by: Xavier Morel (xmo) <xmo@odoo.com>
@robodoo robodoo closed this Jul 16, 2025
robodoo added a commit that referenced this pull request Jul 17, 2025
closes #219300

Forward-port-of: #219270
Related: odoo/enterprise#90362
Signed-off-by: Xavier Morel (xmo) <xmo@odoo.com>
robodoo added a commit that referenced this pull request Jul 23, 2025
closes #219478

Forward-port-of: #219300
Forward-port-of: #219270
Related: odoo/enterprise#90447
Signed-off-by: Xavier Morel (xmo) <xmo@odoo.com>
@fw-bot fw-bot deleted the 17.0-trixie-compat-xmo branch July 23, 2025 14:49
robodoo added a commit that referenced this pull request Jul 25, 2025
closes #220147

Forward-port-of: #219478
Forward-port-of: #219270
Related: odoo/enterprise#90794
Signed-off-by: Xavier Morel (xmo) <xmo@odoo.com>
robodoo added a commit that referenced this pull request Jul 28, 2025
closes #220640

Forward-port-of: #220147
Forward-port-of: #219270
Related: odoo/enterprise#91053
Signed-off-by: Xavier Morel (xmo) <xmo@odoo.com>
robodoo added a commit that referenced this pull request Jul 30, 2025
closes #220858

Forward-port-of: #220640
Forward-port-of: #219270
Related: odoo/enterprise#91149
Signed-off-by: Xavier Morel (xmo) <xmo@odoo.com>
robodoo added a commit that referenced this pull request Aug 4, 2025
closes #221165

Forward-port-of: #220858
Forward-port-of: #219270
Related: odoo/enterprise#91325
Signed-off-by: Xavier Morel (xmo) <xmo@odoo.com>
lmignon pushed a commit to acsone/odoo that referenced this pull request Dec 26, 2025
Part-of: odoo#219270
Related: odoo/enterprise#90352
Signed-off-by: Xavier Morel (xmo) <xmo@odoo.com>
lmignon pushed a commit to acsone/odoo that referenced this pull request Dec 26, 2025
Werkzeug 3.0 deprecated `werkzeug.__version__` and 3.1 removed it.

Trixie bundles werkzeug 3.1.3. So use `importlib.metadata.version` to
retrieve the package's version. It was made final (non-provisional) in
Python 3.10 which is the minver for odoo 17 so no need for a
conditional.

Also remove the unnecessary fallback in `test_misc`.

Part-of: odoo#219270
Related: odoo/enterprise#90352
Signed-off-by: Xavier Morel (xmo) <xmo@odoo.com>
lmignon pushed a commit to acsone/odoo that referenced this pull request Dec 26, 2025
Some libraries need to be bumped to be compatible with Python 3.13 (as
used in Trixie). In that case we update the requirements to the Trixie
version if possible, even if a lower version would be compatible with
3.13 itself.

- babel needs to be at least [2.11 to avoid usage of cgi][2] removed
  from 3.13
- freezegun needs to be [at least 1.5.0][3] to not call the
  now-removed `uuid._load_system_functions()`
- trixie ships gevent 24.11.1 and greenlet 3.1.0, but upstream [gevent
  24.11.1 requires greenlet 3.1.1][1] so basing the requirements off
  of trixie doesn't even install
- zeep needs to be [at least 4.3.0][4] to not use the `cgi` module

[1]: https://github.com/gevent/gevent/blob/24.11.1/setup.py#L200-L214
[2]: https://babel.pocoo.org/en/latest/changelog.html#version-2-11-0
[3]: spulec/freezegun#534
[4]: mvantellingen/python-zeep#1364

Part-of: odoo#219270
Related: odoo/enterprise#90352
Signed-off-by: Xavier Morel (xmo) <xmo@odoo.com>
lmignon pushed a commit to acsone/odoo that referenced this pull request Dec 26, 2025
OrderedMultiDict is deprecated in Werkzeug 3.1 (pallets/werkzeug#2975)
which is what Trixie bundles.

While the entire thing was straight up removed in
5229cc8, pretty much keep the
semantics by more or less inlining the way OrderedMultiDicts are
compared.

Part-of: odoo#219270
Related: odoo/enterprise#90352
Signed-off-by: Xavier Morel (xmo) <xmo@odoo.com>
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.

2 participants