From fe33a0e4618b4248c5ef9d343f19b4a302ba2d91 Mon Sep 17 00:00:00 2001 From: sebthom Date: Sun, 27 Apr 2025 15:17:58 +0200 Subject: [PATCH] refact: replace pyright with basedpyright --- .github/workflows/build.yml | 4 +-- pdm.lock | 53 ++++++++++++++++++++++--------------- pyproject.toml | 12 ++++----- 3 files changed, 39 insertions(+), 30 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 3791e39..4d2ef51 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -142,8 +142,8 @@ jobs: run: pdm run mypy - - name: Check with pyright - run: pdm run pyright + - name: Check with basedpyright + run: pdm run basedpyright - name: Run unit tests diff --git a/pdm.lock b/pdm.lock index a222f6a..c4325b5 100644 --- a/pdm.lock +++ b/pdm.lock @@ -5,7 +5,7 @@ groups = ["default", "dev"] strategy = ["inherit_metadata"] lock_version = "4.5.0" -content_hash = "sha256:80e909dc69fd15a5392e613ee67a6bf196707436c64df6f8a4ba75c5ba8d974d" +content_hash = "sha256:05e3eb1c92aae73ef7e522a95ac17df2040d98776ea4e50cf815001779fd32a2" [[metadata.targets]] requires_python = ">=3.10,<3.14" @@ -58,6 +58,20 @@ files = [ {file = "backports_tarfile-1.2.0.tar.gz", hash = "sha256:d75e02c268746e1b8144c278978b6e98e85de6ad16f8e4b0844a154557eca991"}, ] +[[package]] +name = "basedpyright" +version = "1.29.1" +requires_python = ">=3.8" +summary = "static type checking for Python (but based)" +groups = ["dev"] +dependencies = [ + "nodejs-wheel-binaries>=20.13.1", +] +files = [ + {file = "basedpyright-1.29.1-py3-none-any.whl", hash = "sha256:b7eb65b9d4aaeeea29a349ac494252032a75a364942d0ac466d7f07ddeacc786"}, + {file = "basedpyright-1.29.1.tar.gz", hash = "sha256:06bbe6c3b50ab4af20f80e154049477a50d8b81d2522eadbc9f472f2f92cd44b"}, +] + [[package]] name = "bracex" version = "2.5.post1" @@ -391,14 +405,24 @@ files = [ ] [[package]] -name = "nodeenv" -version = "1.9.1" -requires_python = "!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,!=3.5.*,!=3.6.*,>=2.7" -summary = "Node.js virtual environment builder" +name = "nodejs-wheel-binaries" +version = "22.15.0" +requires_python = ">=3.7" +summary = "unoffical Node.js package" groups = ["dev"] +dependencies = [ + "typing-extensions; python_version < \"3.8\"", +] files = [ - {file = "nodeenv-1.9.1-py2.py3-none-any.whl", hash = "sha256:ba11c9782d29c27c70ffbdda2d7415098754709be8a7056d79a737cd901155c9"}, - {file = "nodeenv-1.9.1.tar.gz", hash = "sha256:6ec12890a2dab7946721edbfbcd91f3319c6ccc9aec47be7c7e6b7011ee6645f"}, + {file = "nodejs_wheel_binaries-22.15.0-py2.py3-none-macosx_11_0_arm64.whl", hash = "sha256:aa16366d48487fff89446fb237693e777aa2ecd987208db7d4e35acc40c3e1b1"}, + {file = "nodejs_wheel_binaries-22.15.0-py2.py3-none-macosx_11_0_x86_64.whl", hash = "sha256:a54bb3fee9170003fa8abc69572d819b2b1540344eff78505fcc2129a9175596"}, + {file = "nodejs_wheel_binaries-22.15.0-py2.py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:867121ccf99d10523f6878a26db86e162c4939690e24cfb5bea56d01ea696c93"}, + {file = "nodejs_wheel_binaries-22.15.0-py2.py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:0ab0fbcda2ddc8aab7db1505d72cb958f99324b3834c4543541a305e02bfe860"}, + {file = "nodejs_wheel_binaries-22.15.0-py2.py3-none-musllinux_1_2_aarch64.whl", hash = "sha256:2bde1d8e00cd955b9ce9ee9ac08309923e2778a790ee791b715e93e487e74bfd"}, + {file = "nodejs_wheel_binaries-22.15.0-py2.py3-none-musllinux_1_2_x86_64.whl", hash = "sha256:acdd4ef73b6701aab9fbe02ac5e104f208a5e3c300402fa41ad7bc7f49499fbf"}, + {file = "nodejs_wheel_binaries-22.15.0-py2.py3-none-win_amd64.whl", hash = "sha256:51deaf13ee474e39684ce8c066dfe86240edb94e7241950ca789befbbbcbd23d"}, + {file = "nodejs_wheel_binaries-22.15.0-py2.py3-none-win_arm64.whl", hash = "sha256:01a3fe4d60477f93bf21a44219db33548c75d7fed6dc6e6f4c05cf0adf015609"}, + {file = "nodejs_wheel_binaries-22.15.0.tar.gz", hash = "sha256:ff81aa2a79db279c2266686ebcb829b6634d049a5a49fc7dc6921e4f18af9703"}, ] [[package]] @@ -537,21 +561,6 @@ files = [ {file = "pyinstaller_hooks_contrib-2025.3.tar.gz", hash = "sha256:af129da5cd6219669fbda360e295cc822abac55b7647d03fec63a8fcf0a608cf"}, ] -[[package]] -name = "pyright" -version = "1.1.400" -requires_python = ">=3.7" -summary = "Command line wrapper for pyright" -groups = ["dev"] -dependencies = [ - "nodeenv>=1.6.0", - "typing-extensions>=4.1", -] -files = [ - {file = "pyright-1.1.400-py3-none-any.whl", hash = "sha256:c80d04f98b5a4358ad3a35e241dbf2a408eee33a40779df365644f8054d2517e"}, - {file = "pyright-1.1.400.tar.gz", hash = "sha256:b8a3ba40481aa47ba08ffb3228e821d22f7d391f83609211335858bf05686bdb"}, -] - [[package]] name = "pytest" version = "8.3.5" diff --git a/pyproject.toml b/pyproject.toml index f98194f..cd0d0e9 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -55,7 +55,7 @@ dev = [ "autopep8", "ruff", "mypy", - "pyright", + "basedpyright", # packaging: "pyinstaller", "platformdirs", # required by pyinstaller @@ -83,7 +83,7 @@ compile.cmd = "python -O -m PyInstaller pyinstaller.spec --clean" compile.env = {PYTHONHASHSEED = "1", SOURCE_DATE_EPOCH = "0"} # https://pyinstaller.org/en/stable/advanced-topics.html#creating-a-reproducible-build debug = "python -m pdb -m kleinanzeigen_bot" format = "autopep8 --recursive --in-place src tests --verbose" -lint = {shell = "ruff check && mypy && pyright" } +lint = {shell = "ruff check && mypy && basedpyright" } fix = {shell = "ruff check --fix" } test = "python -m pytest --capture=tee-sys -v" utest = "python -m pytest --capture=tee-sys -v -m 'not itest'" @@ -259,11 +259,11 @@ verbosity = 0 ##################### -# pyright -# https://github.com/microsoft/pyright/ +# basedpyright +# https://github.com/detachhead/basedpyright ##################### -[tool.pyright] -# https://microsoft.github.io/pyright/#/configuration?id=main-configuration-options +[tool.basedpyright] +# https://docs.basedpyright.com/latest/configuration/config-files/ include = ["src", "tests"] defineConstant = { DEBUG = false } pythonVersion = "3.10"