Skip to content

Commit

Permalink
Version is now not hardcoded into files, but is fetched from git.
Browse files Browse the repository at this point in the history
Added pyproject.toml.
Removed unneeded pytest-runner from setup_requires.
  • Loading branch information
KOLANICH authored and nCTNIQWgVFzIsGInylicRmDsS committed May 28, 2021
1 parent f24ceb0 commit 63c2c6b
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 15 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
arpeggio/version.py

*.py[cod]

# C extensions
Expand Down Expand Up @@ -56,4 +58,4 @@ site
.cache
venv
.ropeproject
coverage
coverage
3 changes: 1 addition & 2 deletions arpeggio/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@
import bisect
from arpeggio.utils import isstr
import types

__version__ = "1.11.0.dev"
from .version import __version__

if sys.version < '3':
text = unicode
Expand Down
7 changes: 7 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[build-system]
requires = ["setuptools>=41", "wheel", "setuptools_scm[toml]>=3.4.3"]
build-backend = "setuptools.build_meta"

[tool.setuptools_scm]
write_to_template = "__version__ = \"{version}\"\n"
write_to = "arpeggio/version.py"
5 changes: 3 additions & 2 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,9 @@ classifiers =
packages = find:
include_package_data = True
setup_requires =
pytest-runner
setuptools>=41
wheel
setuptools_scm[toml]>=3.4.3
tests_require = pytest

[options.packages.find]
Expand Down Expand Up @@ -63,7 +64,7 @@ test=pytest

[tool:pytest]
addopts = --verbose
python_files = arpeggio/tests/*.py
python_files = arpeggio/tests/*.py

[flake8]
ignore = E741,W503
Expand Down
11 changes: 1 addition & 10 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,6 @@
import sys
from setuptools import setup

VERSIONFILE = "arpeggio/__init__.py"
VERSION = None
for line in open(VERSIONFILE, "r", encoding='utf8').readlines():
if line.startswith('__version__'):
VERSION = line.split('"')[1]

if not VERSION:
raise RuntimeError('No version defined in arpeggio/__init__.py')

if sys.argv[-1].startswith('publish'):
if os.system("pip list | grep wheel"):
print("wheel not installed.\nUse `pip install wheel`.\nExiting.")
Expand All @@ -43,4 +34,4 @@
print(" git push --tags")
sys.exit()

setup(version=VERSION)
setup()

0 comments on commit 63c2c6b

Please sign in to comment.