diff --git a/.github/workflows/validation.yml b/.github/workflows/validation.yml index c21359e..1621485 100644 --- a/.github/workflows/validation.yml +++ b/.github/workflows/validation.yml @@ -34,7 +34,7 @@ jobs: restore-keys: "precommit-${{ runner.os }}-${{ steps.poetry_setup.outputs-python-version}}-" - name: Run pre-commit hooks - run: SKIP=ruff-linter,ruff-formatter,slotscheck,pyright pre-commit run --all-files + run: SKIP=ruff-linter,ruff-formatter,slotscheck,basedpyright pre-commit run --all-files - name: Run ruff linter run: ruff check --output-format=github --show-fixes --exit-non-zero-on-fix . @@ -45,5 +45,5 @@ jobs: - name: Run slotscheck run: slotscheck -m mcproto - - name: Run pyright type checker - run: pyright . + - name: Run basedpyright type checker + run: basedpyright . diff --git a/.pre-commit-config.yml b/.pre-commit-config.yml index 41e310f..9b6641b 100644 --- a/.pre-commit-config.yml +++ b/.pre-commit-config.yml @@ -35,10 +35,10 @@ repos: - repo: local hooks: - - id: pyright - name: Pyright - description: Run pyright type checker - entry: poetry run pyright + - id: basedpyright + name: BasedPyright + description: Run BasedPyright type checker + entry: poetry run basedpyright language: system types: [python] pass_filenames: false # pyright runs for the entire project, it can't run for single files diff --git a/poetry.lock b/poetry.lock index 69c4d79..f363b7f 100644 --- a/poetry.lock +++ b/poetry.lock @@ -20,6 +20,20 @@ doc = ["Sphinx (>=7)", "packaging", "sphinx-autodoc-typehints (>=1.2.0)", "sphin test = ["anyio[trio]", "coverage[toml] (>=7)", "exceptiongroup (>=1.2.0)", "hypothesis (>=4.0)", "psutil (>=5.9)", "pytest (>=7.0)", "pytest-mock (>=3.6.1)", "trustme", "uvloop (>=0.17)"] trio = ["trio (>=0.23)"] +[[package]] +name = "basedpyright" +version = "1.13.3" +description = "static type checking for Python (but based)" +optional = false +python-versions = ">=3.8" +files = [ + {file = "basedpyright-1.13.3-py3-none-any.whl", hash = "sha256:3162c5a5f4fc99f9d53d76cbd8e24d31ad4b28b4fb26a58ab8be6e8b634c99a7"}, + {file = "basedpyright-1.13.3.tar.gz", hash = "sha256:728d7098250db8d18bc4b48df8f93dfd9c79d155c3c99d41256a6caa6a21232e"}, +] + +[package.dependencies] +nodejs-wheel-binaries = ">=20.13.1" + [[package]] name = "certifi" version = "2024.6.2" @@ -247,6 +261,22 @@ files = [ {file = "nodeenv-1.9.1.tar.gz", hash = "sha256:6ec12890a2dab7946721edbfbcd91f3319c6ccc9aec47be7c7e6b7011ee6645f"}, ] +[[package]] +name = "nodejs-wheel-binaries" +version = "20.15.1" +description = "unoffical Node.js package" +optional = false +python-versions = ">=3.7" +files = [ + {file = "nodejs_wheel_binaries-20.15.1-py2.py3-none-macosx_10_15_x86_64.whl", hash = "sha256:a04537555f59e53021f8a2b07fa7aaac29d7793b7fae7fbf561bf9a859f4c67a"}, + {file = "nodejs_wheel_binaries-20.15.1-py2.py3-none-macosx_11_0_arm64.whl", hash = "sha256:b5ff04efa56a3fcd1fd09b30f5236c12bd84c10fcb222f3c0e04e1d497342b70"}, + {file = "nodejs_wheel_binaries-20.15.1-py2.py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:29c3e172e3fde3c13e7509312c81700736304dbd250745d87f00e7506065f3a5"}, + {file = "nodejs_wheel_binaries-20.15.1-py2.py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:9740f7456a43cb09521a1ac93a4355dc8282c41420f2d61ff631a01f39e2aa18"}, + {file = "nodejs_wheel_binaries-20.15.1-py2.py3-none-musllinux_1_2_x86_64.whl", hash = "sha256:bf5e239676efabb2fbaeff2f36d0bad8e2379f260ef44e13ef2151d037e40af3"}, + {file = "nodejs_wheel_binaries-20.15.1-py2.py3-none-win_amd64.whl", hash = "sha256:624936171b1aa2e1cc6d1718b1caa089e943b54df16568fa2f4576d145ac279a"}, + {file = "nodejs_wheel_binaries-20.15.1.tar.gz", hash = "sha256:b2f25b4f0e9a827ae1af8218ab13a385e279c236faf7b7c821e969bb8f6b25e8"}, +] + [[package]] name = "packaging" version = "24.1" @@ -336,24 +366,6 @@ nodeenv = ">=0.11.1" pyyaml = ">=5.1" virtualenv = ">=20.10.0" -[[package]] -name = "pyright" -version = "1.1.369" -description = "Command line wrapper for pyright" -optional = false -python-versions = ">=3.7" -files = [ - {file = "pyright-1.1.369-py3-none-any.whl", hash = "sha256:06d5167a8d7be62523ced0265c5d2f1e022e110caf57a25d92f50fb2d07bcda0"}, - {file = "pyright-1.1.369.tar.gz", hash = "sha256:ad290710072d021e213b98cc7a2f90ae3a48609ef5b978f749346d1a47eb9af8"}, -] - -[package.dependencies] -nodeenv = ">=1.6.0" - -[package.extras] -all = ["twine (>=3.4.1)"] -dev = ["twine (>=3.4.1)"] - [[package]] name = "pytest" version = "8.2.2" @@ -570,4 +582,4 @@ test = ["covdefaults (>=2.3)", "coverage (>=7.2.7)", "coverage-enable-subprocess [metadata] lock-version = "2.0" python-versions = "^3.11" -content-hash = "334a7105baa770bfd69d0391602995e317ccc0faa3d34539acbf7e9aa5355fee" +content-hash = "0201fdc3d3cb37b96f743109c61ab1a08e353bbe168de410418208199ae1a345" diff --git a/pyproject.toml b/pyproject.toml index f975398..e574b08 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -17,7 +17,7 @@ poethepoet = "^0.25.0" [tool.poetry.group.lint.dependencies] ruff = "^0.3.2" pre-commit = "^3.6.2" -pyright = "^1.1.359" +basedpyright = "^1.13.3" [tool.poetry.group.test.dependencies] pytest = "^8.1.1" @@ -133,6 +133,7 @@ line-ending = "lf" [tool.pyright] pythonVersion = "3.11" +typeCheckingMode = "standard" reportUntypedFunctionDecorator = "error" reportUntypedClassDecorator = "error" @@ -202,6 +203,10 @@ help = "Run ruff formatter" cmd = "pytest -v --failed-first" help = "Run pytest tests" +[tool.poe.tasks.pyright] +cmd = "basedpyright ." +help = "Run BasedPyright type-checker" + [tool.poe.tasks.retest] cmd = "pytest -v --last-failed" help = "Run previously failed tests using pytest"