diff --git a/.github/workflows/code-checks.yml b/.github/workflows/code-checks.yml index 433489a6..59d01343 100644 --- a/.github/workflows/code-checks.yml +++ b/.github/workflows/code-checks.yml @@ -16,3 +16,20 @@ jobs: - uses: actions/checkout@v4 - uses: actions/setup-python@v4 - uses: pre-commit/action@v2.0.3 + + pyright: + name: "Run Pyright" + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-python@v4 + with: + python-version: 3.12 # Use the maximum version supported by python-pins + - name: Install dependencies + shell: bash + run: | + python -m pip install --upgrade pip + python -m pip install -e .[check] + - uses: jakebailey/pyright-action@v2 + with: + version: 1.1.372 # Manually sync with setup.cfg diff --git a/Makefile b/Makefile index 3396b1b7..0250ce60 100644 --- a/Makefile +++ b/Makefile @@ -41,7 +41,7 @@ docs-clean: requirements/dev.txt: setup.cfg @# allows you to do this... @# make requirements | tee > requirements/some_file.txt - @pip-compile setup.cfg --rebuild --extra doc --extra test --output-file=- > $@ + @pip-compile setup.cfg --rebuild --extra doc --extra test --extra check --output-file=- > $@ binder/requirements.txt: requirements/dev.txt cp $< $@ diff --git a/README.md b/README.md index af007b66..31955ddb 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # pins -![PyPI - Version](https://img.shields.io/pypi/v/pins.svg) ![PyPI - Python Version](https://img.shields.io/pypi/pyversions/pins) +![PyPI - Version](https://img.shields.io/pypi/v/pins.svg) ![PyPI - Python Version](https://img.shields.io/pypi/pyversions/pins) [![Checked with pyright](https://microsoft.github.io/pyright/img/pyright_badge.svg)](https://microsoft.github.io/pyright/) diff --git a/pyproject.toml b/pyproject.toml index 10af66e3..3497c51a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -36,6 +36,11 @@ dependencies = [ [project.optional-dependencies] aws = ["s3fs"] azure = ["adlfs"] +check = [ + "pre-commit", + "pyright==1.1.372", # Pinned; manually sync with .github/workflows/code-checks.yml + "types-appdirs", +] doc = [ "ipykernel", "ipython<=8.12", @@ -85,6 +90,31 @@ testpaths = ["pins"] addopts = "--doctest-modules" doctest_optionflags = "NORMALIZE_WHITESPACE" +[tool.pyright] +include = ["pins"] +exclude = ["**/__pycache__"] +ignore = ["pins/tests"] +pythonVersion = "3.12" # Use the maximum version supported by python-pins +pythonPlatform = "Linux" + +# Tracking compliance with these rules at https://github.com/rstudio/pins-python/issues/272 +reportArgumentType = false +reportAssignmentType = false +reportAttributeAccessIssue = false +reportCallIssue = false +reportGeneralTypeIssues = false +reportIncompatibleMethodOverride = false +reportIncompatibleVariableOverride = false +reportIndexIssue = false +reportMissingImports = false +reportMissingTypeStubs = false +reportOptionalIterable = false +reportOptionalMemberAccess = false +reportOptionalSubscript = false +reportPossiblyUnboundVariable = false +reportReturnType = false +reportUnusedExpression = false + [tool.ruff] line-length = 90 extend-exclude = ["docs"] diff --git a/requirements/dev.txt b/requirements/dev.txt index 5c1249c4..2b2a43a0 100644 --- a/requirements/dev.txt +++ b/requirements/dev.txt @@ -2,7 +2,7 @@ # This file is autogenerated by pip-compile with Python 3.11 # by the following command: # -# pip-compile --extra=doc --extra=test --output-file=- --strip-extras setup.cfg +# pip-compile --extra=doc --extra=test --extra=check --output-file=- --strip-extras setup.cfg # --index-url https://pypi.python.org/simple/ --trusted-host pypi.org @@ -67,6 +67,8 @@ cffi==1.16.0 # via # azure-datalake-store # cryptography +cfgv==3.4.0 + # via pre-commit charset-normalizer==3.3.2 # via requests click==8.1.7 @@ -93,12 +95,16 @@ decorator==5.1.1 # via # gcsfs # ipython +distlib==0.3.8 + # via virtualenv executing==2.0.1 # via stack-data fastjsonschema==2.20.0 # via nbformat fastparquet==2024.5.0 # via pins (setup.cfg) +filelock==3.15.4 + # via virtualenv frozenlist==1.4.1 # via # aiohttp @@ -141,6 +147,8 @@ griffe==0.48.0 # via quartodoc humanize==4.10.0 # via pins (setup.cfg) +identify==2.6.0 + # via pre-commit idna==3.7 # via # requests @@ -220,6 +228,10 @@ nbformat==5.10.4 # pins (setup.cfg) nest-asyncio==1.6.0 # via ipykernel +nodeenv==1.9.1 + # via + # pre-commit + # pyright numpy==2.0.0 # via # fastparquet @@ -247,13 +259,17 @@ pickleshare==0.7.5 pip-tools==7.4.1 # via pins (setup.cfg) platformdirs==4.2.2 - # via jupyter-core + # via + # jupyter-core + # virtualenv pluggy==1.5.0 # via pytest plum-dispatch==2.5.1.post1 # via quartodoc portalocker==2.10.1 # via msal-extensions +pre-commit==3.7.1 + # via pins (setup.cfg) prompt-toolkit==3.0.47 # via ipython proto-plus==1.24.0 @@ -297,6 +313,8 @@ pyproject-hooks==1.1.0 # via # build # pip-tools +pyright==1.1.372 + # via pins (setup.cfg) pytest==7.1.3 # via # pins (setup.cfg) @@ -320,6 +338,7 @@ pytz==2024.1 pyyaml==6.0.1 # via # pins (setup.cfg) + # pre-commit # quartodoc pyzmq==26.0.3 # via @@ -384,6 +403,8 @@ traitlets==5.14.3 # matplotlib-inline # nbclient # nbformat +types-appdirs==1.4.3.5 + # via pins (setup.cfg) typing-extensions==4.12.2 # via # azure-core @@ -398,6 +419,8 @@ urllib3==2.2.2 # via # botocore # requests +virtualenv==20.26.3 + # via pre-commit watchdog==4.0.1 # via quartodoc wcwidth==0.2.13