forked from pypa/packaging.python.org
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathspecification
More file actions
69 lines (48 loc) · 2.63 KB
/
specification
File metadata and controls
69 lines (48 loc) · 2.63 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
.. _direct-url:
==========================================================
Recording the Direct URL Origin of installed distributions
==========================================================
This document specifies a :file:`direct_url.json` file in the
``*.dist-info`` directory of an installed distribution, to record the
Direct URL Origin of the distribution. The general structure and usage of
``*.dist-info`` directories is described in :ref:`recording-installed-packages`.
Specification
=============
The :file:`direct_url.json` file MUST be created in the :file:`*.dist-info`
directory by installers when installing a distribution from a requirement
specifying a direct URL reference (including a VCS URL).
This file MUST NOT be created when installing a distribution from an other
type of requirement (i.e. name plus version specifier).
This JSON file MUST be a UTF-8 encoded, :rfc:`8259` compliant, serialization of the
:doc:`direct-url-data-structure`.
.. note::
When the requested URL has the file:// scheme and points to a local directory that happens to contain a
VCS checkout, installers MUST NOT attempt to infer any VCS information and
therefore MUST NOT output any VCS related information (such as ``vcs_info``)
in :file:`direct_url.json`.
.. note::
As a general rule, installers should as much as possible preserve the
information that was provided in the requested URL when generating
:file:`direct_url.json`. For example user:password environment variables
should be preserved and ``requested_revision`` should reflect the revision that was
provided in the requested URL as faithfully as possible. This information is
however *enriched* with more precise data, such as ``commit_id``.
Example pip commands and their effect on direct_url.json
========================================================
Commands that generate a ``direct_url.json``:
* ``pip install https://example.com/app-1.0.tgz``
* ``pip install https://example.com/app-1.0.whl``
* ``pip install "app @ git+https://example.com/repo/app.git#subdirectory=setup"``
* ``pip install ./app``
* ``pip install file:///home/user/app``
* ``pip install --editable "app @ git+https://example.com/repo/app.git#subdirectory=setup"``
(in which case, ``url`` will be the local directory where the git repository has been
cloned to, and ``dir_info`` will be present with ``"editable": true`` and no
``vcs_info`` will be set)
* ``pip install -e ./app``
Commands that *do not* generate a ``direct_url.json``
* ``pip install app``
* ``pip install app --no-index --find-links https://example.com/``
History
=======
- March 2020: This specification was approved through :pep:`610`.