@@ -21,12 +21,14 @@ History and change workflow
2121===========================
2222
2323The metadata described here was first specified in :pep: `376 `, and later
24- amended in :pep: `627 `.
24+ amended in :pep: `627 ` (and other PEPs) .
2525It was formerly known as *Database of Installed Python Distributions *.
26- Further amendments (except trivial language or typography fixes) must be made
27- through the PEP process (see :pep: `1 `).
26+ As with other PyPA specifications, editorial amendments with no functional
27+ impact may be made through the GitHub pull request workflow. Proposals for
28+ functional changes that would require amendments to package building and/or
29+ installation tools must be made through the PEP process (see :pep: `1 `).
2830
29- While this document is the normative specification, these PEPs that introduce
31+ While this document is the normative specification, the PEPs that introduce
3032changes to it may include additional information such as rationales and
3133backwards compatibility considerations.
3234
@@ -66,12 +68,14 @@ encouraged to start normalizing those fields.
6668 provide API for such tools to consume, so tools can have access to the
6769 unnormalized name when displaying distrubution information.
6870
69- This ``.dist-info `` directory can contain these files, described in detail
70- below:
71+ This ``.dist-info `` directory may contain the following files, described in
72+ detail below:
7173
7274* ``METADATA ``: contains project metadata
7375* ``RECORD ``: records the list of installed files.
7476* ``INSTALLER ``: records the name of the tool used to install the project.
77+ * ``entry_points.txt ``: see :ref: `entry-points ` for details
78+ * ``direct_url.json ``: see :ref: `direct-url ` for details
7579
7680The ``METADATA `` file is mandatory.
7781All other files may be omitted at the installing tool's discretion.
@@ -169,7 +173,7 @@ Here is an example snippet of a possible ``RECORD`` file::
169173
170174If the ``RECORD `` file is missing, tools that rely on ``.dist-info `` must not
171175attempt to uninstall or upgrade the package.
172- (This does not apply to tools that rely on other sources of information,
176+ (This restriction does not apply to tools that rely on other sources of information,
173177such as system package managers in Linux distros.)
174178
175179
@@ -197,6 +201,18 @@ For example, if a tool is asked to uninstall a project but finds no ``RECORD``
197201file, it may suggest that the tool named in ``INSTALLER `` may be able to do the
198202uninstallation.
199203
204+
205+ The entry_points.txt file
206+ =========================
207+
208+ This file MAY be created by installers to indicate when packages contain
209+ components intended for discovery and use by other code, including console
210+ scripts and other applications that the installer has made available for
211+ execution.
212+
213+ Its detailed specification is at :ref: `entry-points `.
214+
215+
200216The direct_url.json file
201217========================
202218
@@ -207,3 +223,32 @@ This file MUST NOT be created when installing a distribution from an other type
207223of requirement (i.e. name plus version specifier).
208224
209225Its detailed specification is at :ref: `direct-url `.
226+
227+
228+ Intentionally preventing changes to installed packages
229+ ======================================================
230+
231+ In some cases (such as when needing to manage external dependencies in addition
232+ to Python ecosystem dependencies), it is desirable for a tool that installs
233+ packages into a Python environment to ensure that other tools are not used to
234+ uninstall or otherwise modify that installed package, as doing so may cause
235+ compatibility problems with the wider environment.
236+
237+ To achieve this, affected tools should take the folllowing steps:
238+
239+ * Rename or remove the ``RECORD `` file to prevent changes via other tools (e.g.
240+ appending a suffix to create a non-standard ``RECORD.tool `` file if the tool
241+ itself needs the information, or omitting the file entirely if the package
242+ contents are tracked and managed via other means)
243+ * Write an ``INSTALLER `` file indicating the name of the tool that should be used
244+ to manage the package (this allows ``RECORD ``-aware tools to provide better
245+ error notices when asked to modify affected packages)
246+
247+ Python runtime providers may also prevent inadvertent modification of platform
248+ provided packages by modifying the default Python package installation scheme
249+ to use a location other than that used by platform provided packages (while also
250+ ensuring both locations appear on the default Python import path).
251+
252+ In some circumstances, it may be desirable to block even installation of
253+ additional packages via Python-specific tools. For these cases refer to
254+ :ref: `externally-managed-environments `
0 commit comments