From ea48ca52a0bac0b306d635c0d131cba746d91ba2 Mon Sep 17 00:00:00 2001 From: John Mulligan Date: Wed, 21 May 2025 13:30:36 -0400 Subject: [PATCH 1/8] ci: remove pep8 from test matrix The pep8 job was not running pep8 and instead is just a repeat of the py3 environment. Signed-off-by: John Mulligan --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 8263ff9..b906c9d 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -21,7 +21,7 @@ jobs: strategy: fail-fast: false matrix: - tox_env: [py39, py310, py311, py312, py313, pypy3, pep8] + tox_env: [py39, py310, py311, py312, py313, pypy3] # Use GitHub's Linux Docker host runs-on: ubuntu-latest From 74f6b72b7ba3de8689451485b19a2ef787abc67b Mon Sep 17 00:00:00 2001 From: John Mulligan Date: Wed, 21 May 2025 12:00:01 -0400 Subject: [PATCH 2/8] pyproject: add tox configuration to pyproject.toml Add tox configuration to pyproject.toml matching the original configuration in tox.ini minus the pep8 entry in the envlist. This entry did not run pep8 and was thus misleading and not worth bringing over to the new configuration. Signed-off-by: John Mulligan --- pyproject.toml | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/pyproject.toml b/pyproject.toml index fe76d54..d8b7a2a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -13,3 +13,19 @@ local_scheme = "no-local-version" target-version = "py39" line-length = 109 lint.select = ["E", "F", "I", "UP"] + +### tox configuration ### +[tool.tox] +env_list = ["py313", "py312", "py311", "py310", "py39", "pypy3"] + +[tool.tox.env_run_base] +description = "Run test suite on {base_python}" +deps = ["-r{toxinidir}/test-requirements.txt"] +commands = [ + ["nose2", "--coverage", "varlink"] +] + +[tool.tox.env_run_base.set_env] +VIRTUAL_ENV="{envdir}" +BRANCH_NAME="master" +CLIENT_NAME="varlink" From 2b55b79eefd5c05fe8f349552afc909c3b04595d Mon Sep 17 00:00:00 2001 From: John Mulligan Date: Wed, 21 May 2025 08:38:36 -0400 Subject: [PATCH 3/8] ci: remove tox.ini in favor of pyproject.toml Remove tox.ini in favor of the tox configuration in pyproject.toml. This requires tox >= 4.21.0 (from Oct. 2024). Signed-off-by: John Mulligan --- tox.ini | 20 -------------------- 1 file changed, 20 deletions(-) delete mode 100644 tox.ini diff --git a/tox.ini b/tox.ini deleted file mode 100644 index 7f72306..0000000 --- a/tox.ini +++ /dev/null @@ -1,20 +0,0 @@ -# tox (https://tox.readthedocs.io/) is a tool for running tests -# in multiple virtualenvs. This configuration file will run the -# test suite on all supported python versions. To use it, "pip install tox" -# and then run "tox" from this directory. - -[tox] -envlist = py313,py312,py311,py310,py39,pep8,pypy3 - -[testenv] -usedevelop = True -install_command = pip install {opts} {packages} -setenv = - VIRTUAL_ENV={envdir} - BRANCH_NAME=master - CLIENT_NAME=varlink -deps = - -r{toxinidir}/test-requirements.txt -commands = - nose2 \ - --coverage varlink From c07c79e99dc13a05f4affba278c8d6d844f2cd22 Mon Sep 17 00:00:00 2001 From: John Mulligan Date: Wed, 21 May 2025 12:03:27 -0400 Subject: [PATCH 4/8] pyproject: switch to pytest Fixes: #42 Switch to using pytest instead of nose2. Test coverage is done with pytest-cov. Signed-off-by: John Mulligan --- pyproject.toml | 2 +- test-requirements.txt | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index d8b7a2a..4896cb9 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -22,7 +22,7 @@ env_list = ["py313", "py312", "py311", "py310", "py39", "pypy3"] description = "Run test suite on {base_python}" deps = ["-r{toxinidir}/test-requirements.txt"] commands = [ - ["nose2", "--coverage", "varlink"] + ["pytest", "--cov=varlink", "--cov-report=term", "{posargs:varlink}"] ] [tool.tox.env_run_base.set_env] diff --git a/test-requirements.txt b/test-requirements.txt index 7696e32..9955dec 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -1,2 +1,2 @@ -fixtures -nose2 +pytest +pytest-cov From eeccc4123044460164f71a40ddc3e3964ec93e5d Mon Sep 17 00:00:00 2001 From: John Mulligan Date: Wed, 21 May 2025 13:26:47 -0400 Subject: [PATCH 5/8] pyproject: add ruff and mypy testenvs Add ruff and mypy test envs for tox to pyproject.toml. Signed-off-by: John Mulligan --- pyproject.toml | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/pyproject.toml b/pyproject.toml index 4896cb9..7f137eb 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -29,3 +29,27 @@ commands = [ VIRTUAL_ENV="{envdir}" BRANCH_NAME="master" CLIENT_NAME="varlink" + +[tool.tox.env.ruff-format] +description = "Check formatting using the ruff tool" +deps = ["ruff"] +commands = [ + ["ruff", "--version"], + ["ruff", "format", "--quiet", "--check", "--diff", "{posargs:varlink}"] +] + +[tool.tox.env.ruff-check] +description = "Run linting checks using the ruff tool" +deps = ["ruff"] +commands = [ + ["ruff", "--version"], + ["ruff", "check", "{posargs:varlink}"] +] + +[tool.tox.env.mypy] +description = "Run type checking tool mypy" +deps = ["mypy"] +commands = [ + ["mypy", "--version"], + ["mypy", "{posargs:varlink}"] +] From fed9879e1e94b91926b6853fb407a3534d009986 Mon Sep 17 00:00:00 2001 From: John Mulligan Date: Mon, 2 Jun 2025 09:55:10 -0400 Subject: [PATCH 6/8] pyproject: add mypy configuration block with python 3.9 syntax Add a mypy configuration block to the pyproject.toml file that configures mypy to use python 3.9 syntax, the oldest version of python that the library supports. Signed-off-by: John Mulligan --- pyproject.toml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pyproject.toml b/pyproject.toml index 7f137eb..d18bfe5 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -14,6 +14,9 @@ target-version = "py39" line-length = 109 lint.select = ["E", "F", "I", "UP"] +[tool.mypy] +python_version = 3.9 + ### tox configuration ### [tool.tox] env_list = ["py313", "py312", "py311", "py310", "py39", "pypy3"] From f1296dc33088664e411e49654f746a94dd86e32b Mon Sep 17 00:00:00 2001 From: John Mulligan Date: Wed, 21 May 2025 08:40:42 -0400 Subject: [PATCH 7/8] ci: simplify workflow files to use tox instead of ruff directly Use tox as a wrapper around the ruff checks so that it is easier to run the same checks locally and in the ci. Signed-off-by: John Mulligan --- .github/workflows/main.yml | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index b906c9d..833abed 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -32,21 +32,14 @@ jobs: - uses: actions/checkout@v4 with: fetch-depth: 0 - - name: Install ruff - run: | - python3 -m pip install --break-system-packages ruff mypy + - name: Install tox + run: python -m pip install tox - name: Run ruff format run: | - ruff --version - if ! ruff format --check --quiet varlink - then - echo "Please run 'ruff format' on the above files or apply the diffs below manually" - ruff format --check --quiet --diff varlink - fi + tox -e ruff-format - name: Run ruff check run: | - ruff --version - ruff check varlink + tox -e ruff-check - name: Type Checking (mypy) run: | python3 -m mypy --version From 0b006c61198787d44464bdcc2b00ce81c5555679 Mon Sep 17 00:00:00 2001 From: John Mulligan Date: Wed, 21 May 2025 08:48:30 -0400 Subject: [PATCH 8/8] ci: convert workflow file to use tox to run mypy Convert workflow file to use tox to run mypy. Signed-off-by: John Mulligan --- .github/workflows/main.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 833abed..a4e25ff 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -42,6 +42,5 @@ jobs: tox -e ruff-check - name: Type Checking (mypy) run: | - python3 -m mypy --version - python3 -m mypy varlink/ + tox -e mypy runs-on: ubuntu-latest