Skip to content

Commit 16166cd

Browse files
authored
Adopt modern python packaging (#68)
1 parent da7aaa4 commit 16166cd

File tree

5 files changed

+47
-52
lines changed

5 files changed

+47
-52
lines changed

pyproject.toml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
[build-system]
2+
requires = [
3+
"pip >= 19.3.1",
4+
"setuptools >= 42",
5+
"setuptools_scm[toml] >= 3.5.0",
6+
"setuptools_scm_git_archive >= 1.1",
7+
"wheel >= 0.33.6",
8+
]
9+
build-backend = "setuptools.build_meta"
10+
11+
[tool.setuptools_scm]
12+
local_scheme = "no-local-version"

requirements.txt

Lines changed: 0 additions & 8 deletions
This file was deleted.

setup.cfg

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[metadata]
22
name = doc8
33
summary = Style checker for Sphinx (or other) RST documentation
4-
description-file =
4+
description_file =
55
README.rst
66
author = OpenStack
77
author_email = [email protected]
@@ -40,3 +40,9 @@ extend_ignore = E203
4040

4141
[options]
4242
python_requires = >=3.6
43+
# These are required in actual runtime:
44+
install_requires =
45+
docutils
46+
restructuredtext-lint>=0.7
47+
stevedore
48+
Pygments

setup.py

Lines changed: 0 additions & 27 deletions
This file was deleted.

tox.ini

Lines changed: 28 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,17 @@
11
[tox]
2-
minversion = 3.8
2+
minversion = 3.24.4
33
envlist = lint,py,docs,packaging
4+
isolated_build = True
45

56
[testenv]
67
deps =
78
-r{toxinidir}/test-requirements.txt
89
commands = pytest {posargs}
910
whitelist_externals =
1011
rm
12+
sh
13+
setenv =
14+
PIP_DISABLE_PIP_VERSION_CHECK=1
1115

1216
[testenv:lint]
1317
deps =
@@ -19,25 +23,33 @@ commands =
1923
deps =
2024
-r{toxinidir}/doc/requirements.txt
2125
commands =
22-
doc8 -e .rst doc CONTRIBUTING.rst README.rst
26+
python -m doc8 -e .rst doc CONTRIBUTING.rst README.rst
2327
sphinx-build -W -b html doc/source doc/build/html
2428

2529
[testenv:packaging]
2630
description =
27-
Do packagin/distribution. If tag is not present or PEP440 compliant upload to
28-
PYPI could fail
29-
# `usedevelop = true` overrides `skip_install` instruction, it's unwanted
31+
Build package, verify metadata, install package and assert behavior
32+
deps =
33+
build >= 0.7.0, < 0.8.0
34+
twine
3035
usedevelop = false
31-
# don't install molecule itself in this env
3236
skip_install = true
33-
deps =
34-
collective.checkdocs >= 0.2
35-
pep517 >= 0.5.0
36-
twine >= 1.14.0
37-
setenv =
37+
# Ref: https://twitter.com/di_codes/status/1044358639081975813
3838
commands =
39-
rm -rfv {toxinidir}/dist/
40-
python setup.py sdist bdist_wheel
41-
# metadata validation
42-
python -m setup checkdocs --verbose
43-
python -m twine check {toxinidir}/dist/*
39+
# build wheel and sdist using PEP-517
40+
{envpython} -c 'import os.path, shutil, sys; \
41+
dist_dir = os.path.join("{toxinidir}", "dist"); \
42+
os.path.isdir(dist_dir) or sys.exit(0); \
43+
print("Removing \{!s\} contents...".format(dist_dir), file=sys.stderr); \
44+
shutil.rmtree(dist_dir)'
45+
{envpython} -m build \
46+
--outdir {toxinidir}/dist/ \
47+
{toxinidir}
48+
# Validate metadata using twine
49+
twine check --strict {toxinidir}/dist/*
50+
# Ensure package is not installed
51+
pip uninstall -y doc8
52+
# Install the wheel
53+
sh -c "python3 -m pip install {toxinidir}/dist/*.whl"
54+
# Ensure package can be uninstalled
55+
pip uninstall -y doc8

0 commit comments

Comments
 (0)