Skip to content
Open
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
3 changes: 2 additions & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -189,13 +189,14 @@ jobs:
run: echo "$PWD/.venv/bin" >> $GITHUB_PATH
- name: List 3rd-party stub dependencies installed
run: uv pip freeze
- name: Run pyright with basic settings on all the stubs
- name: Run pyright with basic settings on stubs excluded from stricter checks
uses: jakebailey/pyright-action@v3
with:
version: PATH
python-platform: ${{ matrix.python-platform }}
python-version: ${{ matrix.python-version }}
annotate: ${{ matrix.python-version == '3.13' && matrix.python-platform == 'Linux' }} # Having each job create the same comment is too noisy.
project: ./pyrightconfig.basic.json
- name: Run pyright with stricter settings on some of the stubs
uses: jakebailey/pyright-action@v3
with:
Expand Down
100 changes: 100 additions & 0 deletions pyrightconfig.basic.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
{
"$schema": "https://raw.githubusercontent.com/microsoft/pyright/main/packages/vscode-pyright/schemas/pyrightconfig.schema.json",
"extends": "./pyrightconfig.json",
// Keep in sync with the exclude list in pyrightconfig.stricter.json.
"include": [
"**/@tests/test_cases",
"stdlib/__main__.pyi",
"stdlib/_operator.pyi",
"stdlib/_tkinter.pyi",
"stdlib/distutils/cmd.pyi",
"stdlib/distutils/command",
"stdlib/distutils/dist.pyi",
"stdlib/encodings/__init__.pyi",
"stdlib/lib2to3/fixes/*.pyi",
"stdlib/numbers.pyi",
"stdlib/operator.pyi",
"stdlib/tkinter/__init__.pyi",
"stdlib/tkinter/dialog.pyi",
"stdlib/tkinter/filedialog.pyi",
"stdlib/tkinter/scrolledtext.pyi",
"stdlib/tkinter/tix.pyi",
"stdlib/tkinter/ttk.pyi",
"stubs/antlr4-python3-runtime",
"stubs/auth0-python",
"stubs/Authlib",
"stubs/aws-xray-sdk",
"stubs/behave",
"stubs/boltons",
"stubs/braintree",
"stubs/cffi",
"stubs/colorful",
"stubs/dateparser",
"stubs/defusedxml",
"stubs/docker",
"stubs/docutils",
"stubs/Flask-SocketIO",
"stubs/gdb",
"stubs/geojson",
"stubs/geopandas",
"stubs/google-cloud-ndb",
"stubs/grpcio-channelz/grpc_channelz/v1",
"stubs/grpcio-health-checking/grpc_health/v1/health_pb2_grpc.pyi",
"stubs/grpcio-reflection/grpc_reflection/v1alpha",
"stubs/grpcio-status/grpc_status",
"stubs/grpcio/grpc/__init__.pyi",
"stubs/gunicorn/gunicorn/dirty",
"stubs/hdbcli/hdbcli/dbapi.pyi",
"stubs/html5lib",
"stubs/httplib2",
"stubs/hvac",
"stubs/jsonschema",
"stubs/jwcrypto",
"stubs/kafka-python",
"stubs/ldap3",
"stubs/m3u8/m3u8/model.pyi",
"stubs/Markdown",
"stubs/mock/mock/mock.pyi",
"stubs/mysqlclient",
"stubs/netaddr/netaddr/core.pyi",
"stubs/netaddr/netaddr/ip/__init__.pyi",
"stubs/netaddr/netaddr/ip/iana.pyi",
"stubs/networkx",
"stubs/oauthlib",
"stubs/openpyxl",
"stubs/opentracing/opentracing/span.pyi",
"stubs/paramiko/paramiko/_winapi.pyi",
"stubs/parsimonious/parsimonious/nodes.pyi",
"stubs/peewee",
"stubs/pexpect",
"stubs/pika/pika/adapters/twisted_connection.pyi",
"stubs/pika/pika/adapters/utils/connection_workflow.pyi",
"stubs/pika/pika/callback.pyi",
"stubs/pika/pika/channel.pyi",
"stubs/pony",
"stubs/protobuf",
"stubs/psutil/psutil/__init__.pyi",
"stubs/psycopg2",
"stubs/punq",
"stubs/pyasn1",
"stubs/pycups",
"stubs/Pygments",
"stubs/PyMySQL",
"stubs/pyogrio",
"stubs/python-jose",
"stubs/pywin32",
"stubs/PyYAML",
"stubs/reportlab",
"stubs/requests",
"stubs/requests-oauthlib",
"stubs/seaborn",
"stubs/setuptools/setuptools",
"stubs/shapely",
"stubs/simple-websocket",
"stubs/tensorflow",
"stubs/tqdm",
"stubs/vobject",
"stubs/workalendar",
"stubs/xmldiff",
],
}
13 changes: 13 additions & 0 deletions tests/check_typeshed_structure.py
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,18 @@ def check_pyright_exclude_order() -> None:
), f"Entry '{exclude[i]}' should come before '{exclude[i + 1]}' in the {PYRIGHT_CONFIG.name} exclude list"


def check_pyright_configs_consistent() -> None:
"""Check that basic and stricter Pyright runs cover complementary paths."""
stricter_config = json.loads(jsonc_to_json(PYRIGHT_CONFIG.read_text(encoding="utf-8")))
basic_config_path = PYRIGHT_CONFIG.with_name("pyrightconfig.basic.json")
basic_config = json.loads(jsonc_to_json(basic_config_path.read_text(encoding="utf-8")))

assert basic_config.get("extends") == "./pyrightconfig.json"
assert basic_config.get("include") == stricter_config.get(
"exclude"
), f"The include list in {basic_config_path.name} must match the exclude list in {PYRIGHT_CONFIG.name}"


if __name__ == "__main__":
check_versions_file()
check_metadata()
Expand All @@ -198,3 +210,4 @@ def check_pyright_exclude_order() -> None:
check_distutils()
check_test_cases()
check_pyright_exclude_order()
check_pyright_configs_consistent()