File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -183,6 +183,29 @@ See :pep:`829` for the full specification.
183183 file are ignored in favour of the entry points in the :file: `.start `
184184 file.
185185
186+ .. _site-migration-guide :
187+
188+ Migrating from ``import `` lines in ``.pth `` files to ``.start `` files
189+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
190+
191+ If your package currently ships a :file: `{ name } .pth ` file, you can keep all
192+ ``sys.path `` extension lines unchanged. Only ``import `` lines need to be
193+ migrated.
194+
195+ To migrate, create a callable (taking zero arguments) within an importable
196+ module in your package. Reference it as a ``pkg.mod:callable `` entry point
197+ in a matching :file: `{ name } .start ` file.
198+
199+ If your package must straddle older Pythons that do not support :pep: `829 `
200+ and newer Pythons that do, change the ``import `` lines in your
201+ :file: `{ name } .pth ` to use the following form::
202+
203+ import pkg.mod; pkg.mod.callable()
204+
205+ Older Pythons will execute these ``import `` lines, while newer Pythons will
206+ ignore them in favor of the :file: `{ name } .start ` file. After the straddling
207+ period, remove all ``import `` lines from your :file: `.pth ` file.
208+
186209
187210:mod: `!sitecustomize `
188211---------------------
You can’t perform that action at this time.
0 commit comments