gh-148641: Implement PEP 829 - startup configuration files#149109
gh-148641: Implement PEP 829 - startup configuration files#149109warsaw merged 58 commits intopython:mainfrom
Conversation
It's okay to be missing, but if it's given it must be an expected version (i.e. currently, 1).
* Add _print_error() helper function for printing exceptions to sys.stderr. These are not hidden behind -v * `warnings` can be lazy imported. * Since the site.toml file is no longer proposed, rewrite how .pth and .start files are parsed and processed. * addpackage() -- which was never documented -- is deprecated; there are a few usages in the wild so we can't get rid of it, but it's generally unnecessary now, has different semantics. * Update tests
Documentation build overview
54 files changed ·
|
|
Thanks for making the requested changes! @brettcannon: please review the changes made to this pull request. |
ncoghlan
left a comment
There was a problem hiding this comment.
Huzzah! However, I have some backwards compatibility concerns with the details of the site module changes (basically, I don't think we can reasonably semantically overload known_paths=None to avoid adding a new keyword parameter to addsitedir, and potentially not even to addsitepackages or addusersitepackages)
|
When you're done making the requested changes, leave the comment: |
* flush_pth_start() -> process_startup_files() * Move around some versionchanged and deprecated-removed sections * Add: kw-only arg `defer_processing_start_files` in several places to ensure that the reverse-engineered semantics of the undocumented functions are preserved.
|
I have made the requested changes; please review again |
|
Thanks for making the requested changes! @brettcannon, @ncoghlan: please review the changes made to this pull request. |
|
I just saw this after resolving all the previous comments.
Please take a look at the updates I just pushed. I see what you’re suggesting, although that does seem like a larger change to make. See what you think of the current PR branch.
… On May 2, 2026, at 18:38, Alyssa Coghlan ***@***.***> wrote:
@ncoghlan commented on this pull request.
In Lib/site.py:
> if reset:
+ flush_pth_start()
Yeah, I didn't see a way to reliably infer the intent from the existing args, hence suggesting a new keyword arg.
That has the benefit of letting sitecustomize and usercustomize authors invoke similar batch processing behaviour.
The other way we could do it is instead of passing in a keyword boolean and updating global variables, we could instead define a StartupFiles helper class with the pending sets on each instance, and accept a pending_startup: StartupFiles | None parameter on each of the functions that modify the pending sets. Then actually running the startup files would be a StartupFiles.process instance method rather than a new module level function. (I only thought of that approach just now, otherwise I would have suggested it in my review comments)
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you authored the thread.Message ID: ***@***.***>
|
|
Argh! Sorry for the typo in the review dismissal. GH doesn't actually autocomplete in that dialog and it can't be edited. Approval was received from @ncoghlan |
📚 Documentation preview 📚: https://cpython-previews--149109.org.readthedocs.build/