{"action":"created","issue":{"url":"https://api.github.com/repos/pypa/pip/issues/5827","repository_url":"https://api.github.com/repos/pypa/pip","labels_url":"https://api.github.com/repos/pypa/pip/issues/5827/labels{/name}","comments_url":"https://api.github.com/repos/pypa/pip/issues/5827/comments","events_url":"https://api.github.com/repos/pypa/pip/issues/5827/events","html_url":"https://github.com/pypa/pip/issues/5827","id":364914579,"node_id":"MDU6SXNzdWUzNjQ5MTQ1Nzk=","number":5827,"title":"--index-url with local path is dropped silently if directory exists","user":{"login":"uranusjr","id":605277,"node_id":"MDQ6VXNlcjYwNTI3Nw==","avatar_url":"https://avatars1.githubusercontent.com/u/605277?v=4","gravatar_id":"","url":"https://api.github.com/users/uranusjr","html_url":"https://github.com/uranusjr","followers_url":"https://api.github.com/users/uranusjr/followers","following_url":"https://api.github.com/users/uranusjr/following{/other_user}","gists_url":"https://api.github.com/users/uranusjr/gists{/gist_id}","starred_url":"https://api.github.com/users/uranusjr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/uranusjr/subscriptions","organizations_url":"https://api.github.com/users/uranusjr/orgs","repos_url":"https://api.github.com/users/uranusjr/repos","events_url":"https://api.github.com/users/uranusjr/events{/privacy}","received_events_url":"https://api.github.com/users/uranusjr/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":5,"created_at":"2018-09-28T14:31:34Z","updated_at":"2018-09-30T07:28:47Z","closed_at":null,"author_association":"MEMBER","body":"Say I have this setup:\r\n\r\n```\r\n$ mkdir /some/path\r\n```\r\n\r\nRunning `pip install` with it as an index URL gives me this: \r\n\r\n```\r\n$ pip install packaging --index-url=/some/path\r\nLooking in indexes: /some/path\r\nCollecting packages\r\n  Url '/some/path/packaging/' is ignored. It is either a non-existing path or lacks a specific scheme.\r\n  Could not find a version that satisfies the requirement packaging (from versions: )\r\nNo matching distribution found for packaging\r\n```\r\n\r\nBut if I create an empty directory under it…\r\n\r\n```\r\n$ mkdir /some/path/packaging\r\n$ pip install packaging --index-url=/some/path\r\nLooking in indexes: /some/path\r\nCollecting packaging\r\n  Could not find a version that satisfies the requirement packaging (from versions: )\r\nNo matching distribution found for packaging\r\n```\r\n\r\nThe warning message disappears.\r\n\r\nThe reason is probably this block of code:\r\n\r\nhttps://github.com/pypa/pip/blob/4cc5f37f4b6cb897bde7bbe28bb527da8ec14bce/src/pip/_internal/index.py#L202-L233\r\n\r\nA local path to an existing directory would go into the if branch at line 212, but would match either conditions inside (`expand_dir` is only true for `--find-links`, and this is a path, not URL), and is silently dropped.\r\n\r\nThe fix would be to add an extra else branch in the L212 if block, but I want to know what is the intended behaviour here. A `file:` URL would be allowed here (if the directory contains a valid `index.html`):\r\n\r\n```\r\n$ curl https://pypi.org/simple/packaging/ -o /some/path/packaging/index.html\r\n...\r\n$ pip install packaging --index-url file:///some/path\r\nLooking in indexes: file:///some/path\r\nCollecting packaging\r\n  Using cached https://files.pythonhosted.org/packages/89/d1/92e6df2e503a69df9faab187c684585f0136662c12bb1f36901d426f3fab/packaging-18.0-py2.py3-none-any.whl\r\n...\r\n```\r\n\r\nShould a path be allowed as well?"},"comment":{"url":"https://api.github.com/repos/pypa/pip/issues/comments/425701002","html_url":"https://github.com/pypa/pip/issues/5827#issuecomment-425701002","issue_url":"https://api.github.com/repos/pypa/pip/issues/5827","id":425701002,"node_id":"MDEyOklzc3VlQ29tbWVudDQyNTcwMTAwMg==","user":{"login":"cjerdonek","id":355822,"node_id":"MDQ6VXNlcjM1NTgyMg==","avatar_url":"https://avatars3.githubusercontent.com/u/355822?v=4","gravatar_id":"","url":"https://api.github.com/users/cjerdonek","html_url":"https://github.com/cjerdonek","followers_url":"https://api.github.com/users/cjerdonek/followers","following_url":"https://api.github.com/users/cjerdonek/following{/other_user}","gists_url":"https://api.github.com/users/cjerdonek/gists{/gist_id}","starred_url":"https://api.github.com/users/cjerdonek/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cjerdonek/subscriptions","organizations_url":"https://api.github.com/users/cjerdonek/orgs","repos_url":"https://api.github.com/users/cjerdonek/repos","events_url":"https://api.github.com/users/cjerdonek/events{/privacy}","received_events_url":"https://api.github.com/users/cjerdonek/received_events","type":"User","site_admin":false},"created_at":"2018-09-30T07:28:47Z","updated_at":"2018-09-30T07:28:47Z","author_association":"MEMBER","body":"Oh, okay. Thanks. Originally I thought you were saying that `expand_dir` can't ever be true in the path case. But you were just referring to the case of the example you provided (that doesn't pass `--find-links`)."}}
{"actor":{"display_login":"cjerdonek"}}