Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Initial pyright config and turn on type-checking in CI #2

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,24 @@ env:


jobs:
pyright:
strategy:
matrix:
python:
- "3.8"
- "3.11"
- "3.12"
platform:
- ubuntu-latest
- macos-latest
- windows-latest
runs-on: ${{ matrix.platform }}
steps:
- uses: actions/checkout@v4
- uses: jakebailey/pyright-action@v2
with:
python-version: ${{ matrix.python }}

test:
strategy:
matrix:
Expand Down
31 changes: 31 additions & 0 deletions pyrightconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{
"$schema": "https://raw.githubusercontent.com/microsoft/pyright/main/packages/vscode-pyright/schemas/pyrightconfig.schema.json",
"exclude": [
"build",
".tox",
"**/extern", // Vendored
"**/_vendor", // Vendored
"setuptools/_distutils", // Vendored
"**/tests", // Disabled as long as analyzeUnannotatedFunctions=false to reduce log spam
"**/_*", // Disabled as long as analyzeUnannotatedFunctions=false to reduce log spam
],
// CI should test for all versions, local development gets hints for oldest supported
"pythonVersion": "3.8",
// For now we don't mind if mypy's `type: ignore` comments accidentally suppresses pyright issues
"enableTypeIgnoreComments": true,
"typeCheckingMode": "basic",
// For now, align with mypy's default of skipping unnanotated functions, only care about public API which should be annotated
"analyzeUnannotatedFunctions": false,
// TODO: Test environment is not yet properly configured to install all imported packages
"reportMissingImports": "none",
// Too many issues caused by vendoring and dynamic patching, still worth fixing when we can
"reportAttributeAccessIssue": "warning",
// Defered initialization (initialize_options/finalize_options) causes many "potentially None" issues
// TODO: Fix with type-guards or by changing how it's initialized
"reportCallIssue": "warning",
"reportArgumentType": "warning",
"reportOptionalIterable": "warning",
"reportOptionalMemberAccess": "warning",
"reportGeneralTypeIssues": "warning",
"reportOptionalOperand": "warning",
}