Skip to content

Commit d9b3b29

Browse files
Merge pull request #996 from RonnyPfannschmidt/ronny/cleanups
cleanups + bugfixes
2 parents a23d5fe + 7225533 commit d9b3b29

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+273
-136
lines changed

.github/workflows/python-tests.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@ jobs:
4343
name: ${{ matrix.os }} - Python ${{ matrix.python_version }}
4444
steps:
4545
- uses: actions/checkout@v4
46+
with:
47+
fetch-depth: 0
4648
- name: Setup python
4749
uses: actions/setup-python@v5
4850
if: matrix.python_version != 'msys2'

.pre-commit-config.yaml

Lines changed: 4 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,19 @@
1-
default_language_version:
2-
python: python3.9
31
repos:
4-
- repo: https://github.com/psf/black
5-
rev: 23.12.1
6-
hooks:
7-
- id: black
8-
args: [--safe, --quiet]
9-
exclude: docs/examples/
10-
- repo: https://github.com/asottile/reorder-python-imports
11-
rev: v3.12.0
12-
hooks:
13-
- id: reorder-python-imports
14-
args: [ "--application-directories=.:src" , --py38-plus, --add-import, 'from __future__ import annotations']
152
- repo: https://github.com/pre-commit/pre-commit-hooks
163
rev: v4.5.0
174
hooks:
185
- id: trailing-whitespace
196
- id: check-yaml
207
- id: debug-statements
21-
- repo: https://github.com/PyCQA/flake8
22-
rev: 7.0.0
23-
hooks:
24-
- id: flake8
25-
- repo: https://github.com/asottile/pyupgrade
26-
rev: v3.15.0
27-
hooks:
28-
- id: pyupgrade
29-
args: [--py38-plus]
308
- repo: https://github.com/astral-sh/ruff-pre-commit
31-
rev: v0.1.11
9+
rev: v0.2.1
3210
hooks:
3311
- id: ruff
3412
args: [--fix, --exit-non-zero-on-fix]
13+
- id: ruff-format
14+
3515
- repo: https://github.com/tox-dev/pyproject-fmt
36-
rev: "1.5.3"
16+
rev: "1.7.0"
3717
hooks:
3818
- id: pyproject-fmt
3919
exclude: docs/examples/

_own_version_helper.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,22 +5,23 @@
55
it works only if the backend-path of the build-system section
66
from pyproject.toml is respected
77
"""
8+
89
from __future__ import annotations
910

1011
import logging
11-
from typing import Callable
1212

13-
from setuptools import build_meta as build_meta # noqa
13+
from typing import Callable
1414

15-
from setuptools_scm import _types as _t
15+
from setuptools import build_meta as build_meta
1616
from setuptools_scm import Configuration
17+
from setuptools_scm import _types as _t
1718
from setuptools_scm import get_version
1819
from setuptools_scm import git
1920
from setuptools_scm import hg
2021
from setuptools_scm.fallbacks import parse_pkginfo
22+
from setuptools_scm.version import ScmVersion
2123
from setuptools_scm.version import get_local_node_and_date
2224
from setuptools_scm.version import guess_next_dev_version
23-
from setuptools_scm.version import ScmVersion
2425

2526
log = logging.getLogger("setuptools_scm")
2627
# todo: take fake entrypoints from pyproject.toml
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
2+
### Changed
3+
4+
- fix #957 - add subprocess timeout control env var
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
2+
### Added
3+
4+
- fix #960: add a ``--force-write-version-files`` flag for the cli
5+
6+
-->
7+
<!--
8+
### Changed
9+
10+
- A bullet item for the Changed category.
11+
12+
-->
13+
<!--
14+
### Deprecated
15+
16+
- A bullet item for the Deprecated category.
17+
18+
-->
19+
<!--
20+
### Fixed
21+
22+
- A bullet item for the Fixed category.
23+
24+
-->
25+
<!--
26+
### Security
27+
28+
- A bullet item for the Security category.
29+
30+
-->

docs/config.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,11 @@ Callables or other Python objects have to be passed in `setup.py` (via the `use_
3030
for other file types it is necessary to provide `version_file_template`.
3131

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

3639
`write_to: Pathlike[str] | Path | None = None`
3740
: (deprecated) legacy option to create a version file relative to the scm root

docs/examples/version_scheme_code/setup.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
from __future__ import annotations
44

55
from setuptools import setup
6-
76
from setuptools_scm import ScmVersion
87

98

docs/overrides.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,10 @@ where the dist name normalization follows adapted PEP 503 semantics.
1414

1515
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`.
17+
18+
## subprocess timeouts
19+
20+
The environment variable `SETUPTOOLS_SCM_SUBPROCESS_TIMEOUT` allows to override the subprocess timeout.
21+
The default is 40 seconds and should work for most needs. However, users with git lfs + windows reported
22+
situations where this was not enough.
23+

pyproject.toml

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,8 +113,17 @@ version = { attr = "_own_version_helper.version"}
113113
[tool.setuptools_scm]
114114

115115
[tool.ruff]
116-
select = ["E", "F", "B", "U", "YTT", "C", "DTZ", "PYI", "PT"]
117-
ignore = ["B028"]
116+
required-version = "0.2.1"
117+
fix = true
118+
lint.select = ["E", "F", "B", "U", "YTT", "C", "DTZ", "PYI", "PT", "I", "FURB", "RUF"]
119+
lint.ignore = ["B028"]
120+
lint.preview = true
121+
122+
[tool.ruff.lint.isort]
123+
force-single-line = true
124+
from-first = false
125+
lines-between-types = 1
126+
order-by-type = true
118127

119128
[tool.pytest.ini_options]
120129
testpaths = ["testing"]

src/setuptools_scm/__init__.py

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,29 +2,29 @@
22
:copyright: 2010-2023 by Ronny Pfannschmidt
33
:license: MIT
44
"""
5+
56
from __future__ import annotations
67

8+
from ._config import DEFAULT_LOCAL_SCHEME
9+
from ._config import DEFAULT_VERSION_SCHEME
710
from ._config import Configuration
8-
from ._config import DEFAULT_LOCAL_SCHEME # soft deprecated
9-
from ._config import DEFAULT_VERSION_SCHEME # soft deprecated
10-
from ._get_version_impl import _get_version # soft deprecated
11-
from ._get_version_impl import get_version # soft deprecated
11+
from ._get_version_impl import _get_version
12+
from ._get_version_impl import get_version
1213
from ._integration.dump_version import dump_version # soft deprecated
1314
from ._version_cls import NonNormalizedVersion
1415
from ._version_cls import Version
1516
from .version import ScmVersion
1617

17-
1818
# Public API
1919
__all__ = [
20-
# soft deprecated imports, left for backward compatibility
21-
"get_version",
22-
"_get_version",
23-
"dump_version",
24-
"DEFAULT_VERSION_SCHEME",
2520
"DEFAULT_LOCAL_SCHEME",
21+
"DEFAULT_VERSION_SCHEME",
2622
"Configuration",
27-
"Version",
28-
"ScmVersion",
2923
"NonNormalizedVersion",
24+
"ScmVersion",
25+
"Version",
26+
"_get_version",
27+
"dump_version",
28+
# soft deprecated imports, left for backward compatibility
29+
"get_version",
3030
]

0 commit comments

Comments
 (0)