@@ -33,7 +33,7 @@ support two functions:
3333 anchored at the site-packages directory.
3434
3535#. **Executing code ** -- lines starting with ``import `` (or
36- ``import\\t ``) are executed immediate by passing the source string
36+ ``import\\t ``) are executed immediately by passing the source string
3737 to ``exec() ``.
3838
3939This design has several problems:
@@ -107,7 +107,7 @@ File Naming and Discovery
107107 behavior.
108108
109109* If both ``<package>.site.toml `` and ``<package>.pth `` exist in the same
110- directory, only the ``.site.toml `` file is processed.
110+ directory, only the ``<package> .site.toml `` file is processed.
111111
112112
113113Processing Model
@@ -152,7 +152,7 @@ entry point imports and ``<package>.pth`` import lines.
152152A ``<package>.site.toml `` file is defined to have three sections, all of which
153153are optional:
154154
155- .. _ code -block : toml
155+ .. code -block: : toml
156156
157157 [metadata]
158158 schema_version = 1
@@ -181,9 +181,9 @@ Defined keys:
181181 The TOML file schema version number. Must be the integer ``1 `` for this
182182 specification. If present, Python guarantees forward-compatible handling:
183183 future versions will either process the file according to the declared
184- schema or skip it with a clear diagnostic. It is an error if the
185- ``schema_version `` is present but has an unsupported value, the entire
186- file is skipped. If ``schema_version `` is omitted, the file is processed
184+ schema or skip it with a clear diagnostic. If the
185+ ``schema_version `` is present but has an unsupported value, the
186+ entire file is skipped. If ``schema_version `` is omitted, the file is processed
187187 on a best-effort basis with no forward-compatibility guarantees.
188188
189189Recommended keys:
@@ -279,7 +279,15 @@ Errors are handled differently depending on the phase:
279279Phase 1: Reading and Parsing
280280 If a ``<package>.site.toml `` file cannot be opened, decoded, or parsed as
281281 valid TOML, it is skipped and processing continues to the next file.
282- Errors are reported only when ``-v `` (verbose) is given.
282+ Errors are reported only when ``-v `` (verbose) is given. Importantly,
283+ a ``<package>.site.toml `` file that fails to parse **still supersedes **
284+ its corresponding ``<package>.pth `` file. The existence of the
285+ ``<package>.site.toml `` file is sufficient to suppress
286+ ``<package>.pth `` processing, regardless of whether the TOML file
287+ parses successfully. This prevents confusing dual-execution
288+ scenarios and ensures that a broken ``<package>.site.toml `` is
289+ noticed rather than silently masked by fallback to the
290+ ``<package>.pth `` file.
283291
284292Phase 2: Execution
285293 If a path entry or entry point raises an exception during processing, the
@@ -404,23 +412,23 @@ If your package currently ships a ``<package>.pth`` file, you can migrate to a
404412``<package>.site.toml `` file. The equivalent of a ``<package>.pth `` file
405413containing a directory name is:
406414
407- .. _ code -block : toml
415+ .. code -block: : toml
408416
409417 [paths]
410418 dirs = ["my_directory"]
411419
412420 The equivalent of a ``<package>.pth `` file containing ``import my_package ``
413421is:
414422
415- .. _ code -block : toml
423+ .. code -block: : toml
416424
417425 [entrypoints]
418426 init = ["my_package"]
419427
420428 If your ``<package>.pth `` file calls a specific function, use the
421429``module:callable `` syntax:
422430
423- .. _ code -block : toml
431+ .. code -block: : toml
424432
425433 [entrypoints]
426434 init = ["my_package.startup:initialize"]
@@ -429,7 +437,7 @@ If your ``<package>.pth`` file includes arbitrary code, put that code in a
429437start up function and use the ``module:callable `` syntax.
430438
431439Both ``<package>.pth `` and ``<package>.site.toml `` can coexist during
432- migration. If both exist for the same package, only the ``.site.toml `` is
440+ migration. If both exist for the same package, only the ``<package> .site.toml `` is
433441processed. Thus, it is recommended that packages compatible with older
434442Pythons ship both files.
435443
0 commit comments