From 553b700ebe00cb0f72be3251cb866e52ca78f4ca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Edgar=20Ram=C3=ADrez=20Mondrag=C3=B3n?= <16805946+edgarrmondragon@users.noreply.github.com> Date: Wed, 4 Sep 2024 20:50:48 -0600 Subject: [PATCH] docs: Add a few intersphinx links to the Python Packaging User Guide (#804) * Add a few intersphinx links to the Python Packaging User Guide * docs: fix forward reference * Update _types.py --------- Co-authored-by: Henry Schreiner --- docs/conf.py | 1 + docs/index.rst | 5 +++-- src/build/_types.py | 7 ++++++- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/docs/conf.py b/docs/conf.py index ebdd217a..46caa97c 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -40,6 +40,7 @@ intersphinx_mapping = { 'python': ('https://docs.python.org/3/', None), + 'packaging': ('https://packaging.python.org/en/latest/', None), } # Add any paths that contain templates here, relative to this directory. diff --git a/docs/index.rst b/docs/index.rst index ac222f39..1ce74d96 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -4,10 +4,11 @@ build ***** -A simple, correct Python packaging build frontend. +A simple, correct Python packaging :std:term:`build frontend `. build manages ``pyproject.toml``-based builds, invoking -build-backend hooks as appropriate to build a distribution package. +:std:term:`build-backend ` hooks as appropriate to build a +:std:term:`distribution package `. It is a simple build tool and does not perform any dependency management. .. sphinx_argparse_cli:: diff --git a/src/build/_types.py b/src/build/_types.py index ac363581..8d7bdd8a 100644 --- a/src/build/_types.py +++ b/src/build/_types.py @@ -1,6 +1,7 @@ from __future__ import annotations import os +import sys import typing @@ -8,7 +9,11 @@ ConfigSettings = typing.Mapping[str, typing.Union[str, typing.Sequence[str]]] Distribution = typing.Literal['sdist', 'wheel', 'editable'] -StrPath = typing.Union[str, 'os.PathLike[str]'] + +if typing.TYPE_CHECKING or sys.version_info > (3, 9): + StrPath = typing.Union[str, os.PathLike[str]] +else: + StrPath = typing.Union[str, os.PathLike] if typing.TYPE_CHECKING: from pyproject_hooks import SubprocessRunner