Skip to content

Commit 9dff8f2

Browse files
update docs
1 parent 1bea2c9 commit 9dff8f2

File tree

2 files changed

+26
-36
lines changed

2 files changed

+26
-36
lines changed

docs/config.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,12 @@
22

33
## When is configuration needed?
44

5-
Starting with setuptools-scm 8.1+, explicit configuration is **optional** in many cases:
5+
Starting with setuptools-scm 9.0, explicit configuration is required to enable
6+
version inference, either via the `[tool.setuptools_scm]` section or the
7+
`use_scm_version` setup keyword. Listing `setuptools_scm` in `build-system.requires`
8+
and declaring `project.dynamic = ["version"]` no longer auto-enables inference.
69

7-
- **No configuration needed**: If `setuptools_scm` (or `setuptools-scm`) is in your `build-system.requires`, setuptools-scm will automatically activate with sensible defaults.
8-
9-
- **Configuration recommended**: Use the `[tool.setuptools_scm]` section when you need to:
10+
Use the `[tool.setuptools_scm]` section when you need to:
1011
- Write version files (`version_file`)
1112
- Customize version schemes (`version_scheme`, `local_scheme`)
1213
- Set custom tag patterns (`tag_regex`)

docs/usage.md

Lines changed: 21 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -7,30 +7,11 @@
77
Support for setuptools <80 is deprecated and will be removed in a future release.
88
The examples below use `setuptools>=80` as the recommended version.
99

10-
There are two ways to configure `setuptools-scm` at build time, depending on your needs:
10+
There are two ways to enable `setuptools-scm` at build time:
1111

12-
### Automatic Configuration (Recommended for Simple Cases)
12+
### Explicit Configuration (required)
1313

14-
For projects that don't need custom configuration, simply include `setuptools-scm`
15-
in your build requirements:
16-
17-
```toml title="pyproject.toml"
18-
[build-system]
19-
requires = ["setuptools>=80", "setuptools-scm>=8"]
20-
build-backend = "setuptools.build_meta"
21-
22-
[project]
23-
# version = "0.0.1" # Remove any existing version parameter.
24-
dynamic = ["version"]
25-
```
26-
27-
**That's it!** Starting with setuptools-scm 8.1+, if `setuptools_scm` (or `setuptools-scm`)
28-
is present in your `build-system.requires`, setuptools-scm will automatically activate
29-
with default settings.
30-
31-
### Explicit Configuration
32-
33-
If you need to customize setuptools-scm behavior, use the `tool.setuptools_scm` section:
14+
Add a `tool.setuptools_scm` section to explicitly opt-in to version inference:
3415

3516
```toml title="pyproject.toml"
3617
[build-system]
@@ -51,20 +32,28 @@ pre_parse = "fail_on_missing_submodules" # Fail if submodules are not initializ
5132
describe_command = "git describe --dirty --tags --long --exclude *js*" # Custom describe command
5233
```
5334

54-
Both approaches will work with projects that support PEP 518 ([pip](https://pypi.org/project/pip) and
55-
[pep517](https://pypi.org/project/pep517/)).
56-
Tools that still invoke `setup.py` must ensure build requirements are installed
35+
Projects must support PEP 518 ([pip](https://pypi.org/project/pip) and
36+
[pep517](https://pypi.org/project/pep517/)). Tools that still invoke `setup.py`
37+
must ensure build requirements are installed.
38+
39+
### Using the setup keyword
40+
41+
Alternatively, enable `setuptools-scm` via the `use_scm_version` keyword in `setup.py`.
42+
This also counts as an explicit opt-in and does not require a tool section.
5743

58-
!!! info "How Automatic Detection Works"
44+
!!! warning "Simplified activation removed"
5945

60-
When setuptools-scm is listed in `build-system.requires`, it automatically detects this during the build process and activates with default settings. This means:
46+
Previous documentation described a "simplified" activation where listing
47+
`setuptools_scm` in `build-system.requires` together with `project.dynamic = ["version"]`
48+
would auto-enable version inference. This behavior has been removed due to
49+
regressions and ambiguous activation. You must explicitly opt in via either:
6150

62-
- ✅ **Automatic activation**: No `[tool.setuptools_scm]` section needed
63-
- ✅ **Default behavior**: Uses standard version schemes and SCM detection
64-
- ✅ **Error handling**: Provides helpful error messages if configuration is missing
65-
- ⚙️ **Customization**: Add `[tool.setuptools_scm]` section when you need custom options
51+
- a `[tool.setuptools_scm]` section, or
52+
- the `use_scm_version` setup keyword.
6653

67-
Both package names are detected: `setuptools_scm` and `setuptools-scm` (with dash).
54+
The presence of `setuptools_scm` (or `setuptools-scm`) in `build-system.requires`
55+
is still recommended to ensure the dependency is available during builds, but it
56+
no longer enables version inference by itself.
6857

6958
### Version files
7059

0 commit comments

Comments
 (0)