[Distutils] Canonical Repo URL: Make "pip install -e foo" work

Wes Turner wes.turner at gmail.com
Tue Mar 21 10:26:53 EDT 2017


On Tue, Mar 21, 2017 at 3:13 AM, Thomas Güttler <
guettliml at thomas-guettler.de> wrote:

> AFAIK it is impossible to do this:
>
>  pip install -e foo
>
> You need to use the repo URL up to now:
>
>  pip install -e git+https://example.com/repos/foo#egg=foo
>
> AFAIK the fast/short implementation of "pip install -e foo" does
> not work, since pip can't access metadata of package foo without
> downloading
> the whole package. Or am I wrong - is this possible?
>

These read metadata from an already-downloaded package with a setup.py?:

```bash
pip install -e .
pip install -e "${VIRTUAL_ENV}/src/foo"
```

You can download the JSON metadata from {PyPI, Warehouse} but IDK about
{devpi, }?

- https://github.com/pypa/warehouse/issues/1638
  - https://pypi.org/pypi/pip/json
  -

  -
https://github.com/pypa/warehouse/blob/master/warehouse/legacy/api/json.py
    - [ ] add (existing, Metadata 2.0/3.0) JSON api to devpi

      - [ ] Create a PEP for a pypa JSON HTTP endpoint spec
        - [ ] Static HTML support: Redirect to pkg-name-ver.tar.gz.json?

      - http://doc.devpi.net/latest/curl.html
      - http://doc.devpi.net/latest/userman/devpi_commands.html#getjson


- "Pip needs a dependency resolver"
  https://github.com/pypa/pip/issues/988
  -
https://github.com/awwad/depresolve/blob/master/depresolve/scrape_pypi_metadata.py

  - pip clone --recursive
  - pip install --clone --recursive --no-recursive


>
> But how cares for useless downloaded bytes? I don't care.
>

How is this usecase distinct from those solved for by?:

- requirements.txt
- pipenv install --dev pkgname
  - https://github.com/kennethreitz/pipenv


>
> It should be possible to download the whole package "foo",
> then look at the metadata which is provided by it. Take
> the canonical repo url, and then get the source from
> the repo.
>
> AFAIK there is no official way to define a "Canonical Repo URL" up to now.
>
> If I want to provide it for my custom packages. How could I do this?
>

With JSONLD [1],
you could just add a "source" attribute (with your own namespaced URI:
"myns:source") to the package metadata:

sourceURL: "git+ssh://git@github.com/pypa/pip@master"
sourceURL: "git+https://github.com/pypa/pip@master"

Or, we could add "sourceURL" (pending bikeshedding on the property name) to
the metadata 3.0 PEP.

````bash
pip clone pip
pip install --clone --rev-override=develop pip
```

And then, if you give a mouse a cookie,
what about multiple sourceURLs: which is the canonical URL?

git+git://git.apache.org/libcloud.git
git+https://github.com/apache/libcloud
git+ssh://git@github.com/apache/libcloud

[1] https://github.com/pypa/interoperability-peps/issues/31


>
> Regards,
>   Thomas Güttler
>
> --
> Thomas Guettler http://www.thomas-guettler.de/
> _______________________________________________
> Distutils-SIG maillist  -  Distutils-SIG at python.org
> https://mail.python.org/mailman/listinfo/distutils-sig
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/distutils-sig/attachments/20170321/acebdde9/attachment.html>


More information about the Distutils-SIG mailing list