Skip to content

Be nicer about possible misconfigurations #1004

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 109 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
109 commits
Select commit Hold shift + click to select a range
771046c
cli: extend ls comand for more info
con-f-use Oct 14, 2023
263dc5b
a few fixes and tests
thejcannon Jan 18, 2024
4497912
newline
thejcannon Jan 18, 2024
90810a3
space
thejcannon Jan 18, 2024
d9b4d24
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jan 18, 2024
cdcc699
pre-commit
thejcannon Jan 18, 2024
5f20c3e
fix bad string
thejcannon Jan 18, 2024
a23d5fe
Add a "only-version" version scheme (#1005)
thejcannon Jan 19, 2024
27ae4d8
chore: hg file finder - use check=True api
RonnyPfannschmidt Jan 5, 2024
2fa7927
chore: has_command - use default timeout automatically
RonnyPfannschmidt Jan 5, 2024
2ac4f08
fix #957 - add subprocess timeout
RonnyPfannschmidt Jan 5, 2024
9193ec9
chore: add exception info to warning logging
RonnyPfannschmidt Jan 5, 2024
027a52d
begin to address #993 - add normcase
RonnyPfannschmidt Jan 8, 2024
6c8c164
fixup #957 - timeout passover for git
RonnyPfannschmidt Jan 8, 2024
b85281d
chore: add py3.12 in tox.ini and add wheel
RonnyPfannschmidt Jan 8, 2024
0c22186
fix #966 - list all variables for version file templates
RonnyPfannschmidt Jan 8, 2024
1ecf351
fix #960: add a ``--force-write-version-files`` flag for the cli
RonnyPfannschmidt Jan 8, 2024
517ed80
fix #953 - info log level for missing tool section
RonnyPfannschmidt Jan 8, 2024
24bb92d
fix #993 and add a test
RonnyPfannschmidt Jan 8, 2024
c9d1bb2
chore: pass correct parameter name fo cli fallback
RonnyPfannschmidt Feb 15, 2024
fa84748
chore: consistently use kwonly args inside config.from_data
RonnyPfannschmidt Feb 15, 2024
fd82193
chore: turn empty tag regex warning into constant
RonnyPfannschmidt Feb 15, 2024
ab6cf05
test fix: correct cli test after pytest 8 exposed a bug
RonnyPfannschmidt Feb 15, 2024
1f57be6
ci fix: unshallow
RonnyPfannschmidt Feb 15, 2024
8cf87be
chore: drop black, flake8 and reoder-python-imports
RonnyPfannschmidt Feb 15, 2024
7225533
fix ruff config
RonnyPfannschmidt Feb 15, 2024
d9b3b29
Merge pull request #996 from RonnyPfannschmidt/ronny/cleanups
RonnyPfannschmidt Feb 15, 2024
5170451
Only depend on typing_extensions for Python < 3.10
dcermak Feb 19, 2024
09095ff
fix non-escaped markdown in docs
JCGoran Feb 21, 2024
58c9758
Merge pull request #1017 from JCGoran/fix_markdown
RonnyPfannschmidt Feb 21, 2024
fee09f4
Merge pull request #1015 from dcermak/typing_extensions-only-for-olde…
RonnyPfannschmidt Feb 28, 2024
88b2fe6
fix #1018 - allow NonNormalizedVersion in semver
RonnyPfannschmidt Mar 5, 2024
82857a4
upgrade pre-commit
RonnyPfannschmidt Mar 5, 2024
59defe7
Merge pull request #1020 from RonnyPfannschmidt/fix-1018-allow-non-no…
RonnyPfannschmidt Mar 5, 2024
45eb1b2
Merge pull request #1021 from RonnyPfannschmidt/pre-commit-upgrade
RonnyPfannschmidt Mar 5, 2024
1f49a81
Apply suggestions from code review
RonnyPfannschmidt Mar 5, 2024
411e933
Merge branch 'main' into main
RonnyPfannschmidt Mar 5, 2024
6f9544a
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Mar 5, 2024
739a67c
fix ruff warning on concat
RonnyPfannschmidt Mar 5, 2024
1bac9b5
Merge pull request #959 from con-f-use/main
RonnyPfannschmidt Mar 5, 2024
fa69479
[pre-commit.ci] pre-commit autoupdate
pre-commit-ci[bot] Mar 12, 2024
773ad45
Merge pull request #1023 from pypa/pre-commit-ci-update-config
RonnyPfannschmidt Mar 13, 2024
53e9930
Read branch data from Mercurial archives
danchr Mar 14, 2024
2bfbb25
[pre-commit.ci] pre-commit autoupdate
pre-commit-ci[bot] Mar 18, 2024
1ac50c2
Merge pull request #1026 from pypa/pre-commit-ci-update-config
RonnyPfannschmidt Mar 20, 2024
c9b3860
[pre-commit.ci] pre-commit autoupdate
pre-commit-ci[bot] Mar 25, 2024
d081257
Merge pull request #1027 from pypa/pre-commit-ci-update-config
RonnyPfannschmidt Mar 25, 2024
9ea57a0
Make .git_archival.txt more reproducible
LecrisUT Apr 16, 2024
d8d2b86
Merge pull request #1033 from LecrisUT/fix/git_archival
RonnyPfannschmidt Apr 16, 2024
d75201a
Merge pull request #1024 from danchr/hg-archive-branch
RonnyPfannschmidt Apr 22, 2024
9645373
tests: add git get_head_date test for isoformat dates ending with Z
ap-- May 2, 2024
49a89c9
setuptools_scm.git: fix handling of dates in isoformat ending with Z
ap-- May 2, 2024
3e613cd
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] May 2, 2024
234b74f
Merge pull request #1039 from ap--/fix-timezone-error
RonnyPfannschmidt May 6, 2024
65ac14d
bugfix: use extras in tox to ensure installation of test deps
RonnyPfannschmidt May 6, 2024
bb33eb7
Merge pull request #1043 from RonnyPfannschmidt/fix-tox
RonnyPfannschmidt May 6, 2024
a2ba78a
Exclude bots from generated release notes
hugovk May 8, 2024
67d154a
Merge pull request #1046 from hugovk/exclude-bots
RonnyPfannschmidt May 8, 2024
d37c280
Apply ruff/pyupgrade rule UP031
DimitriPapadopoulos May 8, 2024
573bee1
Apply ruff/flake8-implicit-str-concat rule ISC001
DimitriPapadopoulos May 6, 2024
6d46996
Apply ruff/refurb rule FURB118
DimitriPapadopoulos May 8, 2024
a4f3d38
Merge pull request #1047 from DimitriPapadopoulos/UP_FURB
RonnyPfannschmidt May 11, 2024
102f56a
Merge pull request #1044 from DimitriPapadopoulos/ISC
RonnyPfannschmidt May 15, 2024
15620f3
support `pipx run setuptools_scm`
njzjz Jun 10, 2024
74fa5be
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jun 10, 2024
f1e8074
Apply ruff/tryceratops rule TRY401
DimitriPapadopoulos Jun 29, 2024
98450d7
Update README.md to correct CI badge status
shenxianpeng Jul 9, 2024
545ce7e
Merge pull request #1055 from shenxianpeng/patch-1
RonnyPfannschmidt Jul 9, 2024
199f90b
Fix a link in usage.md
brettcannon Jul 20, 2024
e161622
Merge pull request #1057 from brettcannon/patch-1
RonnyPfannschmidt Jul 20, 2024
4ec3208
Merge pull request #1053 from DimitriPapadopoulos/TRY401
RonnyPfannschmidt Jul 20, 2024
c0e5743
Documented git archive support in README and docs
jamesbraza Jul 28, 2024
0213170
Merge pull request #1061 from jamesbraza/git-archive-docs
RonnyPfannschmidt Jul 28, 2024
6e81a26
Merge branch 'main' into patch-1
RonnyPfannschmidt Jul 28, 2024
4d0d50b
Merge pull request #1051 from njzjz/patch-1
RonnyPfannschmidt Jul 28, 2024
6f53d67
Apply repo-review rules PP306, PP307, PP308
DimitriPapadopoulos Aug 4, 2024
b3db2c5
Apply repo-review rule PC191
DimitriPapadopoulos Aug 4, 2024
ff50699
Apply repo-review rule RF003
DimitriPapadopoulos Aug 4, 2024
532554f
Apply repo-review rule RF103
DimitriPapadopoulos Aug 4, 2024
715ef95
Apply ruff rules
DimitriPapadopoulos Aug 4, 2024
4a48455
Add repo-review pre-commit hook
DimitriPapadopoulos Aug 6, 2024
6eb52e6
Merge pull request #1063 from DimitriPapadopoulos/repo-review
RonnyPfannschmidt Aug 6, 2024
d0daf6f
Rename the project to setuptools-scm in docs and GitHub.
jaraco Aug 13, 2024
12fc28e
Updated more references to the legacy name in Python code.
jaraco Aug 13, 2024
5f7ba15
Also update URL reference in pyproject.
jaraco Aug 13, 2024
4b29ab9
docs: clarify usage of version files
ianw Aug 23, 2024
d665621
Merge pull request #1068 from jaraco/debt/rename
RonnyPfannschmidt Aug 26, 2024
c8e5505
Updated version.py template to include __all__
jamesbraza Oct 1, 2024
2e0c6a9
Added a CHANGELOG entry
jamesbraza Oct 1, 2024
24d7797
Added 'ruff check' unit test
jamesbraza Oct 3, 2024
be34dd1
Merge pull request #1076 from jamesbraza/all-in-version
RonnyPfannschmidt Oct 3, 2024
24719f2
Better cleanup PYTHONPATH for Mercurial calls (support for PDM)
paugier Oct 23, 2024
3c145df
Merge pull request #1080 from paugier/hg-git_with_pdm
RonnyPfannschmidt Oct 24, 2024
a558f31
pipx.run entry-points should be setuptools-scm
paugier Oct 25, 2024
09c1f51
Add a lower bound pin on setuptools dependency
mayeut Nov 24, 2024
c766df1
Fixes #1090. Pinned requirement to tomli<=2.0.2.
anchal39 Nov 28, 2024
327b428
Add cross-reference from version_scheme config to implementations
maresb Jan 3, 2025
c633987
Remove the word "local" per PEP 440
maresb Jan 3, 2025
34a89a9
Clarify the definition of "local"
maresb Jan 3, 2025
3d8cefe
Add cross-reference from local_scheme config to implementations
maresb Jan 3, 2025
5d3a1f8
Merge pull request #1094 from maresb/version-scheme-docs
RonnyPfannschmidt Jan 4, 2025
15d62ac
Merge pull request #1091 from anchal39/tomli-version-fix
RonnyPfannschmidt Jan 14, 2025
1ddd483
Merge pull request #1088 from mayeut/patch-1
RonnyPfannschmidt Jan 14, 2025
51822d7
Merge branch 'main' into version-file
RonnyPfannschmidt Jan 14, 2025
ae5322b
Merge pull request #1069 from ianw/version-file
RonnyPfannschmidt Jan 14, 2025
051ad96
Merge pull request #1081 from paugier/fix-pipx-command-name
RonnyPfannschmidt Jan 14, 2025
2b0722f
Mention SETUPTOOLS_SCM_PRETEND_VERSION_FOR in error message
paugier Jan 22, 2025
9b6f031
Merge pull request #1102 from paugier/error-message-env-var
RonnyPfannschmidt Jan 23, 2025
d49399b
merge main
RonnyPfannschmidt Feb 9, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .git_archival.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
node: $Format:%H$
node-date: $Format:%cI$
describe-name: $Format:%(describe:tags=true,match=*[0-9]*)$
ref-names: $Format:%D$
5 changes: 5 additions & 0 deletions .github/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
changelog:
exclude:
authors:
- dependabot
- pre-commit-ci
2 changes: 2 additions & 0 deletions .github/workflows/python-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ jobs:
name: ${{ matrix.os }} - Python ${{ matrix.python_version }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup python
uses: actions/setup-python@v5
if: matrix.python_version != 'msys2'
Expand Down
37 changes: 11 additions & 26 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,45 +1,25 @@
default_language_version:
python: python3.9
repos:
- repo: https://github.com/psf/black
rev: 23.12.1
hooks:
- id: black
args: [--safe, --quiet]
exclude: docs/examples/
- repo: https://github.com/asottile/reorder-python-imports
rev: v3.12.0
hooks:
- id: reorder-python-imports
args: [ "--application-directories=.:src" , --py38-plus, --add-import, 'from __future__ import annotations']
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
hooks:
- id: trailing-whitespace
- id: check-yaml
- id: debug-statements
- repo: https://github.com/PyCQA/flake8
rev: 7.0.0
hooks:
- id: flake8
- repo: https://github.com/asottile/pyupgrade
rev: v3.15.0
hooks:
- id: pyupgrade
args: [--py38-plus]
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.1.11
rev: v0.3.4
hooks:
- id: ruff
args: [--fix, --exit-non-zero-on-fix]
args: [--fix, --exit-non-zero-on-fix, --show-fixes]
- id: ruff-format

- repo: https://github.com/tox-dev/pyproject-fmt
rev: "1.5.3"
rev: 1.7.0
hooks:
- id: pyproject-fmt
exclude: docs/examples/

- repo: https://github.com/pre-commit/mirrors-mypy
rev: 'v1.8.0'
rev: v1.9.0
hooks:
- id: mypy
args: [--strict]
Expand All @@ -51,3 +31,8 @@ repos:
- importlib_metadata
- typing-extensions>=4.5
- rich

- repo: https://github.com/scientific-python/cookie
rev: 2024.04.23
hooks:
- id: sp-repo-review
8 changes: 7 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
# Unreleased

## Changed

- inclusion of `__all__` in autogenerated `version.py` files to aid IDE autoimports

# v8.0.4

Expand All @@ -14,7 +19,7 @@

- fix #925: allow `write_to` to be an absolute path when it's a subdirectory of the root
- fix #932: ensure type annotations in version file don't cause linter issues
- fix #930: temporary restore `DEFAULT_VERSION_SCHEME` and `DEFAULT_LOCAL_SCHEME` on the `setuptools_scm` package
- fix #930: temporary restore `DEFAULT_VERSION_SCHEME` and `DEFAULT_LOCAL_SCHEME` on the `setuptools-scm` package



Expand Down Expand Up @@ -60,6 +65,7 @@
- use normalized dist names for the `SETUPTOOLS_SCM_PRETEND_VERSION_FOR_${DIST_NAME}` env var
- drop support for python 3.7
- introduce `version_file` as replacement for `write_to`
- renameed the project from `setuptools_scm` to `setuptools-scm`

## features

Expand Down
29 changes: 16 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,19 +1,21 @@
# setuptools_scm
[![github ci](https://github.com/pypa/setuptools_scm/workflows/python%20tests+artifacts+release/badge.svg)](https://github.com/pypa/setuptools_scm/actions)
# setuptools-scm
[![github ci](https://github.com/pypa/setuptools-scm/actions/workflows/python-tests.yml/badge.svg)](https://github.com/pypa/setuptools-scm/actions/workflows/python-tests.yml)
[![Documentation Status](https://readthedocs.org/projects/setuptools-scm/badge/?version=latest)](https://setuptools-scm.readthedocs.io/en/latest/?badge=latest)
[![tidelift](https://tidelift.com/badges/package/pypi/setuptools-scm) ](https://tidelift.com/subscription/pkg/pypi-setuptools-scm?utm_source=pypi-setuptools-scm&utm_medium=readme)

## about

[setuptools-scm] extracts Python package versions from `git` or
`hg` metadata instead of declaring them as the version argument
or in an SCM managed file.

Additionally, [setuptools-scm] provides setuptools
with a list of files that are managed by the SCM <br/>
(i.e. it automatically adds **all of** the SCM-managed files to the sdist).<br/>
Unwanted files must be excluded via `MANIFEST.in`.
[setuptools-scm] extracts Python package versions from `git` or `hg` metadata
instead of declaring them as the version argument
or in a Source Code Managed (SCM) managed file.

Additionally [setuptools-scm] provides `setuptools` with a list of
files that are managed by the SCM
<br/>
(i.e. it automatically adds all the SCM-managed files to the sdist).
<br/>
Unwanted files must be excluded via `MANIFEST.in`
or [configuring Git archive][git-archive-docs].

## `pyproject.toml` usage

Expand All @@ -26,7 +28,7 @@ build step by specifying it as one of the build requirements.

```toml title="pyproject.toml"
[build-system]
requires = ["setuptools>=64", "setuptools_scm>=8"]
requires = ["setuptools>=64", "setuptools-scm>=8"]
build-backend = "setuptools.build_meta"
```

Expand Down Expand Up @@ -69,16 +71,17 @@ $ python -m setuptools_scm --help

For further configuration see the [documentation].

[setuptools-scm]: https://github.com/pypa/setuptools_scm
[setuptools-scm]: https://github.com/pypa/setuptools-scm
[documentation]: https://setuptools-scm.readthedocs.io/
[git-archive-docs]: https://setuptools-scm.readthedocs.io/en/stable/usage/#builtin-mechanisms-for-obtaining-version-numbers


## Interaction with Enterprise Distributions

Some enterprise distributions like RHEL7
ship rather old setuptools versions.

In those cases its typically possible to build by using an sdist against `setuptools_scm<2.0`.
In those cases its typically possible to build by using an sdist against `setuptools-scm<2.0`.
As those old setuptools versions lack sensible types for versions,
modern [setuptools-scm] is unable to support them sensibly.

Expand Down
8 changes: 5 additions & 3 deletions _own_version_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,24 @@
it works only if the backend-path of the build-system section
from pyproject.toml is respected
"""

from __future__ import annotations

import logging

from typing import Callable

from setuptools import build_meta as build_meta # noqa
from setuptools import build_meta as build_meta

from setuptools_scm import _types as _t
from setuptools_scm import Configuration
from setuptools_scm import _types as _t
from setuptools_scm import get_version
from setuptools_scm import git
from setuptools_scm import hg
from setuptools_scm.fallbacks import parse_pkginfo
from setuptools_scm.version import ScmVersion
from setuptools_scm.version import get_local_node_and_date
from setuptools_scm.version import guess_next_dev_version
from setuptools_scm.version import ScmVersion

log = logging.getLogger("setuptools_scm")
# todo: take fake entrypoints from pyproject.toml
Expand Down
4 changes: 4 additions & 0 deletions changelog.d/20240105_133254_subprocess_timeout_var.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@

### Changed

- fix #957 - add subprocess timeout control env var
30 changes: 30 additions & 0 deletions changelog.d/20240108_134756_cli_version_file_force.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@

### Added

- fix #960: add a ``--force-write-version-files`` flag for the cli

-->
<!--
### Changed

- A bullet item for the Changed category.

-->
<!--
### Deprecated

- A bullet item for the Deprecated category.

-->
<!--
### Fixed

- A bullet item for the Fixed category.

-->
<!--
### Security

- A bullet item for the Security category.

-->
4 changes: 4 additions & 0 deletions changelog.d/20240305_102047_allow_non_normalized_semver.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@

### Fixed

- fix #1018: allow non-normalized versions for semver
25 changes: 15 additions & 10 deletions docs/config.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,19 @@ Callables or other Python objects have to be passed in `setup.py` (via the `use_
: Relative path to the SCM root, defaults to `.` and is relative to the file path passed in `relative_to`

`version_scheme : str | Callable[[ScmVersion], str]`
: Configures how the local version number is constructed; either an entrypoint name or a callable.
: Configures how the version number is constructed; either an entrypoint name or a callable.
See [Version number construction](extending.md#setuptools_scmversion_scheme) for predefined implementations.

`local_scheme : str | Callable[[ScmVersion], str]`
: Configures how the local component of the version is constructed
: Configures how the local component of the version (the optional part after the `+`) is constructed;
either an entrypoint name or a callable.
See [Version number construction](extending.md#setuptools_scmlocal_scheme) for predefined implementations.


`version_file: Path | PathLike[str] | None = None`
: A path to a file that gets replaced with a file containing the current
version. It is ideal for creating a ``_version.py`` file within the
package, typically used to avoid using `pkg_resources.get_distribution`
package, typically used to avoid using `importlib.metadata`
(which adds some overhead).

!!! warning ""
Expand All @@ -30,8 +32,11 @@ Callables or other Python objects have to be passed in `setup.py` (via the `use_
for other file types it is necessary to provide `version_file_template`.

`version_file_template: str | None = None`
: A new-style format string that is given the current version as
the `version` keyword argument for formatting.
: A new-style format string taking `version`, `scm_version` and `version_tuple` as parameters.
`version` is the generated next_version as string,
`version_tuple` is a tuple of split numbers/strings and
`scm_version` is the `ScmVersion` instance the current `version` was rendered from


`write_to: Pathlike[str] | Path | None = None`
: (deprecated) legacy option to create a version file relative to the scm root
Expand Down Expand Up @@ -66,14 +71,14 @@ Callables or other Python objects have to be passed in `setup.py` (via the `use_
`fallback_version: str | None = None`
: A version string that will be used if no other method for detecting the
version worked (e.g., when using a tarball with no metadata). If this is
unset (the default), `setuptools_scm` will error if it fails to detect the
unset (the default), `setuptools-scm` will error if it fails to detect the
version.

`parse: Callable[[Path, Config], ScmVersion] | None = None`
: A function that will be used instead of the discovered SCM
for parsing the version. Use with caution,
this is a function for advanced use and you should be
familiar with the `setuptools_scm` internals to use it.
familiar with the `setuptools-scm` internals to use it.

`git_describe_command`
: This command will be used instead the default `git describe --long` command.
Expand All @@ -93,7 +98,7 @@ Callables or other Python objects have to be passed in `setup.py` (via the `use_

The [setuptools_scm.NonNormalizedVersion][] convenience class is
provided to disable the normalization step done by
`packaging.version.Version`. If this is used while `setuptools_scm`
`packaging.version.Version`. If this is used while `setuptools-scm`
is integrated in a setuptools packaging process, the non-normalized
version number will appear in all files (see `version_file` note).

Expand All @@ -118,10 +123,10 @@ Callables or other Python objects have to be passed in `setup.py` (via the `use_
in which case it will be an unparsed string.
Specifying distribution-specific pretend versions will
avoid possible collisions with third party distributions
also using ``setuptools_scm``
also using ``setuptools-scm``

the dist name normalization follows adapted PEP 503 semantics, with one or
more of ".-_" being replaced by a single "_", and the name being upper-cased
more of ".-\_" being replaced by a single "\_", and the name being upper-cased

this will take precedence over ``SETUPTOOLS_SCM_PRETEND_VERSION``

Expand Down
8 changes: 4 additions & 4 deletions docs/customizing.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
## providing project local version schemes

As PEP 621 provides no way to specify local code as a build backend plugin,
setuptools_scm has to piggyback on setuptools for passing functions over.
setuptools-scm has to piggyback on setuptools for passing functions over.

To facilitate that one needs to write a `setup.py` file and
pass partial setuptools_scm configuration in via the use_scm_version keyword.
pass partial setuptools-scm configuration in via the use_scm_version keyword.

It's strongly recommended to experiment with using stock version schemes or creating plugins as package.
(This recommendation will change if there ever is something like build-time entrypoints).
Expand All @@ -33,7 +33,7 @@ setup(use_scm_version={"version_scheme": myversion_func})

``` { .toml title="pyproject.toml" file="docs/examples/version_scheme_code/pyproject.toml" }
[build-system]
requires = ["setuptools>=64", "setuptools_scm>=8"]
requires = ["setuptools>=64", "setuptools-scm>=8"]
build-backend = "setuptools.build_meta"

[project]
Expand All @@ -52,7 +52,7 @@ dynamic = [

## Importing in setup.py

With the pep 517/518 build backend, setuptools_scm is importable from `setup.py`
With the pep 517/518 build backend, setuptools-scm is importable from `setup.py`

``` { .python title="setup.py" }
import setuptools
Expand Down
4 changes: 2 additions & 2 deletions docs/examples/version_scheme_code/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# ~/~ begin <<docs/customizing.md#docs/examples/version_scheme_code/pyproject.toml>>[init]
[build-system]
requires = ["setuptools>=64", "setuptools_scm>=8"]
requires = ["setuptools>=64", "setuptools-scm>=8"]
build-backend = "setuptools.build_meta"

[project]
Expand All @@ -10,4 +10,4 @@ dynamic = [
]

[tool.setuptools_scm]
# ~/~ end
# ~/~ end
11 changes: 8 additions & 3 deletions docs/extending.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# Extending setuptools_scm
# Extending setuptools-scm

`setuptools_scm` uses [entry-point][entry-point] based hooks to extend its default capabilities.
`setuptools-scm` uses [entry-point][entry-point] based hooks to extend its default capabilities.

[entry-point]: https://packaging.python.org/en/latest/specifications/entry-points/

## Adding a new SCM

`setuptools_scm` provides two entrypoints for adding new SCMs:
`setuptools-scm` provides two entrypoints for adding new SCMs:

`setuptools_scm.parse_scm`
: A function used to parse the metadata of the current workdir
Expand Down Expand Up @@ -84,6 +84,11 @@ representing the version.
`no-guess-dev`
: Does no next version guessing, just adds `.post1.devN`

`only-version`
: Only use the version from the tag, as given.

!!! warning "This means version is no longer pseudo unique per commit"


### `setuptools_scm.local_scheme`
Configures how the local part of a version is rendered given a
Expand Down
Loading
Loading