diff --git a/.gitignore b/.gitignore index 3c5ec96..a6f15f1 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,5 @@ +arpeggio/version.py + *.py[cod] # C extensions @@ -56,4 +58,4 @@ site .cache venv .ropeproject -coverage \ No newline at end of file +coverage diff --git a/arpeggio/__init__.py b/arpeggio/__init__.py index 7739d9f..0fb15b2 100644 --- a/arpeggio/__init__.py +++ b/arpeggio/__init__.py @@ -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 diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..7618045 --- /dev/null +++ b/pyproject.toml @@ -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" diff --git a/setup.cfg b/setup.cfg index 0ed5841..8b971b0 100644 --- a/setup.cfg +++ b/setup.cfg @@ -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] @@ -63,7 +64,7 @@ test=pytest [tool:pytest] addopts = --verbose -python_files = arpeggio/tests/*.py +python_files = arpeggio/tests/*.py [flake8] ignore = E741,W503 diff --git a/setup.py b/setup.py index cce78eb..5dfd42d 100644 --- a/setup.py +++ b/setup.py @@ -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.") @@ -43,4 +34,4 @@ print(" git push --tags") sys.exit() -setup(version=VERSION) +setup()