Migrate typing documentation to `pyproject.toml`
Documentation
The official typing documentation recommends using a setup.py without pyproject.toml (https://typing.python.org/en/latest/guides/libraries.html#companion-type-stub-package, Doc/library/typing.rst). This relies on pre-PEP 621 fallback behavior, while we should teach users to follow PEP 621 and use pyproject.toml. Can we migrate this documentation to use pyproject.toml, including [project] and build-system] as well as [tool.*] for configuration?
The documentation at from packaging.python.org has a tab selection for different build backends, with a default of hatchling instead of setuptools (https://packaging.python.org/en/latest/tutorials/packaging-projects/#choosing-a-build-backend). We found that this is easier to work with than setuptools. A possible alternative would be having the same tabs on typing.python.org (I don't know if that's supported in the renderer), or to move the packaging part of the documentation to packaging.python.org.
It makes sense to me to modernize the instructions to use pyproject.toml.
Yes makes perfect sense. I have a personal preference not to use setup.py, and still remember needing to quite a bit of searching and trail and error before getting it right.
Having samples for a few different backends will help clarify what to configure where. I would suggest a few useful options such as :
[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"
[tool.hatch.build.targets.wheel]
only-include = ["foo", "bar"]
exclude = ["*.py"]