From d6112ccb2cfc2ec325085241450325df0c36f5e1 Mon Sep 17 00:00:00 2001 From: "Rodweil, Theodor" Date: Mon, 7 Aug 2023 02:23:41 +0200 Subject: [PATCH] chore: add build environment --- .gitignore | 1 + pyproject.toml | 16 +++++++++++++++ tox.ini | 54 ++++++++++++++++++++++++++++++++++---------------- 3 files changed, 54 insertions(+), 17 deletions(-) create mode 100644 pyproject.toml diff --git a/.gitignore b/.gitignore index 9f714ca..6384480 100644 --- a/.gitignore +++ b/.gitignore @@ -4,6 +4,7 @@ __pycache__ /.tox *.egg-info +/dist/ # FAT stuff, in a filesystem sense ._* diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..74c2a98 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,16 @@ +[build-system] +requires = [ + "setuptools", + "wheel", + "setuptools-scm[toml]" +] +build-backend = "setuptools.build_meta" + +[tool.autopep8] +max_line_length = 80 +aggressive = 3 +recursive = true +in-place = true + +[tool.setuptools_scm] + diff --git a/tox.ini b/tox.ini index 8b124ce..4a83969 100644 --- a/tox.ini +++ b/tox.ini @@ -4,26 +4,46 @@ maxversion = 3.7.0 isolated_build = True -[testenv:docgen] -description = HTML documentation -basepython = python3 -allowlist_externals = - tox +[testenv:lint] +description = lint with pylint +setenv = PYTHONPATH = {toxinidir}/src +deps = + {toxinidir} + pylint >= 2.12.2, < 3 commands = - tox -e docgen-html - tox -e docgen-md - tox -e docgen-pdf + python3 -m pylint {toxinidir}/src {posargs} -[testenv:docgen-html] -description = HTML documentation +[testenv:format] +description = format code basepython = python3 -allowlist_externals = - sphinx-build - doxygen +deps = + autopep8 >= 1.6.0, < 2 +commands = + python3 -m autopep8 -v src/ {posargs} + + +[testenv:build] +description = build and package +basepython = python3 +setenv = PYTHONPATH = {toxinidir}/src deps = - sphinx-git - sphinx >= 4.3.2, < 5 - urllib3 >=1.26.6, < 2 + build >= 0.5.1, < 1 commands = - sphinx-build -d "{toxinidir}/build/docs/_tree/html" docs "build/docs/html" --color -W -bhtml {posargs} + python3 -m build {posargs} + + +[testenv:publish] +description = publish to pypi repository +passenv = + #https://twine.readthedocs.io/en/stable/#environment-variables + TWINE_USERNAME + TWINE_PASSWORD + TWINE_REPOSITORY + TWINE_REPOSITORY_URL + TWINE_CERT + TWINE_NON_INTERACTIVE +deps = + twine +commands = + python3 -m twine upload "dist/*"