Editable requirement parsing in pip

Tzu-ping Chung <[email protected]>
Newsgroups gmane.comp.python.distutils.devel
Message-ID <[email protected]>
Hi,

I was verifying my Pipenv resolver work, and found a quirk in pip when handling
-e requirements.

With a requirements.txt:

    # Works as expected
    colorama ; os_name == "nt"

    # Works as expected
    ./colorama ; os_name == "nt"

    # Drops markers; always installs disregarding the OS (!)
    -e ./colorama ; os_name == "nt"

This by itself is okay, since it doesn’t really make sense to me to specify a
requirement as editable without intending it to always work, although somehow
surprising and (AFAICT) undocumented.

The behavior in the command line is a little more preplexing:

    # Works as expected
    $ pip install "./colorama ; os_name == 'nt'"

    # Does not work
    $ pip install -e "./colorama ; os_name == 'nt'"
    ./colorama ; os_name == "nt" should either be a path to a local project or
    a VCS url beginning with svn+, git+, hg+, or bzr+

    # This either
    $ pip install "-e ./colorama ; os_name == 'nt'"
    ./colorama ; os_name == "nt" should either be a path to a local project or
    a VCS url beginning with svn+, git+, hg+, or bzr+

Since pip’s documentation says a requirements.txt “is just a list of pip install
arguments placed in a file” [1], this is surprising to me.

[1]: https://pip.pypa.io/en/stable/user_guide/#id1

So my questions are

* Is this behaviour intentional, or is it an oversight?
* Is there specification or documentation on how pip is supposed to work?

Given that PEP 508 (although pip does not actually use its URL lookup syntax) allows
requirements to specify markers in all cases, I would expect pip to allow and honour
them in all cases. Or, if that’s not the case (since editable is not really a
standardised thing), I’d expect pip to at least be consistent with itself :)


--
Tzu-ping Chung (@uranusjr)
[email protected]
https://uranusjr.com
--
Distutils-SIG mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mm3/mailman3/lists/distutils-sig.python.org/
Message archived at https://mail.python.org/mm3/archives/list/[email protected]/message/3B4W7ZCANHBQLYHLHYF5Y6FG757HVYX6/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.