Skip to content

Commit 70ac14b

Browse files
malikinicoddemus
authored andcommitted
Switch to setuptools-scm for versioning
Following other pytest projects like pytest-html, that use setuptool-scm to manage version, it would be nice other projects follow the suit and let setuptools-scm manage version of this project.
1 parent 1ada096 commit 70ac14b

File tree

3 files changed

+9
-19
lines changed

3 files changed

+9
-19
lines changed

.gitignore

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,4 +57,7 @@ docs/_build/
5757
target/
5858

5959
.venv*
60-
.idea
60+
.idea
61+
62+
# generated by setuptools_scm
63+
pytest_asyncio/_version.py

pytest_asyncio/__init__.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
1+
12
"""The main point for importing pytest-asyncio items."""
2-
__version__ = "0.10.0.dev0"
3+
4+
from ._version import version as __version__

setup.py

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,12 @@
1-
import re
21
from pathlib import Path
32

43
from setuptools import setup, find_packages
54

65

7-
def find_version():
8-
version_file = (
9-
Path(__file__)
10-
.parent.joinpath("pytest_asyncio", "__init__.py")
11-
.read_text()
12-
)
13-
version_match = re.search(
14-
r"^__version__ = ['\"]([^'\"]*)['\"]", version_file, re.M
15-
)
16-
if version_match:
17-
return version_match.group(1)
18-
19-
raise RuntimeError("Unable to find version string.")
20-
21-
226
setup(
237
name="pytest-asyncio",
24-
version=find_version(),
8+
use_scm_version={"write_to": "pytest_asyncio/_version.py"},
9+
setup_requires=["setuptools-scm"],
2510
packages=find_packages(),
2611
url="https://github.com/pytest-dev/pytest-asyncio",
2712
license="Apache 2.0",

0 commit comments

Comments
 (0)