You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+22-5Lines changed: 22 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -76,7 +76,8 @@ Configure in `pyproject.toml` under `[tool.conan-py-build]`:
76
76
77
77
| Option | Description | Default |
78
78
|--------|-------------|---------|
79
-
|`version-file`| Path to a Python file from which to read `__version__` when `[project].version` is dynamic | (none) |
79
+
|`version.file`| Path to a Python file containing `__version__ = "x.y.z"` (see [Dynamic version](#dynamic-version)) | (none) |
80
+
|`version.provider`| Set to `"setuptools_scm"` to resolve version from git tags (see [Dynamic version](#dynamic-version)). Mutually exclusive with `version.file`. | (none) |
80
81
|`conanfile-path`| Path to the Conan recipe (directory containing `conanfile.py` or path to the file), relative to project root |`"."` (project root) |
81
82
|`wheel.packages`| List of paths (relative to project root) of Python packages to include in the wheel; each must be a directory with `__init__.py`|`["src/<normalized_project_name>"]`|
82
83
|`sdist.include`| List of paths or patterns to add to the sdist |`[]`|
@@ -85,10 +86,26 @@ Configure in `pyproject.toml` under `[tool.conan-py-build]`:
85
86
86
87
### Dynamic version
87
88
88
-
There is limited support for dynamic version: set `dynamic = ["version"]` in
89
-
`[project]` (no `version` key) and point to a Python file via
90
-
`[tool.conan-py-build].version-file` (e.g. `"src/mypackage/__init__.py"`). The
91
-
backend reads `__version__ = "x.y.z"` from that file.
89
+
Set `dynamic = ["version"]` in `[project]` (no `version` key) and configure the version source in `[tool.conan-py-build.version]`:
90
+
91
+
**From a file** — reads `__version__ = "x.y.z"` from a Python file:
92
+
93
+
```toml
94
+
[tool.conan-py-build.version]
95
+
file = "src/mypackage/__init__.py"
96
+
```
97
+
98
+
**From git tags (setuptools-scm)** — resolves version from VCS tags (e.g. `v1.0.0` → `1.0.0`):
99
+
100
+
```toml
101
+
[tool.conan-py-build.version]
102
+
provider = "setuptools_scm"
103
+
```
104
+
105
+
The `setuptools-scm` options are configured in `[tool.setuptools_scm]` — see the
106
+
[setuptools-scm docs](https://setuptools-scm.readthedocs.io/) for available options.
107
+
108
+
> **Note:**`version.file` and `provider = "setuptools_scm"` are mutually exclusive.
0 commit comments