Skip to content

Commit cf19ae2

Browse files
committed
added pyright ci check
1 parent 767f869 commit cf19ae2

5 files changed

Lines changed: 113 additions & 4 deletions

File tree

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: Pyright Type Check
2+
3+
on:
4+
pull_request:
5+
branches: ["*"]
6+
push:
7+
branches: ["*"]
8+
9+
jobs:
10+
pyright:
11+
name: Pyright Type Check
12+
runs-on: ubuntu-latest
13+
14+
steps:
15+
- name: Checkout repository
16+
uses: actions/checkout@v4
17+
18+
- name: Set up Python
19+
uses: actions/setup-python@v5
20+
with:
21+
python-version: '3.12.10'
22+
23+
- name: Set up uv
24+
uses: astral-sh/setup-uv@v3
25+
26+
- name: Install dependencies (locked)
27+
run: uv sync --frozen
28+
29+
- name: Run Pyright
30+
run: uv run pyright

.github/workflows/uv-env-check.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Environment Check (uv sync)
1+
name: uv environment check
22

33
on:
44
pull_request:
@@ -15,9 +15,9 @@ jobs:
1515
uses: actions/checkout@v4
1616

1717
- name: Setup uv (with cache)
18-
uses: astral-sh/setup-uv@v3
18+
uses: astral-sh/setup-uv@v6
1919
with:
20-
enable-cache: true
20+
version: "0.8.15"
2121

2222
# If you commit .python-version, this ensures the exact interpreter is available
2323
- name: Pin Python

pyproject.toml

Lines changed: 42 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,45 @@ version = "0.1.0"
44
description = "Add your description here"
55
readme = "README.md"
66
requires-python = "==3.12.10"
7-
dependencies = []
7+
dependencies = [
8+
"pyright>=1.1.404",
9+
]
10+
11+
[tool.pyright]
12+
# --- Environment & discovery ---
13+
pythonVersion = "3.12.10" # Target Python semantics (pattern matching, typing features, stdlib types).
14+
venvPath = "." # Where virtual envs live relative to repo root.
15+
venv = ".venv" # The specific env name uv manages (uv sync creates .venv).
16+
17+
# --- What to analyze ---
18+
include = ["src", "tests"] # Top-level packages & tests to check.
19+
exclude = [
20+
"**/.venv", "**/__pycache__", "build", "dist", ".git",
21+
".ruff_cache", ".mypy_cache"
22+
]
23+
24+
# --- Global strictness ---
25+
typeCheckingMode = "strict" # Enforce full strict mode repo-wide (see notes below).
26+
useLibraryCodeForTypes = true # If a lib lacks stubs, inspect its code to infer types where possible.
27+
28+
# Make the most common "loose" mistakes fail fast in strict mode.
29+
# You can tune these individually if you need a temporary carve-out.
30+
reportMissingTypeStubs = "error" # Untyped third-party libs must have type info (stubs or inline).
31+
reportUnknownVariableType = "error" # Vars with unknown/implicit Any are not allowed.
32+
reportUnknownMemberType = "error" # Members on unknowns are not allowed.
33+
reportUnknownArgumentType = "error" # Call arguments can't be unknown.
34+
reportUnknownLambdaType = "error" # Lambda params must be typed in strict contexts.
35+
reportImplicitOptional = "error" # T | None must be explicit; no silent Optional.
36+
reportMissingTypeArgument = "error" # Generic types must specify their parameters.
37+
reportIncompatibleVariableOverride = "error" # Subclass fields must type-refine correctly.
38+
reportInvalidTypeVarUse = "error" # Catch misuse of TypeVar/variance.
39+
reportUntypedFunctionDecorator = "error" # Decorators must be typed (prevents Any leakage).
40+
reportUnusedVariable = "error" # Ditto; promote to "error" if you want hard hygiene.
41+
reportUnusedImport = "warning" # Hygiene: warn, but don’t fail builds.
42+
43+
44+
# Tests often deserialize lots of data and patch frameworks; keep them strict,
45+
# but relax "missing stubs" so untyped test-only libs don’t block you.
46+
[[tool.pyright.overrides]]
47+
module = "tests/**"
48+
reportMissingTypeStubs = "warning"

main.py renamed to src/main.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,5 @@ def main():
33

44

55
if __name__ == "__main__":
6+
x=5
67
main()

uv.lock

Lines changed: 37 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)