Skip to content

Commit c04e35b

Browse files
committed
Remove explicit version specification
This commit removes the explicit listing of the version number in both __init__.py and setup.py, and replaces the former with the version number computed by setuptools_scm. As a prerequisite to that, I've added a configuration item in pyproject.toml to have setuptools_scm write the version number to a file. I've imported the version number under the name `VERSION` to keep it compatibile with previous versions of pytest_localserver. If `version` is a more standard identifier, we might want to change or add that in the future.
1 parent 0d5a948 commit c04e35b

File tree

3 files changed

+4
-10
lines changed

3 files changed

+4
-10
lines changed

pyproject.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
11
[build-system]
22
requires = ["setuptools >=42", "setuptools_scm[toml] >=3.4.1", "wheel"]
33
build-backend = "setuptools.build_meta"
4+
5+
[tool.setuptools_scm]
6+
write_to = "pytest_localserver/_version.py"

pytest_localserver/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
VERSION = '0.5.1.post0'
1+
from pytest_localserver._version import version as VERSION

setup.py

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,12 @@
22
import sys
33

44

5-
VERSION = '0.5.1.post0'
6-
7-
85
def read(fname):
96
# makes sure that setup can be executed from a different location
107
import os.path
118
_here = os.path.abspath(os.path.dirname(__file__))
129
return open(os.path.join(_here, fname)).read()
1310

14-
# make sure that versions match before uploading anything to the cheeseshop
15-
if 'upload' in sys.argv or 'register' in sys.argv:
16-
import pytest_localserver
17-
assert pytest_localserver.VERSION == VERSION
18-
1911

2012
class PyTest(Command):
2113
user_options = []
@@ -30,7 +22,6 @@ def run(self):
3022

3123
setup(
3224
name='pytest-localserver',
33-
version=VERSION,
3425
author='Sebastian Rahlf',
3526
author_email='[email protected]',
3627
maintainer='David Zaslavsky',

0 commit comments

Comments
 (0)