Rodrigo Girão Serrão: Startup ... Note

Rodrigo Girão Serrão: Startup configuration files

Python 3.15 introduces startup configuration files with a .start extension to execute package entry points upon interpreter startup. These entry points function similarly to import statements, specifying a module followed by a colon and a callable function. For instance, error_links:install directs the interpreter to call the install function within the error_links module. This new feature builds upon the functionality of the standard library's site module, which automatically runs on startup. Historically, .pth files were used to extend Python's module search path and could also contain import lines. However, import lines in .pth files presented security risks. PEP 829 addressed this by introducing a more secure method for running custom startup code. Consequently, import lines in .pth files are now deprecated in favor of .start files in Python 3.15 and later. Python 3.15 offers a range of enhancements, including built-in types, lazy imports, improved typing, and more visual features. The "15 days of Python 3.15" series provides daily explanations of these new features.
CdXz5zHNQW_88iLQz2pFM.webp