Skip to content

Commit 86826cf

Browse files
dbarnettsnu5mumr1k
authored andcommitted
Get version from setuptools-scm, remove VERSION.txt
1 parent 2108e6a commit 86826cf

File tree

6 files changed

+14
-13
lines changed

6 files changed

+14
-13
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,4 @@
66
/*.egg-info/
77
/.env/
88
/.venv/
9+
/vroom/_version.py

MANIFEST.in

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
include README.md
2-
include vroom/VERSION.txt
2+
exclude .git*
33

44
graft examples/
55
graft images/
6+
7+
prune .git*

VERSION.txt

-1
This file was deleted.

pyproject.toml

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[build-system]
2-
requires = ["setuptools>=61.2"]
2+
requires = ["setuptools>=64", "setuptools-scm>=8"]
33
build-backend = "setuptools.build_meta"
44

55
[project]
@@ -30,5 +30,5 @@ script-files = [
3030
"scripts/vroom",
3131
]
3232

33-
[tool.setuptools.dynamic]
34-
version = { file = "VERSION.txt" }
33+
[tool.setuptools_scm]
34+
version_file = "vroom/_version.py"

vroom/VERSION.txt

-1
This file was deleted.

vroom/__init__.py

+7-7
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
11
"""Patterns common to all vroom components."""
22
import sys
33

4+
try:
5+
from ._version import __version__ as __version__
6+
except ImportError:
7+
import warnings
8+
warnings.warn('Failed to load __version__ from setuptools-scm')
9+
__version__ = '__unknown__'
10+
411

512
# Don't even try to run under python 2 or earlier. It will seem to work but fail
613
# in corner cases with strange encoding errors.
714
if sys.version_info[0] < 3:
815
raise ImportError('Python < 3 is unsupported')
916

1017

11-
def __read_version_txt():
12-
import pkgutil
13-
return pkgutil.get_data('vroom', 'VERSION.txt').decode('utf-8').strip()
14-
15-
__version__ = __read_version_txt()
16-
17-
1818
def Specification(*numbered, **named):
1919
"""Creates a specification type, useful for defining constants.
2020

0 commit comments

Comments
 (0)