diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..974d2f3 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,12 @@ +[build-system] +requires = [ + "pip >= 19.3.1", + "setuptools >= 42", + "setuptools_scm[toml] >= 3.5.0", + "setuptools_scm_git_archive >= 1.1", + "wheel >= 0.33.6", +] +build-backend = "setuptools.build_meta" + +[tool.setuptools_scm] +local_scheme = "no-local-version" diff --git a/requirements.txt b/requirements.txt deleted file mode 100644 index 5592636..0000000 --- a/requirements.txt +++ /dev/null @@ -1,8 +0,0 @@ -# The order of packages is significant, because pip processes them in the order -# of appearance. Changing the order has an impact on the overall integration -# process, which may cause wedges in the gate later. - -docutils -restructuredtext-lint>=0.7 -stevedore -Pygments diff --git a/setup.cfg b/setup.cfg index b180b80..1db499d 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,7 +1,7 @@ [metadata] name = doc8 summary = Style checker for Sphinx (or other) RST documentation -description-file = +description_file = README.rst author = OpenStack author_email = openstack-discuss@lists.openstack.org @@ -40,3 +40,9 @@ extend_ignore = E203 [options] python_requires = >=3.6 +# These are required in actual runtime: +install_requires = + docutils + restructuredtext-lint>=0.7 + stevedore + Pygments diff --git a/setup.py b/setup.py deleted file mode 100644 index 90623e2..0000000 --- a/setup.py +++ /dev/null @@ -1,27 +0,0 @@ -# Copyright (c) 2013 Hewlett-Packard Development Company, L.P. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or -# implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# THIS FILE IS MANAGED BY THE GLOBAL REQUIREMENTS REPO - DO NOT EDIT -import setuptools - -# In python < 2.7.4, a lazy loading of package `pbr` will break -# setuptools if some other modules registered functions in `atexit`. -# solution from: http://bugs.python.org/issue15881#msg170215 -try: - import multiprocessing # noqa -except ImportError: - pass - -setuptools.setup(setup_requires=["pbr"], pbr=True) diff --git a/tox.ini b/tox.ini index ce4b300..1aa1c15 100644 --- a/tox.ini +++ b/tox.ini @@ -1,6 +1,7 @@ [tox] -minversion = 3.8 +minversion = 3.24.4 envlist = lint,py,docs,packaging +isolated_build = True [testenv] deps = @@ -8,6 +9,9 @@ deps = commands = pytest {posargs} whitelist_externals = rm + sh +setenv = + PIP_DISABLE_PIP_VERSION_CHECK=1 [testenv:lint] deps = @@ -19,25 +23,33 @@ commands = deps = -r{toxinidir}/doc/requirements.txt commands = - doc8 -e .rst doc CONTRIBUTING.rst README.rst + python -m doc8 -e .rst doc CONTRIBUTING.rst README.rst sphinx-build -W -b html doc/source doc/build/html [testenv:packaging] description = - Do packagin/distribution. If tag is not present or PEP440 compliant upload to - PYPI could fail -# `usedevelop = true` overrides `skip_install` instruction, it's unwanted + Build package, verify metadata, install package and assert behavior +deps = + build >= 0.7.0, < 0.8.0 + twine usedevelop = false -# don't install molecule itself in this env skip_install = true -deps = - collective.checkdocs >= 0.2 - pep517 >= 0.5.0 - twine >= 1.14.0 -setenv = +# Ref: https://twitter.com/di_codes/status/1044358639081975813 commands = - rm -rfv {toxinidir}/dist/ - python setup.py sdist bdist_wheel - # metadata validation - python -m setup checkdocs --verbose - python -m twine check {toxinidir}/dist/* + # build wheel and sdist using PEP-517 + {envpython} -c 'import os.path, shutil, sys; \ + dist_dir = os.path.join("{toxinidir}", "dist"); \ + os.path.isdir(dist_dir) or sys.exit(0); \ + print("Removing \{!s\} contents...".format(dist_dir), file=sys.stderr); \ + shutil.rmtree(dist_dir)' + {envpython} -m build \ + --outdir {toxinidir}/dist/ \ + {toxinidir} + # Validate metadata using twine + twine check --strict {toxinidir}/dist/* + # Ensure package is not installed + pip uninstall -y doc8 + # Install the wheel + sh -c "python3 -m pip install {toxinidir}/dist/*.whl" + # Ensure package can be uninstalled + pip uninstall -y doc8