Skip to content

Commit 0456934

Browse files
committed
Switch versioning to be SCM-based
1 parent e38f1a8 commit 0456934

File tree

7 files changed

+32
-2
lines changed

7 files changed

+32
-2
lines changed

.pre-commit-config.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,7 @@ repos:
163163
additional_dependencies:
164164
- paramiko == 2.8.0
165165
- types-paramiko == 2.7.3
166+
- types-setuptools == 57.4.2
166167
args:
167168
# FIXME: get rid of missing imports ignore
168169
- --ignore-missing-imports

Dockerfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
FROM python:3.10-alpine as base
22
FROM base as builder
33

4+
COPY .git /app/
45
COPY requirements.txt /app/
56
COPY pyproject.toml /app/
67
COPY setup.cfg /app/

proxy/common/.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# Build-time setuptools-scm generated version module
2+
/_scm_version.py

proxy/common/_scm_version.pyi

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# This stub file is necessary because `_scm_version.py`
2+
# autogenerated on build and absent on mypy checks time
3+
version: str

proxy/common/_version.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
"""Version definition."""
2+
3+
try:
4+
# pylint: disable=unused-import
5+
from ._scm_version import version as __version__ # noqa: WPS433, WPS436
6+
except ImportError:
7+
from pkg_resources import get_distribution as _get_dist # noqa: WPS433
8+
__version__ = _get_dist('proxy.py').version # noqa: WPS440
9+
10+
11+
__all__ = ('__version__',)

proxy/common/version.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,10 @@
88
:copyright: (c) 2013-present by Abhinav Singh and contributors.
99
:license: BSD, see LICENSE for more details.
1010
"""
11-
VERSION = (2, 4, 0)
12-
__version__ = '.'.join(map(str, VERSION[0:3]))
11+
from ._version import __version__ # noqa: WPS436
12+
13+
14+
VERSION = tuple(map(int, __version__.split('.')))
15+
16+
17+
__all__ = '__version__', 'VERSION'

pyproject.toml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,12 @@
22
requires = [
33
# Essentials
44
"setuptools",
5+
6+
# Plugins
7+
"setuptools-scm[toml] >= 6",
8+
"setuptools-scm-git-archive >= 1.1",
59
]
610
build-backend = "setuptools.build_meta"
11+
12+
[tool.setuptools_scm]
13+
write_to = "proxy/common/_scm_version.py"

0 commit comments

Comments
 (0)