Skip to content

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

Closed
@dmfigol

Description

@dmfigol
  • 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'
    ],
...

Metadata

Metadata

Assignees

No one assigned

    Labels

    auto-lockedOutdated issues that have been locked by automationtype: supportUser Support

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions