diff --git a/README.md b/README.md index fc6d8a39..1a5e815f 100644 --- a/README.md +++ b/README.md @@ -20,15 +20,14 @@ Unwanted files must be excluded via `MANIFEST.in`. The preferred way to configure [setuptools-scm] is to author settings in a `tool.setuptools_scm` section of `pyproject.toml`. -This feature requires setuptools 60 or later. +This feature requires setuptools 61 or later. First, ensure that [setuptools-scm] is present during the project's build step by specifying it as one of the build requirements. -```toml +```toml title="pyproject.toml" [build-system] -requires = [ - "setuptools>=60", - "setuptools-scm>=8.0"] +requires = ["setuptools>=64", "setuptools_scm>=8"] +build-backend = "setuptools.build_meta" ``` That will be sufficient to require [setuptools-scm] for projects @@ -46,6 +45,7 @@ dynamically in the `project` section of `pyproject.toml`: [project] # version = "0.0.1" # Remove any existing version parameter. dynamic = ["version"] + [tool.setuptools_scm] ``` diff --git a/docs/customizing.md b/docs/customizing.md index 9236531d..b4bc7a15 100644 --- a/docs/customizing.md +++ b/docs/customizing.md @@ -31,13 +31,10 @@ setup(use_scm_version={"version_scheme": myversion_func}) ``` -``` { .python title="pyproject.toml" file="docs/examples/version_scheme_code/pyproject.toml" } +``` { .toml title="pyproject.toml" file="docs/examples/version_scheme_code/pyproject.toml" } [build-system] -requires = [ - "setuptools>=64", - "setuptools_scm>=8", - "wheel", -] +requires = ["setuptools>=64", "setuptools_scm>=8"] +build-backend = "setuptools.build_meta" [project] name = "scm-example" @@ -49,9 +46,6 @@ dynamic = [ ``` - [ ] add a build block that adds example output -- [ ] correct config after [entangled mkdocs bug] is fixed - -[entangled mkdocs bug]: https://github.com/entangled/mkdocs-plugin/issues/1 diff --git a/docs/examples/version_scheme_code/pyproject.toml b/docs/examples/version_scheme_code/pyproject.toml index 05da2f60..10ef31d4 100644 --- a/docs/examples/version_scheme_code/pyproject.toml +++ b/docs/examples/version_scheme_code/pyproject.toml @@ -1,10 +1,7 @@ # ~/~ begin <>[init] [build-system] -requires = [ - "setuptools>=64", - "setuptools_scm>=8", - "wheel", -] +requires = ["setuptools>=64", "setuptools_scm>=8"] +build-backend = "setuptools.build_meta" [project] name = "scm-example" diff --git a/docs/index.md b/docs/index.md index d1c3995e..eff1bc94 100644 --- a/docs/index.md +++ b/docs/index.md @@ -17,14 +17,11 @@ Note: `setuptools_scm>=8` intentionally doesn't depend on setuptools to ease non Please ensure a recent version of setuptools (>=64) is installed. -```toml -# pyproject.toml +```toml title="pyproject.toml" [build-system] -requires = [ - "setuptools>=64", - "setuptools_scm>=8", - "wheel", -] +requires = ["setuptools>=64", "setuptools_scm>=8"] +build-backend = "setuptools.build_meta" + [project] name = "example" # Important: Remove any existing version declaration diff --git a/docs/usage.md b/docs/usage.md index 83927963..bd0bc7b6 100644 --- a/docs/usage.md +++ b/docs/usage.md @@ -7,10 +7,10 @@ settings in the `tool.setuptools_scm` section of `pyproject.toml`. It's necessary to use a setuptools version released after 2022. -```toml -# pyproject.toml +```toml title="pyproject.toml" [build-system] -requires = ["setuptools>=62", "setuptools_scm[toml]>=8.0"] +requires = ["setuptools>=64", "setuptools_scm>=8"] +build-backend = "setuptools.build_meta" [project] # version = "0.0.1" # Remove any existing version parameter. @@ -27,8 +27,7 @@ Tools that still invoke `setup.py` must ensure build requirements are installed ### version files -```toml -# pyproject.toml +```toml title="pyproject.toml" ... [tool.setuptools_scm] version_file = "pkg/_version.py" @@ -108,8 +107,7 @@ you can retrieve it at runtime from PEP-0566_ metadata using ``importlib.metadata`` from the standard library (added in Python 3.8) or the `importlib_metadata`_ backport: -```python -# contents of package_name/__init__.py +```python title="package_name/__init__.py" from importlib.metadata import version, PackageNotFoundError try: @@ -257,7 +255,7 @@ be kept in version control. It's strongly recommended to be put into gitignore. -### File finders hook makes most of MANIFEST.in unnecessary +### File finders hook makes most of `MANIFEST.in` unnecessary `setuptools_scm` implements a [file_finders] entry point which returns all files tracked by your SCM.