feat: add extra_commands support to presets with odoo_version markers#9
Merged
trisdoan merged 5 commits intotrobz:mainfrom Feb 9, 2026
Merged
feat: add extra_commands support to presets with odoo_version markers#9trisdoan merged 5 commits intotrobz:mainfrom
trisdoan merged 5 commits intotrobz:mainfrom
Conversation
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
e8eb752 to
12e2d38
Compare
12e2d38 to
ad374e0
Compare
hailangvn
reviewed
Feb 6, 2026
| [[common.extra_commands]] | ||
| command = ["uv", "pip", "install", "setuptools<58.0"] | ||
| when = "odoo_version <= '13.0'" | ||
| stage = "after_requirements" |
Collaborator
There was a problem hiding this comment.
Thanks for the solution. Just a small correction about the stage.
Suggested change
| stage = "after_requirements" | |
| stage = "after_venv" |
Contributor
Author
There was a problem hiding this comment.
thanks for your review @hailangvn
I updated the PR to keep the change at after_requirements stage:
vatnumberwas missing fromignore_from_odoo_requirements, fixed- I prefer to handle this case as an explicit exception happening after normal requirements are installed
Contributor
Author
There was a problem hiding this comment.
Can you please have a second look? Also added a commit for the README.md
| [[common.extra_commands]] | ||
| command = ["uv", "pip", "install", "vatnumber==1.2"] | ||
| when = "odoo_version <= '13.0'" | ||
| stage = "after_requirements" |
Collaborator
There was a problem hiding this comment.
Suggested change
| stage = "after_requirements" | |
| stage = "after_venv" |
| command = ["uv", "pip", "install", "setuptools<58.0"] | ||
| when = "odoo_version <= '13.0'" | ||
| stage = "after_requirements" | ||
|
|
Collaborator
There was a problem hiding this comment.
Suggested change
| # Install wheel to prepare for vatnumber installation | |
| [[common.extra_commands]] | |
| command = ["uv", "pip", "install", "wheel"] | |
| when = "odoo_version <= '13.0'" | |
| stage = "after_venv" | |
Add ability to run extra commands at specific stages during venv creation
based on odoo_version marker conditions.
Features:
- New 'extra_commands' field in presets.toml with 'when', 'stage', and 'env' keys
- Custom odoo_version marker evaluation (<=13.0, >=14.0, etc.)
- Support for environment variables in commands
- Verbose output showing condition and environment for each command
- Three execution stages: after_venv, after_requirements, after_odoo_install
Example usage:
[[common.extra_commands]]
command = ["uv", "pip", "install", "setuptools<58.0", "wheel"]
when = "odoo_version <= '13.0'"
stage = "after_requirements"
[[common.extra_commands]]
command = ["uv", "pip", "install", "vatnumber==1.2"]
when = "odoo_version <= '13.0'"
stage = "after_requirements"
env = { UV_NO_BUILD_ISOLATION = "1" }
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
ad374e0 to
5432ae3
Compare
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
hailangvn
approved these changes
Feb 9, 2026
- Add VALID_STAGES constant to validate command execution stages - Extract validation logic to _validate_cmd_spec() helper (reduces complexity) - Extract error handling to _handle_cmd_error() helper - Extract logging to _print_cmd_info() helper - Wrap command execution in try/catch for detailed error context - Update presets.toml with marker syntax examples and limitations
Collaborator
|
Hi anh @nilshamerlinck , great idea! just added some validation and docstring about the change, ok for you? |
Contributor
Author
|
thanks @trisdoan, ok for me PS: now that we are trying |
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.
We have to handle a particular packaging case for old odoo.
vatnumberis needed for odoo <= 13.0, see herevatnumberpackage needs2to3to build which has been removed from recent setuptoolsThis PR is an attempt at handling it properly in odoo-venv:
Summary
extra_commandsfield to presets.toml to run additional commands at specific stages during venv creationodoo_versionmarkers (e.g.,odoo_version <= '13.0')UV_NO_BUILD_ISOLATION=1)Details
The new
extra_commandsfeature allows running arbitrary commands at three stages:after_venv- after virtual environment creationafter_requirements- after installing all requirementsafter_odoo_install- after installing Odoo in editable modeEach command can have:
command: list of command argumentswhen: marker expression (supportsodoo_versionand standard packaging markers)stage: one of the three stages aboveenv: optional dict of environment variablesConcretely for
vatnumber