From 93e62b578429e8cf6ef4614be5832673538e1122 Mon Sep 17 00:00:00 2001 From: MrKevinWeiss Date: Wed, 3 Jul 2024 11:07:56 +0200 Subject: [PATCH] fix: check package should work This is based on the pyscaffold template and seems to fix the now failing check package --- .github/workflows/tox.yml | 3 +++ tox.ini | 22 +++++++++++++++++++++- 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/.github/workflows/tox.yml b/.github/workflows/tox.yml index 549ecc5..15bb70c 100644 --- a/.github/workflows/tox.yml +++ b/.github/workflows/tox.yml @@ -36,6 +36,9 @@ jobs: - name: Check code format with black if: matrix.python-version == '3.9' run: tox -e black + - name: Build package + if: matrix.python-version == '3.9' + run: tox -e build - name: Check package if: matrix.python-version == '3.9' run: tox -e check_package diff --git a/tox.ini b/tox.ini index 4e298b6..358845f 100644 --- a/tox.ini +++ b/tox.ini @@ -45,11 +45,31 @@ commands = pylint --rcfile=setup.cfg {envsitepackagesdir}/{env:package} # This does not check files in 'tests/utils/application' +[testenv:{build,clean}] +description = + build: Build the package in isolation according to PEP517, see https://github.com/pypa/build + clean: Remove old distribution files and temporary build artifacts (./build and ./dist) +# https://setuptools.pypa.io/en/stable/build_meta.html#how-to-use-it +skip_install = True +changedir = {toxinidir} +deps = + build: build[virtualenv] +passenv = + SETUPTOOLS_* +commands = + clean: python -c 'import shutil; [shutil.rmtree(p, True) for p in ("build", "dist", "docs/_build")]' + clean: python -c 'import pathlib, shutil; [shutil.rmtree(p, True) for p in pathlib.Path("src").glob("*.egg-info")]' + build: python -m build {posargs} +# By default, both `sdist` and `wheel` are built. If your sdist is too big or you don't want +# to make it available, consider running: `tox -e build -- --wheel` + [testenv:check_package] +changedir = {toxinidir} +skip_install = True deps = twine commands = - twine check --strict {distdir}/* + python -m twine check dist/* [testenv:flake8] deps = flake8