Skip to content

Commit 51822d7

Browse files
Merge branch 'main' into version-file
2 parents 4b29ab9 + 1ddd483 commit 51822d7

File tree

19 files changed

+82
-62
lines changed

19 files changed

+82
-62
lines changed

CHANGELOG.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
# Unreleased
2+
3+
## Changed
4+
5+
- inclusion of `__all__` in autogenerated `version.py` files to aid IDE autoimports
16

27
# v8.0.4
38

@@ -14,7 +19,7 @@
1419

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

1924

2025

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

6470
## features
6571

README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
# setuptools_scm
2-
[![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)
1+
# setuptools-scm
2+
[![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)
33
[![Documentation Status](https://readthedocs.org/projects/setuptools-scm/badge/?version=latest)](https://setuptools-scm.readthedocs.io/en/latest/?badge=latest)
44
[![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)
55

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

2929
```toml title="pyproject.toml"
3030
[build-system]
31-
requires = ["setuptools>=64", "setuptools_scm>=8"]
31+
requires = ["setuptools>=64", "setuptools-scm>=8"]
3232
build-backend = "setuptools.build_meta"
3333
```
3434

@@ -71,7 +71,7 @@ $ python -m setuptools_scm --help
7171

7272
For further configuration see the [documentation].
7373

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

@@ -81,7 +81,7 @@ For further configuration see the [documentation].
8181
Some enterprise distributions like RHEL7
8282
ship rather old setuptools versions.
8383

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

docs/config.md

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,13 @@ Callables or other Python objects have to be passed in `setup.py` (via the `use_
1111
: Relative path to the SCM root, defaults to `.` and is relative to the file path passed in `relative_to`
1212

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

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

2022

2123
`version_file: Path | PathLike[str] | None = None`
@@ -69,14 +71,14 @@ Callables or other Python objects have to be passed in `setup.py` (via the `use_
6971
`fallback_version: str | None = None`
7072
: A version string that will be used if no other method for detecting the
7173
version worked (e.g., when using a tarball with no metadata). If this is
72-
unset (the default), `setuptools_scm` will error if it fails to detect the
74+
unset (the default), `setuptools-scm` will error if it fails to detect the
7375
version.
7476

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

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

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

@@ -121,7 +123,7 @@ Callables or other Python objects have to be passed in `setup.py` (via the `use_
121123
in which case it will be an unparsed string.
122124
Specifying distribution-specific pretend versions will
123125
avoid possible collisions with third party distributions
124-
also using ``setuptools_scm``
126+
also using ``setuptools-scm``
125127

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

docs/customizing.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@
33
## providing project local version schemes
44

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

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

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

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

3939
[project]
@@ -52,7 +52,7 @@ dynamic = [
5252

5353
## Importing in setup.py
5454

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

5757
``` { .python title="setup.py" }
5858
import setuptools
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# ~/~ begin <<docs/customizing.md#docs/examples/version_scheme_code/pyproject.toml>>[init]
22
[build-system]
3-
requires = ["setuptools>=64", "setuptools_scm>=8"]
3+
requires = ["setuptools>=64", "setuptools-scm>=8"]
44
build-backend = "setuptools.build_meta"
55

66
[project]
@@ -10,4 +10,4 @@ dynamic = [
1010
]
1111

1212
[tool.setuptools_scm]
13-
# ~/~ end
13+
# ~/~ end

docs/extending.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
# Extending setuptools_scm
1+
# Extending setuptools-scm
22

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

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

77
## Adding a new SCM
88

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

1111
`setuptools_scm.parse_scm`
1212
: A function used to parse the metadata of the current workdir

docs/index.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
# About
22

3-
`setuptools_scm` extracts Python package versions from `git` or `hg` metadata
3+
`setuptools-scm` extracts Python package versions from `git` or `hg` metadata
44
instead of declaring them as the version argument
55
or in a Source Code Managed (SCM) managed file.
66

7-
Additionally `setuptools_scm` provides `setuptools` with a list of
7+
Additionally `setuptools-scm` provides `setuptools` with a list of
88
files that are managed by the SCM
99
(i.e. it automatically adds all the SCM-managed files to the sdist).
1010
Unwanted files must be excluded via `MANIFEST.in`
@@ -16,13 +16,13 @@ or [configuring Git archive][git-archive-docs].
1616

1717
### With setuptools
1818

19-
Note: `setuptools_scm>=8` intentionally doesn't depend on setuptools to ease non-setuptools usage.
19+
Note: `setuptools-scm>=8` intentionally doesn't depend on setuptools to ease non-setuptools usage.
2020
Please ensure a recent version of setuptools (>=64) is installed.
2121

2222

2323
```toml title="pyproject.toml"
2424
[build-system]
25-
requires = ["setuptools>=64", "setuptools_scm>=8"]
25+
requires = ["setuptools>=64", "setuptools-scm>=8"]
2626
build-backend = "setuptools.build_meta"
2727

2828
[project]
@@ -39,6 +39,6 @@ dynamic = ["version"]
3939

4040
### With hatch
4141

42-
[Hatch-vcs](https://github.com/ofek/hatch-vcs) integrates with setuptools_scm
42+
[Hatch-vcs](https://github.com/ofek/hatch-vcs) integrates with setuptools-scm
4343
but provides its own configuration options,
4444
please see its [documentation](https://github.com/ofek/hatch-vcs#readme)

docs/overrides.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
## pretend versions
44

5-
setuptools_scm provides a mechanism to override the version number build time.
5+
setuptools-scm provides a mechanism to override the version number build time.
66

77
the environment variable `SETUPTOOLS_SCM_PRETEND_VERSION` is used
88
as the override source for the version number unparsed string.
@@ -12,7 +12,7 @@ where the dist name normalization follows adapted PEP 503 semantics.
1212

1313
## config overrides
1414

15-
setuptools_scm parses the environment variable `SETUPTOOLS_SCM_OVERRIDES_FOR_${NORMALIZED_DIST_NAME}`
15+
setuptools-scm parses the environment variable `SETUPTOOLS_SCM_OVERRIDES_FOR_${NORMALIZED_DIST_NAME}`
1616
as a toml inline map to override the configuration data from `pyproject.toml`.
1717

1818
## subprocess timeouts

docs/usage.md

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,25 +2,25 @@
22

33
## At build time
44

5-
The preferred way to configure `setuptools_scm` is to author
5+
The preferred way to configure `setuptools-scm` is to author
66
settings in the `tool.setuptools_scm` section of `pyproject.toml`.
77

88
It's necessary to use a setuptools version released after 2022.
99

1010
```toml title="pyproject.toml"
1111
[build-system]
12-
requires = ["setuptools>=64", "setuptools_scm>=8"]
12+
requires = ["setuptools>=64", "setuptools-scm>=8"]
1313
build-backend = "setuptools.build_meta"
1414

1515
[project]
1616
# version = "0.0.1" # Remove any existing version parameter.
1717
dynamic = ["version"]
1818

1919
[tool.setuptools_scm]
20-
# can be empty if no extra settings are needed, presence enables setuptools_scm
20+
# can be empty if no extra settings are needed, presence enables setuptools-scm
2121
```
2222

23-
That will be sufficient to require `setuptools_scm` for projects
23+
That will be sufficient to require `setuptools-scm` for projects
2424
that support PEP 518 ([pip](https://pypi.org/project/pip) and
2525
[pep517](https://pypi.org/project/pep517/)).
2626
Tools that still invoke `setup.py` must ensure build requirements are installed
@@ -46,7 +46,7 @@ the runtime discussion below for more details.
4646

4747
If you need to confirm which version string is being generated
4848
or debug the configuration, you can install
49-
[setuptools-scm](https://github.com/pypa/setuptools_scm)
49+
[setuptools-scm](https://github.com/pypa/setuptools-scm)
5050
directly in your working environment and run:
5151

5252
```commandline
@@ -79,7 +79,6 @@ To explore other options, try
7979

8080
```commandline
8181
$ python -m setuptools_scm --help
82-
```
8382
8483
## At runtime
8584
@@ -192,7 +191,7 @@ is preferred over `SETUPTOOLS_SCM_PRETEND_VERSION`.
192191

193192
## Default versioning scheme
194193

195-
In the standard configuration `setuptools_scm` takes a look at three things:
194+
In the standard configuration `setuptools-scm` takes a look at three things:
196195

197196
1. latest tag (with a version number)
198197
2. the distance to this tag (e.g. number of revisions since latest tag)
@@ -281,14 +280,14 @@ $ git add .git_archival.txt .gitattributes && git commit -m "add export config"
281280
Note that if you are creating a `_version.py` file, note that it should not
282281
be kept in version control. It's strongly recommended to be put into gitignore.
283282

284-
[git-archive-issue]: https://github.com/pypa/setuptools_scm/issues/806
283+
[git-archive-issue]: https://github.com/pypa/setuptools-scm/issues/806
285284

286285
### File finders hook makes most of `MANIFEST.in` unnecessary
287286

288-
`setuptools_scm` implements a [file_finders] entry point
287+
`setuptools-scm` implements a [file_finders] entry point
289288
which returns all files tracked by your SCM.
290289
This eliminates the need for a manually constructed `MANIFEST.in` in most cases where this
291-
would be required when not using `setuptools_scm`, namely:
290+
would be required when not using `setuptools-scm`, namely:
292291

293292
* To ensure all relevant files are packaged when running the `sdist` command.
294293
* When using [include_package_data] to include package data as part of the `build` or `bdist_wheel`.

pyproject.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
build-backend = "_own_version_helper:build_meta"
55
requires = [
66
"setuptools>=61",
7-
'tomli; python_version < "3.11"',
7+
'tomli<=2.0.2; python_version < "3.11"',
88
]
99
backend-path = [
1010
".",
@@ -41,7 +41,7 @@ dynamic = [
4141
]
4242
dependencies = [
4343
"packaging>=20",
44-
"setuptools",
44+
"setuptools>=61",
4545
'tomli>=1; python_version < "3.11"',
4646
'typing-extensions; python_version < "3.10"',
4747
]
@@ -68,7 +68,7 @@ toml = [
6868
]
6969
[project.urls]
7070
documentation = "https://setuptools-scm.readthedocs.io/"
71-
repository = "https://github.com/pypa/setuptools_scm/"
71+
repository = "https://github.com/pypa/setuptools-scm/"
7272
[project.entry-points."distutils.setup_keywords"]
7373
use_scm_version = "setuptools_scm._integration.setuptools:version_keyword"
7474
[project.entry-points."pipx.run"]

src/setuptools_scm/_cli.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ def _get_cli_opts(args: list[str] | None) -> argparse.Namespace:
6161
"--config",
6262
default=None,
6363
metavar="PATH",
64-
help="path to 'pyproject.toml' with setuptools_scm config, "
64+
help="path to 'pyproject.toml' with setuptools-scm config, "
6565
"default: looked up in the current or parent directories",
6666
)
6767
parser.add_argument(
@@ -89,7 +89,7 @@ def _get_cli_opts(args: list[str] | None) -> argparse.Namespace:
8989
"--query",
9090
type=str.casefold,
9191
nargs="*",
92-
help="display setuptools_scm settings according to query, "
92+
help="display setuptools-scm settings according to query, "
9393
"e.g. dist_name, do not supply an argument in order to "
9494
"print a list of valid queries.",
9595
)

src/setuptools_scm/_get_version_impl.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ def get_version(
149149
"""
150150
If supplied, relative_to should be a file from which root may
151151
be resolved. Typically called by a script or module that is not
152-
in the root of the repository to direct setuptools_scm to the
152+
in the root of the repository to direct setuptools-scm to the
153153
root of the repository by supplying ``__file__``.
154154
"""
155155

src/setuptools_scm/_integration/dump_version.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,16 @@
1313

1414
TEMPLATES = {
1515
".py": """\
16-
# file generated by setuptools_scm
16+
# file generated by setuptools-scm
1717
# don't change, don't track in version control
18+
19+
__all__ = ["__version__", "__version_tuple__", "version", "version_tuple"]
20+
1821
TYPE_CHECKING = False
1922
if TYPE_CHECKING:
20-
from typing import Tuple, Union
23+
from typing import Tuple
24+
from typing import Union
25+
2126
VERSION_TUPLE = Tuple[Union[int, str], ...]
2227
else:
2328
VERSION_TUPLE = object

src/setuptools_scm/_integration/setuptools.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,10 @@ def _warn_on_old_setuptools(_version: str = setuptools.__version__) -> None:
3131
warnings.warn(
3232
RuntimeWarning(
3333
f"""
34-
ERROR: setuptools=={_version} is used in combination with setuptools_scm>=8.x
34+
ERROR: setuptools=={_version} is used in combination with setuptools-scm>=8.x
3535
3636
Your build configuration is incomplete and previously worked by accident!
37-
setuptools_scm requires setuptools>=61
37+
setuptools-scm requires setuptools>=61
3838
3939
Suggested workaround if applicable:
4040
- migrating from the deprecated setup_requires mechanism to pep517/518
@@ -113,7 +113,7 @@ def infer_version(dist: setuptools.Distribution) -> None:
113113
dist_name = read_dist_name_from_setup_cfg()
114114
if not os.path.isfile("pyproject.toml"):
115115
return
116-
if dist_name == "setuptools_scm":
116+
if dist_name == "setuptools-scm":
117117
return
118118
try:
119119
config = _config.Configuration.from_file(dist_name=dist_name)

0 commit comments

Comments
 (0)