Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Direct URL PEP 508 support and installing sub-dependencies from Git #5566

Closed
dmfigol opened this issue Jul 3, 2018 · 3 comments
Closed

Direct URL PEP 508 support and installing sub-dependencies from Git #5566

dmfigol opened this issue Jul 3, 2018 · 3 comments
Labels
auto-locked Outdated issues that have been locked by automation type: support User Support

Comments

@dmfigol
Copy link

dmfigol commented Jul 3, 2018

  • Pip version: 10.0.1
  • Python version: 3.7.0
  • Operating system: macOS

I've spent the whole day reading about installing sub-dependencies from git and I am still struggling to find the correct solution.

My use-case

I forked an existing Python library (available on PyPi), added some changes that are unlikely to be merged upstream.
Some of my projects depend on the library fork. Previously it was an application, and I was using Pipenv to manage application dependencies, where I could easily specify to install specific branch/commit from Git in Pipfile. My application grew and now I am converting it to library (it is not going to be published on PyPi). I need to solve the problem of sub-dependencies from Git for the library.
I've read at least the following issues: #3610, #4187, #2124, #5384 and many others and of course PEP. When I finished reading I was even more confused than when I started.

From what I understood with implementation of PEP-508 in pip 10, I should be able to use:

setup(
    name='dmfigol',
...
    install_requires=[
        "requests",
        'smartsheet-python-sdk @ git+ssh://git@github.com/dmfigol/smartsheet-python-sdk@dev#egg=smartsheet-python-sdk-1.3.3',
    ],
)

But it does not work:

-> % pip install git+https://<private-git>/dmfigol/my-test-project.git
Collecting git+https://<private-git>/dmfigol/my-test-project.git
  ...
Direct url requirement (like smartsheet-python-sdk@ git+ssh://git@github.com/dmfigol/smartsheet-python-sdk@dev#egg=smartsheet-python-sdk-1.3.3) are not allowed for dependencies

My questions:

  1. Did I do something wrong or this is not supported?
  2. If not supported, is it going to be supported?
  3. Do I understand correctly that I can also use similar syntax in pyproject.toml if I want to migrate from setup.py to something more declarative?
  4. Is the only available solution today to use --process-dependency-links and dependency_links section in setup.py?
  5. What happens when the upstream updates the library on PyPi to 1.3.4 or higher, and I would still like to use my forked version 1.3.3?

Thank you

UPD: currently working solution until #4187 is implemented if you stumble upon this thread:

setup(
    ...
    install_requires=[
        "smartsheet-python-sdk==10.1.3.3",
    ],
    dependency_links=[
        'https://github.com/dmfigol/smartsheet-python-sdk/archive/no-setuptools-scm.zip#egg=smartsheet-python-sdk-10.1.3.3'
    ],
...
@pradyunsg
Copy link
Member

Did I do something wrong or this is not supported?

PEP 508 URL requirements as dependencies are not supported.

If not supported, is it going to be supported?

Yes. See below.

Do I understand correctly that I can also use similar syntax in pyproject.toml if I want to migrate from setup.py to something more declarative?

pyproject.toml only serves as a place to specify build time dependencies and to have configuration for tools. Anything other than that is implemented by the tools you're using.

Is the only available solution today to use --process-dependency-links and dependency_links section in setup.py?

Yes. That's the entire motivation behind #4187.


We disabled the ability to use PEP 508 URL requirements in dependencies, since we don't want that a package installed from PyPI to result in the pip reaching out to an arbitary web URL. Basically, pip install spam should not make pip reach out to anything except PyPI.

The current proposed solution in #4187 is to simply modify the blocking conditional so that it only blocks URL dependencies when a package is actually being installed from PyPI directly, so that any other mode of installation can use PEP 508 URL dependencies.

@pradyunsg pradyunsg added the type: support User Support label Jul 4, 2018
@dmfigol
Copy link
Author

dmfigol commented Jul 4, 2018

Thank you for detailed explanation, I really appreciate your help.

@dmfigol dmfigol closed this as completed Jul 4, 2018
ksauzz added a commit to ksauzz/happybase that referenced this issue Aug 14, 2018
since nested github depencies are not supported by pip

pypa/pip#5566
maphew added a commit to maphew/setupext-janitor that referenced this issue Feb 8, 2019
dojeda added a commit to quetz-al/quetzal-client that referenced this issue Mar 5, 2019
PEP 508 is not supported (as explained in
pypa/pip#5566). We are adding this as a workonaround
until we publish on PyPI.
@lock
Copy link

lock bot commented Jun 2, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot added the auto-locked Outdated issues that have been locked by automation label Jun 2, 2019
@lock lock bot locked as resolved and limited conversation to collaborators Jun 2, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
auto-locked Outdated issues that have been locked by automation type: support User Support
Projects
None yet
Development

No branches or pull requests

2 participants