feat(modes): add --mode flag for dependency resolution (conservative/modern/bleeding-edge)#83
Open
feat(modes): add --mode flag for dependency resolution (conservative/modern/bleeding-edge)#83
Conversation
f13684a to
2e5e87d
Compare
Add mode-based overrides to fix OpenSSL 3.x incompatibility (Ubuntu 24.04+) when creating venvs with OCA addons for Odoo 12-17. Conservative mode: exact pins per Odoo range - Odoo 12-14: pyopenssl==22.1.0 + cryptography==38.0.4 (OCA caps) - Odoo 15-17: pyopenssl>=24.0.0 + cryptography>=41.0.5 Modern mode: floor versions for all Odoo 12-17, resolver picks latest. Migrate urllib3 override from presets.toml to modes.toml with corrected scope (odoo_version >= 15.0 + python_version < 3.12).
Add dependency overrides to handle python-ldap/pyldap compatibility issues across Odoo versions due to OpenLDAP 2.5+ removing libldap_r: - Odoo 12: Replace unmaintained pyldap with python-ldap>=3.4.2 - Odoo 13+: Bump python-ldap 3.4.0 to >=3.4.2 (3.4.0 hardcodes -lldap_r)
2e5e87d to
2f6710a
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Introduces three dependency resolution modes via a new
--modeCLI flag to allow flexible version constraint strategies based on stability requirements.Problem Solved
Odoo projects have different dependency requirements:
Previously, all projects used the same constraint strategy. Now users can select their risk tolerance.
Technical Explanation
Concepts
Preset = WHAT to install (Odoo version, addons, Python packages).
Mode = HOW to resolve dependency versions.
Modes
conservative(default)compatmodernlatest-secure>=) instead of exact pins. Lets uv pick latest compatible.bleeding-edgeuncappedData Flow
How Each Mode Resolves
conservative / modern —
_resolve_mode_overrides()iterates the mode's overrides list. Each override has:ignore: requirement specs added to the ignore list (filtered out of Odoo'srequirements.txt)install: replacement specs added as extra requirementswhen: marker expression evaluated againstodoo_versionandpython_versionbleeding-edge —
_resolve_mode_overrides()returns empty lists. Instead,_process_requirement_line()receivesstrip_specifiers=Trueand writes bare package names (e.g.,urllib3instead ofurllib3==1.26.5), letting uv resolve to latest.Inheritance
Modern inherits all conservative overrides at load time. Deduplication by package name — if both define the same package, modern's version wins (last-write).
known_issuesandextra_commandsare also inherited. Bleeding-edge inherits nothing (overrides would contradict uncapped strategy).Known Issues
Each mode can define
known_issues— package/error-pattern pairs. Whenuv pip installfails,_check_known_issues()matches the failed package against these patterns and prints actionable suggestions.