Skip to content

Commit a76684e

Browse files
committed
Updates based on Brett's feedback
1 parent 63e74cc commit a76684e

File tree

1 file changed

+45
-34
lines changed

1 file changed

+45
-34
lines changed

peps/pep-0829.rst

Lines changed: 45 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -70,53 +70,62 @@ Specification
7070

7171
This PEP proposes the following:
7272

73-
* Keep the ``.pth`` file format, but deprecate ``import`` line
74-
processing for three years, after which such lines will be
75-
disallowed.
73+
* Keep the ``<name>.pth`` file format, but deprecate ``import`` line
74+
processing for three years, after which such lines will be disallowed.
75+
76+
* Keep the current ``sys.path`` extension feature of ``<name>.pth`` files
77+
unchanged. Specifically, absolute paths are used verbatim while relative
78+
paths are anchored at the directory in which the ``.pth`` file is located.
79+
80+
* A new file format called ``<name>.start`` files are added which names entry
81+
points conforming to the "colon-form" of :func:`pkgutil.resolve_name`
82+
arguments.
7683

7784
* During the deprecation period, the presence of a ``<name>.start`` file
7885
matching a ``<name>.pth`` file disables the execution of ``import`` lines in
79-
favor of entry points. This provides a migration path straddling Python
80-
versions which support this PEP and earlier versions which do not. See the
81-
:ref:`teach` section for specific migration guidelines.
86+
the ``<name>.pth`` file in favor of entry points from the ``<name>.start``
87+
file. This provides a migration path straddling Python versions which
88+
support this PEP and earlier versions which do not.
8289

83-
* Keep the current ``sys.path`` extension feature of ``.pth`` files
84-
unchanged. Specifically, absolute paths are used verbatim while
85-
relative paths are anchored at the directory in which the ``.pth``
86-
file is located.
90+
During the deprecation period, for any ``<name>.pth`` file without a
91+
matching ``<name>.start`` file, the processing of the former is unchanged (a
92+
warning about ``import`` lines may be printed). After the deprecation
93+
period ``import`` lines in ``<name>.pth`` files are ignored and a warning is
94+
issued, regardless of whether there is a matching ``<name>.start`` file or
95+
not.
8796

88-
* A new file format called ``.start`` files are added which names entry points
89-
conforming to the "colon-form" of :func:`pkgutil.resolve_name` arguments.
97+
See the :ref:`teach` section for specific migration guidelines.
9098

9199
``site.py`` start up code is divided into these explicit phases:
92100

93-
#. List all ``.pth`` files and sort in alphabetical order by filename.
101+
#. Find the ``<name>.pth`` files (see :ref:`discovery` for additional details)
102+
and sort them in alphabetical order by filename.
94103

95-
#. Parse ``.pth`` files in sorted order, keeping a global sorted list of all
96-
path extensions, de-duplicating entries (first one wins). Record the
97-
``.pth`` file the extension is found in (data structure TBD but documented).
104+
#. Parse the ``<name>.pth`` files in sorted order, keeping a global sorted
105+
list of all path extensions, ignoring duplicates.
98106

99-
#. *Future extension:* apply :ref:`global policy filter <future>` on sorted
100-
list of path extensions.
107+
#. *Future extension:* apply a :ref:`global policy filter <future>` on the
108+
sorted list of path extensions.
101109

102110
#. Append path extensions in sorted order to ``sys.path``.
103111

104-
#. List all ``.start`` files and sort in alphabetical order by filename.
112+
#. List all ``<name>.start`` files (see :ref:`discovery` for additional
113+
details) and sort them in alphabetical order by filename.
105114

106-
#. Parse ``.start`` files in sorted order, keeping a global sorted list of all
107-
entry points, de-duplicating entries (first one wins). Record the
108-
``.start`` file the entry point is found in (data structure TBD but
109-
documented).
115+
#. Parse the ``<name>.start`` files in sorted order, keeping a global sorted
116+
list of all entry points, ignoring duplicates.
110117

111-
#. *Future extension:* :ref:`apply global policy filter <future>` on sorted
112-
list of entry points.
118+
#. *Future extension:* apply a :ref:`global policy filter <future>` on the
119+
sorted list of entry points.
113120

114121
#. For each entry point, use :func:`pkgutil.resolve_name` to resolve the entry
115122
point into a callable. Call the entry point with no arguments.
116123

117-
For both ``.pth`` files and ``.start`` files, comment lines (i.e. lines
118-
beginning with ``#`` as the first non-whitespace character) and blank lines
119-
are ignored. Any other parsing error causes the line to be ignored.
124+
In both ``<name>.pth`` files and ``<name>.start`` files, comment lines
125+
(i.e. lines beginning with ``#`` as the first non-whitespace character) and
126+
blank lines are ignored. Any other parsing error causes the line to be
127+
ignored.
128+
120129

121130
.. _ep-syntax:
122131

@@ -136,6 +145,8 @@ requires that the callable be specified. See the :ref:`open issues
136145
<open-issues>` for further discussion.
137146

138147

148+
.. _discovery:
149+
139150
File Naming and Discovery
140151
-------------------------
141152

@@ -151,9 +162,9 @@ File Naming and Discovery
151162
``<name>.pth`` files are found today. The ``<name>.pth`` location stays the
152163
same.
153164

154-
* The discovery rules for ``<name>.site.toml`` files is the same as
155-
``<name>.pth`` files today. File names that start with a single ``.``
156-
(e.g. ``.start``) and files with OS-level hidden attributes (``UF_HIDDEN``,
165+
* The discovery rules for ``<name>.start`` files is the same as ``<name>.pth``
166+
files today. File names that start with a single ``.`` (e.g. ``.start``)
167+
and files with OS-level hidden attributes (``UF_HIDDEN``,
157168
``FILE_ATTRIBUTE_HIDDEN``) are excluded.
158169

159170

@@ -378,9 +389,9 @@ Change History
378389

379390
XX-XXX-2026
380391

381-
* An evolution of the ``.pth`` file format and the addition of the ``.start``
382-
file for entry point specification is proposed instead of the ``site.toml``
383-
file from the previous draft.
392+
* An evolution of the ``<name>.pth`` file format and the addition of the
393+
``<name>.start`` file for entry point specification is proposed instead of
394+
the ``<name>.site.toml`` file from the previous draft.
384395

385396

386397
Acknowledgments

0 commit comments

Comments
 (0)