Skip to content
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

Allow for base deps, overridden by factors (no duplicate requirements) #1390

Closed
blueyed opened this issue Aug 4, 2019 · 5 comments
Closed
Labels
feature:new something does not exist yet, but should

Comments

@blueyed
Copy link

blueyed commented Aug 4, 2019

Often you have special factors with specific version constraints for dependencies.

With pytest-cov this then results in tox -e py37 not working, since dependencies are not installed then.

It would be nice if this would be supported:

diff --git i/tox.ini w/tox.ini
index bfe166f..b640c23 100644
--- i/tox.ini
+++ w/tox.ini
@@ -13,6 +13,7 @@ setenv =
 passenv =
     *
 deps =
+    pytest
     t310: pytest==3.10.1
     t40: pytest==4.0.2
     t41: pytest==4.1.1
@@ -20,9 +21,11 @@ deps =
     t44: pytest==4.4.2
     t45: pytest==4.5.0

+    pytest-xdist
     {t310,t40,t41,t43}: pytest-xdist==1.27.0
     {t44,t45}: pytest-xdist==1.28.0

+    coverage
     c44: coverage==4.4.2
     c45: coverage==4.5.3
 pip_pre = true

I.e. the deps are installed without a version constraint by default, but for the specific factors the constraint would be used.

Currently this results in:

GLOB sdist-make: /home/daniel/Vcs/pytest-cov/setup.py
py37-t45 create: /home/daniel/Vcs/pytest-cov/.tox/py37-t45
py37-t45 installdeps: pytest, pytest==4.5.0, pytest-xdist, pytest-xdist==1.28.0, coverage
ERROR: invocation failed (exit code 1), logfile: /home/daniel/Vcs/pytest-cov/.tox/py37-t45/log/py37-t45-1.log
================================================================================= log start ==================================================================================
Double requirement given: pytest==4.5.0 (already in pytest, name='pytest')
You are using pip version 19.0.3, however version 19.2.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.

================================================================================== log end ===================================================================================
ERROR: could not install deps [pytest, pytest==4.5.0, pytest-xdist, pytest-xdist==1.28.0, coverage]; v = InvocationError('/home/daniel/Vcs/pytest-cov/.tox/py37-t45/bin/python -m pip install --pre pytest pytest==4.5.0 pytest-xdist pytest-xdist==1.28.0 coverage', 1)
__________________________________________________________________________________ summary ___________________________________________________________________________________
ERROR:   py37-t45: could not install deps [pytest, pytest==4.5.0, pytest-xdist, pytest-xdist==1.28.0, coverage]; v = InvocationError('/home/daniel/Vcs/pytest-cov/.tox/py37-t45/bin/python -m pip install --pre pytest pytest==4.5.0 pytest-xdist pytest-xdist==1.28.0 coverage', 1)

A trick is to use envs for this, but that should not be necessary: pytest-dev/pytest-cov#315

@blueyed blueyed added the feature:new something does not exist yet, but should label Aug 4, 2019
@gaborbernat
Copy link
Member

This is non-trivial, as it implies us to do some kind of interpretation of the PEP-440 dependencies. I would say definitely won't do part of the core. But is a really strong candidate for a good plugin someone can write. If you do decide on going ahead and making this a reality please comment the repository URL below.

@jayvdb
Copy link

jayvdb commented Oct 20, 2020

Double requirement given: pytest, pytest==4.5.0

IMO this is best fixed in pip, as many times doubles are not incompatible, in which case there is only one desired outcome. Also pip already has all the relevant dependencies and helpers to make that decision.

@gaborbernat
Copy link
Member

gaborbernat commented Oct 21, 2020

Well, this is debatable. Technically pip can say specifying multiple times the same dependency on the command line is not a valid call. Though in an ideal world, yes, pip should handle it. Maybe with the new dependency resolver, it may be able to do so. This was beforehand the biggest stumble block.

@untitaker
Copy link

The new resolver has landed and outside of Python 2 this now just seems to work.

@gaborbernat
Copy link
Member

This is no longer the case with newer pips, so the recommendation is to use a newer pip.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature:new something does not exist yet, but should
Projects
None yet
Development

No branches or pull requests

4 participants