Skip to content

Commit 4a2c0b7

Browse files
authored
PEP 829: A few more updates (#4916)
A few more updates
1 parent 454541c commit 4a2c0b7

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

peps/pep-0829.rst

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -419,6 +419,35 @@ Open Issues
419419
to effectively ``W(.W)*:(W(.W)*)``, namely, rejecting the older, non-colon
420420
form, and making the callable after the colon required.
421421

422+
* ``site.addpackage()`` is an undocumented function that processes a single
423+
``.pth`` file. It is not listed in ``site.__all__``, not covered in
424+
`Doc/library/site.rst
425+
<https://github.com/python/cpython/blob/main/Doc/library/site.rst>`_, and
426+
has no stability guarantees. A GitHub code search found roughly half a
427+
dozen third-party projects calling it directly, mostly with the pattern
428+
``site.addpackage(dir, "apps.pth", set())`` — all of which can be replaced
429+
by ``site.addsitedir(dir)``.
430+
431+
During the work on the reference implementation, ``addpackage()`` becomes a
432+
thin wrapper around the new internal pipeline for processing ``.pth`` and
433+
``.start`` files. Maintaining it as a separate functions adds complexity
434+
for no documented use case. This function should be deprecated, with the
435+
suggestion that users migrate to ``addsitedir()`` instead, a documented
436+
public API.
437+
438+
* The PEP currently recommends a three year deprecation period on the
439+
*processing* of ``import`` lines in ``.pth`` files. Packages can straddle
440+
without warnings because the presence of a matching ``.start`` file
441+
disables warnings for ``import`` lines in ``.pth`` files *during the
442+
deprecation period*. However, as currently written, warnings will be
443+
re-enabled at the end of the deprecation period, so at that point there
444+
isn't a way to straddle without warnings.
445+
446+
The preferred solution is to simply hide all warnings for ``import`` lines
447+
in ``.pth`` files behind the ``-v`` (verbose) flag, either for a full 5 year
448+
period (keeping the 3 year *processing* deprecation timeline), or
449+
indefinitely.
450+
422451
* Should future ``-X`` options provide fine-grained control over error
423452
reporting or entry point execution?
424453

@@ -437,6 +466,9 @@ Change History
437466
when ``-v`` (verbose) is given.
438467
* Clarify that ``import`` lines in ``<name>.pth`` files where there is a
439468
matching ``<name>.start`` file are ignored.
469+
* Added some :ref:`open issues <open-issues>` around ``site.addpackage()``
470+
deprecation, and extending the suppression of ``import`` line warnings in
471+
``.pth`` files unless ``-v`` is given, for an additional two years.
440472

441473
`13-Apr-2026 <https://discuss.python.org/t/pep-829-structured-startup-configuration-files/106789/69>`__
442474

0 commit comments

Comments
 (0)