summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRaphaël Barrois <raphael.barrois@polytechnique.org>2021-03-02 11:20:51 +0100
committerRaphaël Barrois <raphael.barrois@polytechnique.org>2021-03-02 11:30:48 +0100
commit82025b32e75e724dac99350a5d6a84782f7484b3 (patch)
tree1aaa5d4fe5eb87f894a6048a70b90f67dd51c9da
parent88b077b1cc19a4754ef004ff0ca07c3d2bb8ef19 (diff)
downloadsemantic-version-82025b32e75e724dac99350a5d6a84782f7484b3.tar.gz
Move package metadata to setup.cfg
Instead of relying on setup.py, use setup.cfg. Dev/doc requirements have been moved there as well, under the `doc` and `dev` extras.
-rw-r--r--Makefile2
-rw-r--r--requirements.txt1
-rw-r--r--requirements_dev.txt14
-rw-r--r--requirements_test.txt3
-rw-r--r--semantic_version/__init__.py10
-rw-r--r--setup.cfg57
-rwxr-xr-xsetup.py67
-rw-r--r--tox.ini5
8 files changed, 64 insertions, 95 deletions
diff --git a/Makefile b/Makefile
index c94363c..811d72a 100644
--- a/Makefile
+++ b/Makefile
@@ -27,7 +27,7 @@ clean:
update:
pip install --upgrade pip setuptools
- pip install --upgrade -r requirements_dev.txt
+ pip install --upgrade -e .[dev,doc]
pip freeze
diff --git a/requirements.txt b/requirements.txt
deleted file mode 100644
index e18794f..0000000
--- a/requirements.txt
+++ /dev/null
@@ -1 +0,0 @@
-# No hard external requirements.
diff --git a/requirements_dev.txt b/requirements_dev.txt
deleted file mode 100644
index 741f337..0000000
--- a/requirements_dev.txt
+++ /dev/null
@@ -1,14 +0,0 @@
-# Requirements for local development
--e .
--r requirements_test.txt
-
-Django>=1.11
-
-coverage
-wheel
-tox
-
-Sphinx
-sphinx_rtd_theme
-
-zest.releaser[recommended]
diff --git a/requirements_test.txt b/requirements_test.txt
deleted file mode 100644
index 35012df..0000000
--- a/requirements_test.txt
+++ /dev/null
@@ -1,3 +0,0 @@
-# Common requirements for running tests
-check_manifest
-flake8
diff --git a/semantic_version/__init__.py b/semantic_version/__init__.py
index 3e3f789..1528bda 100644
--- a/semantic_version/__init__.py
+++ b/semantic_version/__init__.py
@@ -7,4 +7,12 @@ from .base import compare, match, validate, SimpleSpec, NpmSpec, Spec, SpecItem,
__author__ = "Raphaël Barrois <raphael.barrois+semver@polytechnique.org>"
-__version__ = '2.8.6.dev0'
+try:
+ # Python 3.8+
+ from importlib.metadata import version
+
+ __version__ = version("semantic_version")
+except ImportError:
+ import pkg_resources
+
+ __version__ = pkg_resources.get_distribution("semantic_version").version
diff --git a/setup.cfg b/setup.cfg
index e6ff787..3e5e632 100644
--- a/setup.cfg
+++ b/setup.cfg
@@ -1,15 +1,60 @@
-[bdist_wheel]
-universal = 1
-
[metadata]
+name = semantic_version
+version = 2.8.6.dev0
+description = A library implementing the 'SemVer' scheme.
+long_description = file: README.rst
+# https://docutils.sourceforge.io/FAQ.html#what-s-the-official-mime-type-for-restructuredtext-data
+long_description_content_type = text/x-rst
+author = Raphaël Barrois
+author_email = raphael.barrois+semver@polytechnique.org
+url = https://github.com/rbarrois/python-semanticversion
+keywords = semantic version, versioning, version
+license = BSD
license_file = LICENSE
+classifiers =
+ Development Status :: 5 - Production/Stable
+ Intended Audience :: Developers
+ License :: OSI Approved :: BSD License
+ Topic :: Software Development :: Libraries :: Python Modules
+ Operating System :: OS Independent
+ Programming Language :: Python
+ Programming Language :: Python :: 2.7
+ Programming Language :: Python :: 3
+ Programming Language :: Python :: 3.4
+ Programming Language :: Python :: 3.5
+ Programming Language :: Python :: 3.6
+ Programming Language :: Python :: 3.7
+ Topic :: Software Development :: Libraries :: Python Modules
+
+[options]
+zip_safe = false
+packages = semantic_version
+python_requires = >= 2.7
+install_requires =
+
+[options.extras_require]
+dev =
+ Django>=1.11
+ # Runners
+ tox
+ # Quality
+ check_manifest
+ coverage
+ flake8
+ # Packaging
+ wheel
+ zest.releaser[recommended]
+
+doc =
+ Sphinx
+ sphinx_rtd_theme
+
+[bdist_wheel]
+universal = 1
[zest.releaser]
; semver-style versions
version-levels = 3
-; Version flag location (we use __version__)
-python-file-with-version = semantic_version/__init__.py
-
[distutils]
index-servers = pypi
diff --git a/setup.py b/setup.py
index 7ad8d5f..02a989b 100755
--- a/setup.py
+++ b/setup.py
@@ -3,71 +3,6 @@
# Copyright (c) The python-semanticversion project
-import codecs
-import os
-import re
-
from setuptools import setup
-root_dir = os.path.abspath(os.path.dirname(__file__))
-
-
-def get_version(package_name):
- version_re = re.compile(r"^__version__ = [\"']([\w_.-]+)[\"']$")
- package_components = package_name.split('.')
- init_path = os.path.join(root_dir, *(package_components + ['__init__.py']))
- with codecs.open(init_path, 'r', 'utf-8') as f:
- for line in f:
- match = version_re.match(line[:-1])
- if match:
- return match.groups()[0]
- return '0.1.0'
-
-
-def clean_readme(fname):
- """Cleanup README.rst for proper PyPI formatting."""
- with codecs.open(fname, 'r', 'utf-8') as f:
- return ''.join(
- re.sub(r':\w+:`([^`]+?)( <[^<>]+>)?`', r'``\1``', line)
- for line in f
- if not (line.startswith('.. currentmodule') or line.startswith('.. toctree'))
- )
-
-
-PACKAGE = 'semantic_version'
-
-
-setup(
- name=PACKAGE,
- version=get_version(PACKAGE),
- author="Raphaël Barrois",
- author_email="raphael.barrois+semver@polytechnique.org",
- description="A library implementing the 'SemVer' scheme.",
- long_description=clean_readme('README.rst'),
- license='BSD',
- keywords=['semantic version', 'versioning', 'version'],
- url='https://github.com/rbarrois/python-semanticversion',
- download_url='http://pypi.python.org/pypi/semantic_version/',
- packages=['semantic_version'],
- python_requires=">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*",
- setup_requires=[
- 'setuptools>=0.8',
- ],
- zip_safe=False,
- classifiers=[
- 'Development Status :: 5 - Production/Stable',
- 'Intended Audience :: Developers',
- 'License :: OSI Approved :: BSD License',
- 'Topic :: Software Development :: Libraries :: Python Modules',
- 'Operating System :: OS Independent',
- 'Programming Language :: Python',
- 'Programming Language :: Python :: 2.7',
- 'Programming Language :: Python :: 3',
- 'Programming Language :: Python :: 3.4',
- 'Programming Language :: Python :: 3.5',
- 'Programming Language :: Python :: 3.6',
- 'Programming Language :: Python :: 3.7',
- 'Topic :: Software Development :: Libraries :: Python Modules'
- ],
- test_suite='tests',
-)
+setup()
diff --git a/tox.ini b/tox.ini
index 2841dbb..d5cab59 100644
--- a/tox.ini
+++ b/tox.ini
@@ -8,8 +8,8 @@ envlist =
toxworkdir = {env:TOX_WORKDIR:.tox}
[testenv]
+extras = dev
deps =
- -rrequirements_test.txt
django111: Django>=1.11,<1.12
django22: Django>=2.2,<2.3
@@ -17,8 +17,7 @@ whitelist_externals = make
commands = make test
[testenv:lint]
-deps =
- -rrequirements_test.txt
+extras = dev
whitelist_externals = make
commands = make lint