5

From my setup.py:

requirements = [
    ...,
    'git+https://github.com/SergeySatskiy/cdm-pythonparser/archive/v2.0.1.tar.gz'
]

setup(
    install_requires=requirements,
    ...,
)

This does not work. However, I know I can install the tar.gz by using plain

pip install git+https://github.com/SergeySatskiy/cdm-pythonparser/archive/v2.0.1.tar.gz

Is there a way to set this up within my setup.py file?

I have tried pulling it local but that did not work as well.
Also tried to do it without the git+, did not work either.

Update

What I saw was that I can add the dependency to a kwarg called dependency_links like this:

setup(
   ...
   install_requires=requirements,
   dependency_links = ['http://github.com/SergeySatskiy/cdm-pythonparser/archive/v2.0.1.tar.gz']
)

But then it gets included always. What I am trying to accomplish is that it gets included in the test environment. So I added it to the tests_require, but of course this works just like install_requires so that didn't help.

Is there a way to only get this in my test environment?

Any help is appreciated!

Nebulosar
  • 1,727
  • 3
  • 20
  • 46
  • see https://setuptools.readthedocs.io/en/latest/setuptools.html#dependencies-that-aren-t-in-pypi – Andrii Maletskyi Jun 20 '18 at 16:21
  • Do you have any special constraints so you cannot upload it to PyPI as sdist? – Andrii Maletskyi Jun 20 '18 at 16:23
  • Possible duplicate of [How can I make setuptools install a package that's not on PyPI?](https://stackoverflow.com/questions/3472430/how-can-i-make-setuptools-install-a-package-thats-not-on-pypi) – phd Jun 20 '18 at 19:50

2 Answers2

2

Like this?

install_requires=['cdm-pythonparser @ http://github.com/SergeySatskiy/cdm-pythonparser/archive/v2.0.1.tar.gz']
mr.bjerre
  • 2,384
  • 2
  • 24
  • 37
1

According to PEP 440, such direct references require a file:// or other prefix prefix like http://

the way to specify it in install_requires is

install_requires = ["<package_name> @ http://<url_to_tar.gz>",]
NpnSaddy
  • 317
  • 3
  • 11