The Python Oracle

How to specify another tox project folder as a dependency for a tox project

This video explains
How to specify another tox project folder as a dependency for a tox project

--

Become part of the top 3% of the developers by applying to Toptal
https://topt.al/25cXVn

--

Music by Eric Matyas
https://www.soundimage.org
Track title: Forest of Spells Looping

--

Chapters
00:00 Question
04:59 Accepted answer (Score 5)
05:47 Answer 2 (Score 16)
06:13 Answer 3 (Score 0)
06:36 Answer 4 (Score -5)
07:02 Thank you

--

Full question
https://stackoverflow.com/questions/2441...

Question links:
[tox]: http://tox.readthedocs.org/

Accepted answer links:
[response of diabloneo]: https://stackoverflow.com/a/30797873/120...

Answer 3 links:
[https://tox.wiki/en/latest/example/gener...]: https://tox.wiki/en/latest/example/gener...

--

Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...

--

Tags
#python #dependencies #setuptools #setuppy #tox

#avk47



ANSWER 1

Score 18


You can use pip's --editable option in your main project, like followings:

deps =
    --editable=file:///{toxinidir}/../library
    -r{toxinidir}/requirements.txt

P.S. Don't use this style: -e file:///{toxinidir}/../library, because tox pass whole string as an argument to argparse in error foramt.




ACCEPTED ANSWER

Score 6


As suggested in the comments to the response of diabloneo it is possible to supply an install_command in the tox.ini file:

I used this to make a bash script that takes all the usual pip arguments, but then runs pip before with just pip install --editable="file://`pwd`/../path/to/neighbour/repo", and only then actually runs the regular pip install $@ afterwards with the arguments to the script (as would be passed by tox to pip directly). I then used this script with install_command instead of the regular default pip command.

With this two-step procedure it works fine :-)




ANSWER 3

Score 0


I realize it's been a long time since the question was asked but might be useful to someone, I tried to do the same, and it turns out it can be done using distshare directory of tox: https://tox.wiki/en/latest/example/general.html#access-package-artifacts-between-multiple-tox-runs

# example two/tox.ini
[testenv]
# install latest package from "one" project
deps = {distshare}/one-*.zip