[16.0][FIX] upgrade_analysis: prevent dependency on MarkupSafe >= 2.0.0 - #3707
Conversation
c9f5162 to
aff16fb
Compare
aff16fb to
90b57a0
Compare
90b57a0 to
f5ed150
Compare
|
Ah, a dependency hell. It's been a while. I really need to work on a better error message in that case. I thought I had done something in manifestoo, will check again. acsone/manifestoo#81 To diagnose these kinds of dependency issues, I typically do: and look what requires markupsafe>(the markupsafe version in ocb requirements.txt) In this case it is Mako (a dependency of upgrade_analysis) which requires markupsafe>=2. Since nothing says that the old jinja2 in Odoo's requirements.txt is incompatible with recent markupsafe (which is normal), markupsafe gets upgraded to the latest version. So in this case I would simply add The root of this category of issues is Odoo's requirements.txt (which has a very specific and a bit exotic purpose, as python packaging practices go) and Odoo's setup.py which is incomplete and lacks lower bounds, as well as upper bounds for known incompatibilities. My proposal to improve this area is OCA/oca-ci#73 |
f5ed150 to
eb34bad
Compare
This halts test jobs on `could not obtain odoo.addons.__path__ using python` due
to the incompatibility of Odoo 16's required version of Jinja2 on Python 3.10
```
+ unbuffer /opt/odoo-venv/bin/odoo -d odoo -i account,base,base_import,base_setup,base_sparse_field,bus,crm,fs_storage,iap,mail,mail_environment,purchase,queue_job,sale_management,test_mail,web --http-interface=127.0.0.1 --stop-after-init
Traceback (most recent call last):
File "/opt/odoo-venv/bin/odoo", line 5, in <module>
import odoo
File "/opt/odoo/odoo/__init__.py", line 155, in <module>
from . import cli
File "/opt/odoo/odoo/cli/__init__.py", line 11, in <module>
from . import scaffold
File "/opt/odoo/odoo/cli/scaffold.py", line 8, in <module>
import jinja2
File "/opt/odoo-venv/lib/python3.10/site-packages/jinja2/__init__.py", line 12, in <module>
from .environment import Environment
File "/opt/odoo-venv/lib/python3.10/site-packages/jinja2/environment.py", line 25, in <module>
from .defaults import BLOCK_END_STRING
File "/opt/odoo-venv/lib/python3.10/site-packages/jinja2/defaults.py", line 3, in <module>
from .filters import FILTERS as DEFAULT_FILTERS # noqa: F401
File "/opt/odoo-venv/lib/python3.10/site-packages/jinja2/filters.py", line 13, in <module>
from markupsafe import soft_unicode
ImportError: cannot import name 'soft_unicode' from 'markupsafe' (/opt/odoo-venv/lib/python3.10/site-packages/markupsafe/__init__.py)
```
eb34bad to
dee0fa7
Compare
|
@sbidoul Thank you very much for your analysis and the helpful commands. Because the issue is triggered by this month's release of Mako 1.4.0, I changed my fix to pin upgrade_analysis' dependency on an earlier version of Mako. Hope you agree. |
pedrobaeza
left a comment
There was a problem hiding this comment.
Let's greenify the branch
/ocabot merge patch
|
This PR looks fantastic, let's merge it! |
|
Congratulations, your PR was merged at 2a9984c. Thanks a lot for contributing to OCA. ❤️ |
|
We must avoid placing upper bounds on direct dependencies unless we know the code of the module is incompatible with higher versions, and we can't fix that easily. In this case upgrade_analysis is compatible with the latest mako version. Doing this upper bound prevents all deployments that include upgrade_analysis to use a later version if they would need it for any reason (features, security, ...). Here the problem is a compatibility with indirect dependencies you don't control, so resolving the compatibility issues needs to be deferred to integration time. So in this case This (long but with a TL;DR) article covers this topic quite well: https://iscinumpy.dev/post/bound-version-constraints/. |
|
OK, reverted and switched to test-requirements.txt in #3708 |
Alternative solution to OCA#3707
This halts test jobs on
could not obtain odoo.addons.__path__ using pythondue to the incompatibility of Odoo 16's required version of Jinja2 on Python 3.10Avoiding manifestoo obscuring the error with some debug code leads to the following traceback:
This points to a compatibility issue with MarkupSafe which has been updated to (currently) 3.0.3 by pip while resolving test dependencies:
Details
Example of PR demonstrating the issue: #3698
Example of failed run with debug info: https://github.com/OCA/server-tools/actions/runs/32255125804/job/96074931556