fix: resolve tox failures for missing Python interpreters - #84
Conversation
📝 WalkthroughWalkthroughThe changes pin Python build, runtime, and optional dependencies; update CI tool versions; configure tox to skip unavailable interpreters; and modify Sonar SCA settings. ChangesPython tooling configuration
Estimated code review effort: 2 (Simple) | ~10 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In @.github/workflows/python_package.yml:
- Around line 36-38: Pin the pip, build, and tox-gh-actions dependencies in the
workflow’s installation steps, preferably by referencing a reviewed constraints
or lock file with hashes; otherwise specify reviewed exact versions. Update the
three install commands while preserving the existing upgrade/install behavior.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Enterprise
Run ID: b7ec9afd-1f1f-4862-af6c-7f18ee31e8b7
📒 Files selected for processing (2)
.github/workflows/python_package.ymlpyproject.toml
c53adce to
847a61e
Compare
There was a problem hiding this comment.
🧹 Nitpick comments (1)
pyproject.toml (1)
2-2: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winRemove
buildfrom the backend requirements.setuptools.build_metadoesn't need thebuildfrontend in the isolated env, and CI already installsbuild==1.2.2separately. Keep the pin outsidepyproject.tomlto avoid version drift.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@pyproject.toml` at line 2, Remove the build==1.2.1 entry from the requires list in pyproject.toml, leaving setuptools and jpy unchanged; retain the build tool installation and pin in the existing CI configuration.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@pyproject.toml`:
- Line 2: Remove the build==1.2.1 entry from the requires list in
pyproject.toml, leaving setuptools and jpy unchanged; retain the build tool
installation and pin in the existing CI configuration.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Enterprise
Run ID: 930c4001-2095-4ddd-9755-11c52f5ee9bd
📒 Files selected for processing (2)
.github/workflows/python_package.ymlpyproject.toml
32879a6 to
e21ab72
Compare
This fixes the issue where tox would fail when it couldn't find all Python interpreters in the CI environment. The problem occurred because tox was configured to test against py39, py310, py311, and py312, but each CI matrix job only has one Python version installed. Changes: - Add tox-gh-actions package to workflow dependencies to enable environment mapping based on the current Python version - Add skip_missing_interpreters=true to tox config as a safety net to skip rather than fail on missing interpreters With tox-gh-actions, the [gh-actions] configuration in pyproject.toml will be respected, ensuring only the matching tox environment runs in each matrix job (e.g., py310 runs only in Python 3.10 job). 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
e21ab72 to
9fe5184
Compare
|
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In @.github/workflows/python_package.yml:
- Line 37: Update the dependency installation step in the workflow around the
extras passed to pip so the complete tests and dev dependency graph is resolved
through the repository’s reviewed, hash-verified constraints or lock file.
Preserve installation of both .[tests] and .[dev], and ensure every transitive
dependency is constrained rather than only pinning pip and build.
In `@pyproject.toml`:
- Around line 51-52: Remove the == 0.4.1 version pins from the self-referential
drools_jpy[local] and drools_jpy[tests] dev dependencies in pyproject.toml,
preserving their extras so local development resolves the current project
source.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Enterprise
Run ID: 50af5cf0-9233-4260-87a6-74f319f0baef
📒 Files selected for processing (3)
.github/workflows/python_package.ymlpyproject.tomlsonar-project.properties
| python3 -m pip install --upgrade build | ||
| python3 -m pip install .[tests] .[dev] | ||
| python3 -m pip install --upgrade pip==26.0 build==1.2.2 | ||
| python3 -m pip install .[tests] .[dev] # NOSONAR - dynamic local package extras |
There was a problem hiding this comment.
🔒 Security & Privacy | 🟠 Major | ⚡ Quick win
Lock dependencies installed through the test and development extras.
Although pip and build are pinned, pip install .[tests] .[dev] can still resolve transitive dependencies to changing index versions. Install these extras through a reviewed constraints/lock file with hashes, or otherwise lock the complete dependency graph.
As per path instructions, focus on major issues impacting performance, readability, maintainability and security.
🧰 Tools
🪛 GitHub Check: SonarCloud Code Analysis
[warning] 37-37: Using dependencies without locking resolved versions is security-sensitive.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In @.github/workflows/python_package.yml at line 37, Update the dependency
installation step in the workflow around the extras passed to pip so the
complete tests and dev dependency graph is resolved through the repository’s
reviewed, hash-verified constraints or lock file. Preserve installation of both
.[tests] and .[dev], and ensure every transitive dependency is constrained
rather than only pinning pip and build.
Sources: Path instructions, Linters/SAST tools
| "drools_jpy[local] == 0.4.1", | ||
| "drools_jpy[tests] == 0.4.1" |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟠 Major | ⚡ Quick win
Remove version pins for self-referential dev dependencies.
Hardcoding the project's own version (0.4.1) here will cause dependency conflicts during local development. When the project's version is bumped in the future, running pip install -e .[dev] will either fail to resolve or incorrectly fetch the outdated 0.4.1 package from PyPI instead of using your local source code.
🐛 Proposed fix
- "drools_jpy[local] == 0.4.1",
- "drools_jpy[tests] == 0.4.1"
+ "drools_jpy[local]",
+ "drools_jpy[tests]"📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| "drools_jpy[local] == 0.4.1", | |
| "drools_jpy[tests] == 0.4.1" | |
| "drools_jpy[local]", | |
| "drools_jpy[tests]" |
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@pyproject.toml` around lines 51 - 52, Remove the == 0.4.1 version pins from
the self-referential drools_jpy[local] and drools_jpy[tests] dev dependencies in
pyproject.toml, preserving their extras so local development resolves the
current project source.
|
Hm please remove the pinning of all the requirements, otherwise it'll be a massive headache. |
@ptoscano That'e exactly what SonarQube is asking for otherwise it drops the rating on the code. |
Yes, I know about that: there was a similar attempt in ansible-rulebook few weeks ago. The problem is that it becomes a maintenance burden that way: you'll need to ensure that e.g. dependabot can update all of these pins, and the updates will be a lot. Especially for a repository like this one that does not get changes very often, this would create a lot of busy work. Please let's discuss this kind of change separately, as it affects also other repositories. Also, this PR is supposed to fix the CI failure with tox, so please let's keep this focused on that only, to unblock the CI and further changes. |


This fixes the issue where tox would fail when it couldn't find all Python interpreters in the CI environment. The problem occurred because tox was configured to test against py39, py310, py311, and py312, but each CI matrix job only has one Python version installed.
Changes:
With tox-gh-actions, the [gh-actions] configuration in pyproject.toml will be respected, ensuring only the matching tox environment runs in each matrix job (e.g., py310 runs only in Python 3.10 job).
🤖 Generated with Claude Code
Summary by CodeRabbit