PEP 648: Add entry points as rejected alternative (#1784)
This commit is contained in:
parent
54a71cd7c3
commit
dc57e02ccd
22
pep-0648.rst
22
pep-0648.rst
|
@ -94,8 +94,10 @@ Rationale
|
|||
|
||||
This PEP proposes supporting extensible customization of the interpreter at
|
||||
startup by allowing users to install scripts into a folder named
|
||||
``__sitecustomize__`` located in a site path. Those scripts will be executed
|
||||
at startup time.
|
||||
``__sitecustomize__`` located in any site path. Those scripts will be executed
|
||||
at startup time. The implementation will take advantage of the fact that all
|
||||
site paths are already being walked to look for ``pth`` files to include also a
|
||||
check for ``__sitecustomize__`` folders and execute all scripts within them.
|
||||
|
||||
The ``site`` module will expose an option on its main function that allows
|
||||
listing all scripts that will be executed, which will allow users to quickly
|
||||
|
@ -271,6 +273,22 @@ Support for shutdown custom scripts
|
|||
could also add code at shutdown, but extra support for that is not needed, as
|
||||
Python users can already do that via ``atexit``.
|
||||
|
||||
Using entry_points
|
||||
------------------
|
||||
|
||||
We considered extending the use of entry points to allow specifying scripts
|
||||
that should be executed at startup but we discarded that solution due to two
|
||||
main reasons. The first one being impact on startup time. This approach will
|
||||
require scanning all packages distribution information to just execute a
|
||||
handful of files. This has an impact on performance even if the user is not
|
||||
using the feature and such impact growths linearly with the number of packages
|
||||
installed in the environment. The second reason was that the proposed
|
||||
implementation in this PEP offers a single solution for startup customization
|
||||
for packages and system administrators. Additionally, if the main objective of
|
||||
entry points is to make it easy for libraries to install scripts at startup,
|
||||
that can still be added and make the build backends just install the files
|
||||
within the ``__sitecustomize__`` folder.
|
||||
|
||||
Copyright
|
||||
=========
|
||||
|
||||
|
|
Loading…
Reference in New Issue