[TIP] setup.py: dependency_links = local devpi server

Tom Viner tom at viner.tv
Fri Jan 9 10:09:54 PST 2015


Ok, thanks Donald. So a simple list comprehension does the job:

from setuptools import setup
> install_requires = [
>         'openpyxl-wrapper',
>         'my_other_package',
>         'a_third_package',
> ]
> dependency_links = [
>         'http://pypi.local/user/index/+simple/{}'.format(package)
>         for package in install_requires
>     ]
> setup(
>     name='dep_links',
>     dependency_links=dependency_links,
>     install_requires=install_requires
> )


And we can keep just our testing requirement in our tox.ini!


On 9 January 2015 at 17:37, Donald Stufft <donald at stufft.io> wrote:

>
> On Jan 9, 2015, at 12:31 PM, Tom Viner <tom at viner.tv> wrote:
>
> Hi all,
>
> we're using an internal devpi server to host our python packages. We find
> we have to duplicate all our requirements in our tox.ini which can set
> "indexserver".
> But we'd like to be able to install locally hosted requirements from a
> setup.py like this, using dependency_links:
>
> from setuptools import setup
>> setup(
>>     name='dep_links',
>>     dependency_links=['http://pypi.local/user/index/+simple/'],
>>     install_requires=[
>>         'openpyxl-wrapper',
>>     ]
>> )
>
>
> Our index inherits from the public pypi.
>
> However we get this error message (Full output
> <https://gist.github.com/tomviner/e925c2878fba31661446>):
>
> Installed
>> /home/myuser/.virtualenvs/myvenv/lib/python2.7/site-packages/dep_links-0.0.0-py2.7.egg
>> Processing dependencies for dep-links==0.0.0
>> Searching for openpyxl-wrapper
>> Reading http://pypi.local/user/index/+simple/
>> Reading https://pypi.python.org/simple/openpyxl-wrapper/
>> Couldn't find index page for 'openpyxl-wrapper' (maybe misspelled?)
>> Scanning index of all packages (this may take a while)
>> Reading https://pypi.python.org/simple/
>> No local packages or download links found for openpyxl-wrapper
>> error: Could not find suitable distribution for
>> Requirement.parse('openpyxl-wrapper')
>
>
> So you can see that our simple index page is reached, but for some reason
> this link isn't fetched:
>
>> <a href="openpyxl-wrapper">openpyxl-wrapper</a><br/>
>
>
> But the package can be installed using:
>
>> pip install -e . -i http://pypi.local/user/index/+simple/
>>
>
> and the requirement is installed from the devpi server package without any
> issue.
>
> So why can setuptools install from public pypi, but not our devpi server?
>
> Any ideas appreciated!
>
>
> The —index-url and the —find-links flag do slightly different things, and
> dependency_links is like —find-links.
>
> The tl;dr is that you can’t put the simple index there, you have to put
> the page where the actual files can be found at,
> so something like:
>
>     dependency_links=[“
> http://pypi.local/user/index/+simple/openpyxl-wrapper/“]
> <http://pypi.local/user/index/+simple/openpyxl-wrapper/%E2%80%9C%5D>
>
> ---
> Donald Stufft
> PGP: 7C6B 7C5D 5E2B 6356 A926 F04F 6E3C BCE9 3372 DCFA
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.idyll.org/pipermail/testing-in-python/attachments/20150109/8278e8bf/attachment-0001.htm>


More information about the testing-in-python mailing list