Skip to content

fix editable URL parsing / support (hg) URL Schemes: urllib #754

Closed
@westurner

Description

@westurner

Defect

Currently, pip fails to parse URLs to editables which contain multiple + signs.

$ pip install -e hg+bb+ssh://pypy/pypy@tip#egg=pypy
Obtaining pypy from hg+bb+ssh://pypy/pypy@tip#egg=pypy
  Cloning hg bb+ssh://pypy/pypy (to revision tip#egg=pypy) to ./test/src/pypy

It would be great if the output would be:

$ pip install -e hg+bb+ssh://pypy/pypy@tip#egg=pypy
Obtaining pypy from hg+bb+ssh://pypy/pypy@tip#egg=pypy
  Cloning hg bb+ssh://pypy/pypy (to revision tip) to ./test/src/pypy

Use Case

As a package developer, I would like to install packages from Mercurial repositories that are addressed with Mercurial "schemes" for brevity and consistency.

The Schemes Extension for Mercurial supports custom URL schemes. [1]

For example, with a scheme defined in .hgrc (hg showconfig | grep '^scheme')

[schemes]
bb+ssh = ssh://[email protected]/
example = https://{1}.example.org/hg/

This will clone ssh://[email protected]/pypy/pypy

hg clone bb+ssh://pypy/pypy

[1] http://mercurial.selenic.com/wiki/SchemesExtension

Relevant

Sources

  • pip.req.parse_requirements [1]
  • tests.test_requirements [2]
  • tests.test_install_requirements [3]
  • docs/requirements.txt [4]

Are there test cases that demonstrate why Python 2urlparse [5] / Python 3 urllib.parse should or should not be utilized here?

The docstrings for urlparse [6] list a handful of RFCs that may or may not be relevant to describing editable python packages as URLs with

  • schemes containing multiple plus signs
    • hg+https://
    • hg+bb+ssh://
    • git+https://
    • git+git://
  • fragments containing
    • egg names: #egg=
    • file hashes: #md5=

[1] https://github.com/pypa/pip/blob/develop/pip/req.py#L1291
[2] https://github.com/pypa/pip/blob/develop/tests/test_requirements.py
[3] https://github.com/pypa/pip/blob/develop/tests/test_install_requirement.py
[4] https://github.com/pypa/pip/blob/develop/docs/requirements.txt#L45
[5] http://docs.python.org/2/library/urlparse.html
[6] http://hg.python.org/cpython/file/2.7/Lib/urlparse.py

Metadata

Metadata

Assignees

No one assigned

    Labels

    auto-lockedOutdated issues that have been locked by automation

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions