Fix ansible-core version preservation during ansible-dev-tools installation#356
Merged
cidrblock merged 4 commits intoansible:mainfrom Aug 14, 2025
Merged
Fix ansible-core version preservation during ansible-dev-tools installation#356cidrblock merged 4 commits intoansible:mainfrom
cidrblock merged 4 commits intoansible:mainfrom
Conversation
- Reorder installation to install ansible-dev-tools first, then ansible-core - Add force reinstallation for user-specified ansible-core versions - Implement runtime dependency constraint checking with pip --dry-run - Add version compatibility warnings for conflicting requirements - Refactor config properties: split venv_pip_install_cmd into venv_pip_cmd and venv_pip_install_cmd - Add comprehensive test coverage for dependency constraint detection and warning system - Move packaging imports to module level with proper fallback handling - Remove redundant integration test (seed enabled by default) Resolves issue where ansible-dev-tools installation would override user-specified ansible-core versions by leveraging pip's native dependency resolution.
- Cast FakeConfig to Config type in test fixtures - Change timeout parameter from float to int in timeout test - Add proper typing imports for cast function Resolves remaining mypy type checker warnings.
alisonlhart
approved these changes
Aug 14, 2025
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.
Fixes: #354
Problem
When users specify a specific ansible-core version via
--ansible-core-version, the subsequent installation of ansible-dev-tools would override the user-specified version due to dependency resolution conflicts. For example,ansible-core==2.16.0would be upgraded toansible-core==2.19.0during ansible-dev-tools installation.Solution
This PR implements a dependency-aware installation strategy that preserves user-specified ansible-core versions while providing compatibility warnings:
Core Changes
get_dependency_constraint()utility that usespip install --dry-runto determine ansible-dev-tools' ansible-core requirements at runtimevenv_pip_install_cmdinto separatevenv_pip_cmdandvenv_pip_install_cmdproperties following DRY principlesImplementation Details
Testing
Technical Notes
The solution respects pip's dependency resolution while ensuring user intent is preserved. The warning system helps users understand potential compatibility issues without blocking installation.
Files changed: 5 files, 1215 insertions, 8 deletions