From 7c992b55b02f0d1e4b10e9e5bfdec0080710dfc9 Mon Sep 17 00:00:00 2001 From: David Stansby Date: Tue, 9 Jan 2024 14:48:09 +0000 Subject: [PATCH 1/4] Add configuration for running stubtest using tox --- .gitignore | 1 + environment.yml | 3 ++- tox.ini | 11 ++++++++++- 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index 41c97b62c51e..b6f9e1ee74f4 100644 --- a/.gitignore +++ b/.gitignore @@ -31,6 +31,7 @@ ################ # meson-python working directory build +.mesonpy* # meson-python/build frontend dist directory dist diff --git a/environment.yml b/environment.yml index 9f06ab7ff143..d50e544edb0d 100644 --- a/environment.yml +++ b/environment.yml @@ -46,6 +46,7 @@ dependencies: - sphinxcontrib-svg2pdfconverter>=1.1.0 - pikepdf # testing + - black<24 - coverage - flake8>=3.8 - flake8-docstrings>=1.4.0 @@ -64,4 +65,4 @@ dependencies: - pytest-xdist - tornado - pytz - - black<24 + - tox diff --git a/tox.ini b/tox.ini index fc8479269160..cb2fcc979076 100644 --- a/tox.ini +++ b/tox.ini @@ -4,7 +4,7 @@ # and then run "tox" from this directory. [tox] -envlist = py38, py39, py310 +envlist = py38, py39, py310, stubtest [testenv] changedir = /tmp @@ -25,3 +25,12 @@ commands = deps = pytest pytz + +[testenv:stubtest] +changedir = {tox_root} +commands = + python tools/stubtest.py +usedevelop = False +deps = + -r requirements/testing/mypy.txt + -r requirements/testing/all.txt From b0dd5ab08c5433a64ce1b4484c4d0add8127eb00 Mon Sep 17 00:00:00 2001 From: David Stansby Date: Tue, 9 Jan 2024 14:55:36 +0000 Subject: [PATCH 2/4] Use tox in stubtest CI Fix reviewdog sed Add tox install stage --- .github/workflows/mypy-stubtest.yml | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/.github/workflows/mypy-stubtest.yml b/.github/workflows/mypy-stubtest.yml index f042688feb62..1280926021f1 100644 --- a/.github/workflows/mypy-stubtest.yml +++ b/.github/workflows/mypy-stubtest.yml @@ -18,12 +18,6 @@ jobs: with: python-version: 3.9 - - name: Install mypy - run: | - pip3 install -r requirements/testing/mypy.txt \ - -r requirements/testing/all.txt - pip3 install . - - name: Set up reviewdog run: | mkdir -p "$HOME/bin" @@ -32,13 +26,16 @@ jobs: sh -s -- -b "$HOME/bin" echo "$HOME/bin" >> $GITHUB_PATH + - name: Install tox + run: python -m pip install tox + - name: Run mypy stubtest env: REVIEWDOG_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | set -o pipefail - MPLBACKEND=agg python tools/stubtest.py | \ - sed -e "s!$pythonLocation/lib/python3.9/site-packages!lib!g" | \ + tox -e stubtest | \ + sed -e "s!.tox/stubtest/lib/python3.11/site-packages!lib!g" | \ reviewdog \ -efm '%Eerror: %m' \ -efm '%CStub: in file %f:%l' \ From 106ce164d84f7a71ef83bb3c988ae21f45bef1b6 Mon Sep 17 00:00:00 2001 From: David Stansby Date: Wed, 10 Jan 2024 13:52:33 +0000 Subject: [PATCH 3/4] Add instructions on running stubtest --- doc/devel/coding_guide.rst | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/doc/devel/coding_guide.rst b/doc/devel/coding_guide.rst index 6564de906979..b1c0a810c965 100644 --- a/doc/devel/coding_guide.rst +++ b/doc/devel/coding_guide.rst @@ -88,9 +88,8 @@ We generally use `stub files the type information for ``colors.py``. A notable exception is ``pyplot.py``, which is type hinted inline. -Type hints are checked by the mypy :ref:`pre-commit hook ` -and can often be verified using ``tools\stubtest.py`` and occasionally may -require the use of ``tools\check_typehints.py``. +Type hints are checked by the mypy :ref:`pre-commit hook `, +can often be verified by running ``tox -e stubtest``. New modules and files: installation =================================== From 590d477a9f3ad2243ecef2ebe665279c26fb37e3 Mon Sep 17 00:00:00 2001 From: David Stansby Date: Tue, 16 Jan 2024 13:10:47 +0000 Subject: [PATCH 4/4] Fix tox stubtest python path Co-authored-by: Kyle Sunden --- .github/workflows/mypy-stubtest.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/mypy-stubtest.yml b/.github/workflows/mypy-stubtest.yml index 1280926021f1..f009720a43e0 100644 --- a/.github/workflows/mypy-stubtest.yml +++ b/.github/workflows/mypy-stubtest.yml @@ -35,7 +35,7 @@ jobs: run: | set -o pipefail tox -e stubtest | \ - sed -e "s!.tox/stubtest/lib/python3.11/site-packages!lib!g" | \ + sed -e "s!.tox/stubtest/lib/python3.9/site-packages!lib!g" | \ reviewdog \ -efm '%Eerror: %m' \ -efm '%CStub: in file %f:%l' \ pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy