[TIP] Issue with larger project with subprojects; how to deal with dependencies?

holger krekel holger at merlinux.eu
Fri Oct 24 11:45:40 PDT 2014


On Fri, Oct 24, 2014 at 21:29 +0300, Marius Gedminas wrote:
> On Fri, Oct 24, 2014 at 06:12:18PM +0000, holger krekel wrote:
> > On Fri, Oct 24, 2014 at 18:52 +0300, Marius Gedminas wrote:
> > > On Fri, Oct 24, 2014 at 11:28:21AM +0000, holger krekel wrote:
> > > > If i am not mistaken there is indeed no easy solution for your problem
> > > > with current tox.  The use case certainly makes sense to me and i am
> > > > in fact using devpi indexes to solve it for myself.
> > > > 
> > > > To make things work locally with tox i think we would need a new option.
> > > > I see two possibilities:
> > > > 
> > > > - "pre_install_commands": tox would call it ahead of
> > > >   installing the package or the tox.ini-specified dependencies.
> > > >   You could call a script that (re)creates the subdirectory dependencies
> > > >   and installs them.
> > > > 
> > > > - extend "deps" such that when you specify a relative path to a
> > > >   "setup.py" it would package and install those.
> > > > 
> > > > The first solution is more general but i kind of prefer the second one
> > > > because it directly solves your problem.  However, i am not going to program
> > > > this any time soon myself unless paid (which is quite possible, i've done
> > > > paid feature additions in the past, contact me privately if interested).
> > > 
> > > But wouldn't it be sufficient to tell pip where to find the other
> > > subprojects?  I don't see a `find-links` option in
> > > http://tox.readthedocs.org/en/latest/config.html, but you could do
> > > 
> > >   [tox]
> > >   install_command = pip install -f ../library1 -f ../library2 {opts} {packages}
> > 
> > IIUC the subdir contains just another project with "setup.py" etc.
> > For findlinks to work it would need to contain archive files.
> 
> Oh, right.  I was thinking about buildout's
> 
>   [buildout]
>   develop = ../dir1 ../dir2
> 
> > But i agree
> > you could possibly write your own "install_command" command and could
> > make things work so it's an interesting idea.
> 
>   [tox]
>   install_command = pip install -e ../library1 -e ../library2 {opts} {packages}
> 
> might work, but *ugh* what a horrible hack.

It could work but changing install_command will effect installing
the deps and the package so the "-e" would be excuted twice.
Also "-e" is not very precise because it sees more files than might
be packaged later.

>   [tox]
>   install_command = /bin/true
>   commands =
>     pip install -e ../library1
>     pip install -e ../library2
>     pip install -e {toxinidir}
>     nosetests ...
> 
> might maybe also work?

Probably better though i still dislike "-e" but it's up to the original
to judge if it's ok in their environment.

> I'm tossing out ideas while ignoring the fact my brain is not really
> working, because it's Friday evening and I haven't had enough sleep this
> week.  Caveat emptor etc.

thanks for sketching possible work arounds workarounds, working today!

cheers,
holger

> 
> Marius Gedminas
> -- 
> Similarly, many of us don't care for slacker email correspondence where all the
> words are in lower case. Frankly, if you're going to bother to write to me, the
> least you can do is use your shift key to capitalise letters now and again YOU
> BORDERLINE ILLITERATE SLOB.
>         -- Stuart Jeffries



> _______________________________________________
> testing-in-python mailing list
> testing-in-python at lists.idyll.org
> http://lists.idyll.org/listinfo/testing-in-python




More information about the testing-in-python mailing list