-
-
Notifications
You must be signed in to change notification settings - Fork 530
Enforce constraints during install_package_deps #2888
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
046234b
to
5ebd4e4
Compare
Create a constraints file based on the listed or installed ``deps`` and use it during ``install_package_deps`` to ensure the package dependencies do not override the environment's dependencies. Adds new config keys: * ``constrain_package_deps`` - chicken switch to go back to the legacy behavior of allowing the package deps to override the testenv deps * ``use_frozen_constraints`` - a more strict mode, enforced that the package deps do not conflict in any way with the set of packages installed by ``deps`` Fix tox-dev#2386
5ebd4e4
to
311cc33
Compare
CR feedback
for readability; cr feedback
@@ -135,18 +135,14 @@ def _install_requirement_file(self, arguments: PythonDeps, section: str, of_type | |||
raise Recreate(f"requirements removed: {' '.join(missing_requirement)}") | |||
if old.get("constraint_options") != constraint_options: | |||
raise Recreate( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
msg = f"constraint options changed: old={old.get('constraint_options')} new={constraint_options}"
raise Recreate(msg)
would save you a line here 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i thought so too, but black disagreed
diff --git a/src/tox/tox_env/python/pip/pip_install.py b/src/tox/tox_env/python/pip/pip_install.py
index 640c1356..e608c2b7 100644
--- a/src/tox/tox_env/python/pip/pip_install.py
+++ b/src/tox/tox_env/python/pip/pip_install.py
@@ -134,7 +134,9 @@ class Pip(Installer[Python]):
if missing_requirement:
raise Recreate(f"requirements removed: {' '.join(missing_requirement)}")
if old.get("constraint_options") != constraint_options:
- msg = f"constraint options changed: old={old.get('constraint_options')} new={constraint_options}"
+ msg = (
+ f"constraint options changed: old={old.get('constraint_options')} new={constraint_options}"
+ )
raise Recreate(msg)
args = arguments.as_root_args
if args: # pragma: no branch
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i ended up making it a little cleaner by assigning old_constraint_options = old.get("constraint_options")
cr feedback
6f850ae
to
ed4bbc9
Compare
This PR contains the following updates: | Package | Type | Update | Change | Pending | |---|---|---|---|---| | [tox](https://togithub.com/tox-dev/tox) ([changelog](https://tox.wiki/en/latest/changelog.html)) | dev | minor | `4.3.5` -> `4.4.0` | `4.4.5` (+4) | --- ### Release Notes <details> <summary>tox-dev/tox</summary> ### [`v4.4.0`](https://togithub.com/tox-dev/tox/releases/tag/4.4.0) [Compare Source](https://togithub.com/tox-dev/tox/compare/4.3.5...4.4.0) #### What's Changed - Add more explanation to `list_dependencies_command` configuration option by [@​Czaki](https://togithub.com/Czaki) in [https://github.com/tox-dev/tox/pull/2883](https://togithub.com/tox-dev/tox/pull/2883) - \[pre-commit.ci] pre-commit autoupdate by [@​pre-commit-ci](https://togithub.com/pre-commit-ci) in [https://github.com/tox-dev/tox/pull/2889](https://togithub.com/tox-dev/tox/pull/2889) - Enforce constraints during install_package_deps by [@​masenf](https://togithub.com/masenf) in [https://github.com/tox-dev/tox/pull/2888](https://togithub.com/tox-dev/tox/pull/2888) - Windows shlex fix by [@​masenf](https://togithub.com/masenf) in [https://github.com/tox-dev/tox/pull/2895](https://togithub.com/tox-dev/tox/pull/2895) #### New Contributors - [@​Czaki](https://togithub.com/Czaki) made their first contribution in [https://github.com/tox-dev/tox/pull/2883](https://togithub.com/tox-dev/tox/pull/2883) **Full Changelog**: tox-dev/tox@4.3.5...4.4.0 </details> --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Enabled. ♻ **Rebasing**: Whenever PR is behind base branch, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNC4xMDEuMCIsInVwZGF0ZWRJblZlciI6IjM0LjEwMS4wIn0=--> Co-authored-by: descope[bot] <descope[bot]@users.noreply.github.com>
Create a constraints file based on the listed or installed
deps
and use it duringinstall_package_deps
to ensure the package dependencies do not override the environment's dependencies.Adds new config keys:
constrain_package_deps
- chicken switch to go back to the legacy behavior of allowing the package deps to override the testenv depsuse_frozen_constraints
- a more strict mode, enforced that the package deps do not conflict in any way with the set of packages installed bydeps
Fix #2386
Thanks for contribution
Please, make sure you address all the checklists (for details on how see
development documentation)!
tox -e fix
)docs/changelog
folder