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

Marius Gedminas marius at gedmin.as
Fri Oct 24 11:29:45 PDT 2014


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.

  [tox]
  install_command = /bin/true
  commands =
    pip install -e ../library1
    pip install -e ../library2
    pip install -e {toxinidir}
    nosetests ...

might maybe also work?

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.

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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 173 bytes
Desc: Digital signature
URL: <http://lists.idyll.org/pipermail/testing-in-python/attachments/20141024/aa7eea6b/attachment.pgp>


More information about the testing-in-python mailing list