Search code examples
pythonpipsetuptoolspypi

How to specify packages source?


My package depends of PyMySQL.
Problem:
Then I upload package to test.pypi.org and try to install it pip install -U -i https://testpypi.python.org/pypi scrapy-mysql-pipeline I got a exception in my code because PyMySQL version on test.pypi.org is 0.6.3-rc1 instead of current 0.7.11 My setup.py:

import setuptools
import os

if "PY_DEV" in os.environ:
    import pypandoc
    with open('README.rst', 'w') as f:
        f.write(pypandoc.convert('README.md', 'rst'))
else:
    os.environ.update(SKIP_WRITE_GIT_CHANGELOG='1')
os.environ.update(SKIP_GENERATE_AUTHORS='1')
setuptools.setup(
    setup_requires=['pbr', ],
    pbr=True
)

My setup.cfg:

[metadata]
name = scrapy-mysql-pipeline
author = Iaroslav Russkykh
author-email = [email protected]
summary = Asynchronous mysql Scrapy item pipeline
license = MIT
description-file = README.rst
home-page = https://github.com/IaroslavR/scrapy-mysql-pipeline
requires-python = >=2.7
classifier =
    Development Status :: 4 - Beta
    Framework :: Scrapy
    Intended Audience :: Developers
    License :: OSI Approved :: Apache Software License
    Operating System :: OS Independent
    Programming Language :: Python
    Topic :: Internet :: WWW/HTTP

[files]
packages =
    scrapy_mysql_pipeline

[wheel]
universal = 1

This requirements.txt cause error in pip: No matching distribution found for pymysql>=0.7.11 (from scrapy-mysql-pipeline)

scrapy>=1.4.0
pymysql>=0.7.11

How do I specify to use packages from pypi.org?


Solution

  • Try --extra-index-url:

    pip install -U --index-url=https://testpypi.python.org/pypi --extra-index-url=https://pypi.python.org/pypi scrapy-mysql-pipeline