From 96b5a07f20e7e0a9ae6088db1d6ba62dd7aa10d3 Mon Sep 17 00:00:00 2001 From: Alexander Hess Date: Tue, 1 Dec 2026 15:00:26 +0100 Subject: [PATCH] Add `pyright` to the "lint" session --- noxfile.py | 12 ++++++++---- pyproject.toml | 9 +++++++++ uv.lock | 36 ++++++++++++++++++++++++++++++++++++ 3 files changed, 53 insertions(+), 4 deletions(-) diff --git a/noxfile.py b/noxfile.py index 1abc577..708324b 100644 --- a/noxfile.py +++ b/noxfile.py @@ -3,7 +3,7 @@ By default, `uv run nox` runs the sessions that assure code quality: - "format": Format source files with `autoflake`, `black`, `flynt`, `isort`, and `ruff` -- "lint": Lint source files with `flake8`, `isort`, `mypy`, and `ruff` +- "lint": Lint source files with `flake8`, `isort`, `mypy`, `pyright`, and `ruff` - "test": Run the test suite with `pytest` - "doctest": Check if code snippets in the docstrings run @@ -183,13 +183,13 @@ def format_code(session: nox.Session) -> None: @nox.session(name="lint", python=MAIN_PYTHON) def lint_code(session: nox.Session) -> None: - """Lint source files with `flake8`, `isort`, `mypy`, and `ruff`. + """Lint source files with `flake8`, `isort`, `mypy`, `pyright`, and `ruff`. If no extra arguments are provided, all source files are linted. Otherwise, they are interpreted as paths the linters work on recursively. - `mypy` always checks the noxfile, the scripts, and the package regardless - because it needs the whole program to follow types across modules. + `mypy` and `pyright` always check the noxfile, the scripts, and the package + regardless because they need the whole program to follow types across modules. """ start(session) @@ -233,6 +233,7 @@ def lint_code(session: nox.Session) -> None: "pandas-vet", "pep8-naming", "pydoclint[flake8]", + "pyright[nodejs]", "ruff", "tryceratops", ) @@ -254,6 +255,9 @@ def lint_code(session: nox.Session) -> None: session.run("mypy", "--version") session.run("mypy", NOXFILE_LOCATION, SCRIPTS_LOCATION, PACKAGE_LOCATION) + session.run("pyright", "--version") + session.run("pyright", NOXFILE_LOCATION, SCRIPTS_LOCATION, PACKAGE_LOCATION) + @nox.session(name="test", python=MAIN_PYTHON) def test_code(session: nox.Session) -> None: diff --git a/pyproject.toml b/pyproject.toml index fb580cc..8afe366 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -123,6 +123,7 @@ dev = [ "pandas-vet (>=2023.8.2)", "pep8-naming (>=0.15.1,<0.16.0)", "pydoclint[flake8] (>=0.12.0,<0.13.0)", + "pyright[nodejs] (>=1.1.414,<2.0.0)", "ruff (>=0.17.6,<0.18.0)", "tryceratops (>=2.4.1,<3.0.0)", ] @@ -525,6 +526,14 @@ ignore_missing_imports = true +[tool.pyright] +# Source: https://microsoft.github.io/pyright/#/configuration + +# Treat libraries without type annotations as `Any`, like `mypy` does +useLibraryCodeForTypes = false + + + [tool.pytest.ini_options] # Source: https://docs.pytest.org/en/stable/reference/reference.html#ini-options-ref diff --git a/uv.lock b/uv.lock index b6af5e4..4338e67 100644 --- a/uv.lock +++ b/uv.lock @@ -2337,6 +2337,22 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/2d/6a/8a9ac7d5e2f7cf53c459bfef90ebc17a2f8cd54b665af96799d4c534840e/nodeenv-1.12.0-py3-none-any.whl", hash = "sha256:80644d65c10cc2be12e3e4b54b3367ff288c7ad24ae75c2dcc65454fc7449d4d", size = 39442, upload-time = "2026-10-31T19:03:17.427Z" }, ] +[[package]] +name = "nodejs-wheel-binaries" +version = "24.19.0" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/c0/76/7e97195e14346598565a0de4ca8bdbd5e634b3fb5b1ba590b7b1b89f8a63/nodejs_wheel_binaries-24.19.0.tar.gz", hash = "sha256:db217eef8cab8551667863379b08db4d9067403f6cbbe87481eb40edceb8aa9b", size = 8058, upload-time = "2026-08-19T21:47:19.671Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/8c/52/0774b52c7be8151ad9d5aff44edc100c3f13d6d8eb3765f63ffa40e69fe8/nodejs_wheel_binaries-24.19.0-py2.py3-none-macosx_13_0_arm64.whl", hash = "sha256:e12cbfd69089504e42fb14194ce734a9dcf3eb38c820ca63dd511d36fb964e9c", size = 56047203, upload-time = "2026-08-19T21:46:43.448Z" }, + { url = "https://files.pythonhosted.org/packages/67/3a/4fdbbfecf2c23d52c0e3f68de7f7c1b3c97a26d328c69c5f6c49c48e340e/nodejs_wheel_binaries-24.19.0-py2.py3-none-macosx_13_0_x86_64.whl", hash = "sha256:1c890adf4b7e6556ccc1ca66c866bb81884b6c9a581dee4e530dc7f78fb9d514", size = 56219459, upload-time = "2026-08-19T21:46:48.45Z" }, + { url = "https://files.pythonhosted.org/packages/5f/a8/0147149415195c59b8a72a594916bfb80d6be4d586f9fbfda313889e0efc/nodejs_wheel_binaries-24.19.0-py2.py3-none-manylinux_2_28_aarch64.whl", hash = "sha256:4e029dadfae1295876063c96b236f673487e8c27379fe146c1e2250283520227", size = 60588256, upload-time = "2026-08-19T21:46:53.298Z" }, + { url = "https://files.pythonhosted.org/packages/f4/89/6631d0982353da1bb7bc00bb1988f702822c62b42634f57999ee53b5c337/nodejs_wheel_binaries-24.19.0-py2.py3-none-manylinux_2_28_x86_64.whl", hash = "sha256:4196a947bcc883f2003ab101762d729f3e99b5e86b75bd09151563403e2eceb8", size = 61123607, upload-time = "2026-08-19T21:46:58.117Z" }, + { url = "https://files.pythonhosted.org/packages/32/a2/fa30f0841e4602995782e124359f9b910c7b481d98decf61ef0b2fc3ebfb/nodejs_wheel_binaries-24.19.0-py2.py3-none-musllinux_1_2_aarch64.whl", hash = "sha256:352e048ab4dd35e7de5f338d1cc4fcbf77a0e93da30bf7336a8217ee246b31d7", size = 62632842, upload-time = "2026-08-19T21:47:03.42Z" }, + { url = "https://files.pythonhosted.org/packages/18/01/22d97ca72213f66cc386ee638db30c2e62757fdf761c6029074bced83d1c/nodejs_wheel_binaries-24.19.0-py2.py3-none-musllinux_1_2_x86_64.whl", hash = "sha256:28d078b2ced9e2069516e652dc4b1380e7a1a7f2d3934eccd1611586d283ba4c", size = 63250653, upload-time = "2026-08-19T21:47:07.938Z" }, + { url = "https://files.pythonhosted.org/packages/88/d1/e3be8fa327a795bcaf7a19cd84299e338a7bce32ff0665fdce9cfa22573c/nodejs_wheel_binaries-24.19.0-py2.py3-none-win_amd64.whl", hash = "sha256:67e3abeb9c3830cae8c8487ae8a2af7cc27dfa75af06145cee5ca7d1857c81bd", size = 42448503, upload-time = "2026-08-19T21:47:12.093Z" }, + { url = "https://files.pythonhosted.org/packages/1d/37/34cf28ba1691a060174948a9927fe61091982d6048b2e403071a9acce443/nodejs_wheel_binaries-24.19.0-py2.py3-none-win_arm64.whl", hash = "sha256:d9074c665ea68b04e183d82482c86dc907d3a9bd15eb6cf85542cb785266bb36", size = 40090155, upload-time = "2026-08-19T21:47:16.032Z" }, +] + [[package]] name = "notebook-shim" version = "0.2.4" @@ -2886,6 +2902,24 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/38/bb/d215ee7c73b61497b28a5503f9f53523f294fcc936762b7caf90e0c1c2b5/pyparsing-3.3.3-py3-none-any.whl", hash = "sha256:ece8c00a69cf01b45d0b1dedabb469c90d8caf996d4fda40f147627a122849a4", size = 126420, upload-time = "2026-09-20T20:59:04.025Z" }, ] +[[package]] +name = "pyright" +version = "1.1.414" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "nodeenv" }, + { name = "typing-extensions" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/e1/1b/244c7b710031ada80f27e579ec20d28a2285dfc318fed0339866b1047f12/pyright-1.1.414.tar.gz", hash = "sha256:523c0a97c60da6333234955c277730c9cf4f5bd6d5399e7b7d2b0fc5d3599524", size = 4154638, upload-time = "2026-09-10T12:26:53.181Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/d7/ba/18b6e682ead424ad24bcc134339ae5d1b931cd9ae260540592a058a91279/pyright-1.1.414-py3-none-any.whl", hash = "sha256:2a6b4b3298c9eec174c5ed83bd338de6eee82df2992f3e1930e6199d381be36f", size = 6225049, upload-time = "2026-09-10T12:26:51.427Z" }, +] + +[package.optional-dependencies] +nodejs = [ + { name = "nodejs-wheel-binaries" }, +] + [[package]] name = "pytest" version = "9.2.0" @@ -3990,6 +4024,7 @@ dev = [ { name = "pep8-naming" }, { name = "pre-commit" }, { name = "pydoclint", extra = ["flake8"] }, + { name = "pyright", extra = ["nodejs"] }, { name = "ruff" }, { name = "tryceratops" }, ] @@ -4071,6 +4106,7 @@ dev = [ { name = "pep8-naming", specifier = ">=0.15.1,<0.16.0" }, { name = "pre-commit", specifier = ">=4.7.0,<5.0.0" }, { name = "pydoclint", extras = ["flake8"], specifier = ">=0.12.0,<0.13.0" }, + { name = "pyright", extras = ["nodejs"], specifier = ">=1.1.414,<2.0.0" }, { name = "ruff", specifier = ">=0.17.6,<0.18.0" }, { name = "tryceratops", specifier = ">=2.4.1,<3.0.0" }, ]