Nebulosar
Nebulosar

Reputation: 1855

how to add a tar.gz githubfile to setup.py

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!

Upvotes: 5

Views: 1342

Answers (2)

NpnSaddy
NpnSaddy

Reputation: 325

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>",]

Upvotes: 1

mr.bjerre
mr.bjerre

Reputation: 2898

Like this?

install_requires=['cdm-pythonparser @ http://github.com/SergeySatskiy/cdm-pythonparser/archive/v2.0.1.tar.gz']

Upvotes: 2

Related Questions