Skip to content

Commit 736addf

Browse files
authored
Use typeshed stubs for more complete static analysis of CircuitPython code (#29)
* Add typeshed * Upgrade pyright
1 parent 227f587 commit 736addf

File tree

5 files changed

+17
-124
lines changed

5 files changed

+17
-124
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ coverage-reports/
99
tools/
1010
venv
1111
**/*.mpy
12+
typeshed/
1213
firmware.uf2
1314

1415
# libs

Makefile

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
PYSQUARED_VERSION ?= v2.0.0-alpha-25w29
1+
PYSQUARED_VERSION ?= v2.0.0-alpha-25w34
22
PYSQUARED ?= git+https://github.com/proveskit/pysquared@$(PYSQUARED_VERSION)
33
BOARD_MOUNT_POINT ?= ""
44
BOARD_TTY_PORT ?= ""
55
VERSION ?= $(shell git tag --points-at HEAD --sort=-creatordate < /dev/null | head -n 1)
66

77
.PHONY: all
8-
all: .venv download-libraries pre-commit-install help
8+
all: .venv typeshed download-libraries pre-commit-install help
99

1010
.PHONY: help
1111
help: ## Display this help.
@@ -19,6 +19,11 @@ help: ## Display this help.
1919
@$(UV) venv
2020
@$(UV) sync
2121

22+
typeshed: ## Install CircuitPython typeshed stubs
23+
@echo "Installing CircuitPython typeshed stubs..."
24+
@$(MAKE) uv
25+
@$(UV) pip install circuitpython-typeshed==0.1.0 --target typeshed
26+
2227
.PHONY: download-libraries
2328
download-libraries: download-libraries-flight-software download-libraries-ground-station
2429

@@ -44,7 +49,8 @@ sync-time: uv ## Syncs the time from your computer to the PROVES Kit board
4449
fmt: pre-commit-install ## Lint and format files
4550
$(UVX) pre-commit run --all-files
4651

47-
typecheck: .venv download-libraries ## Run type check
52+
.PHONY: typecheck
53+
typecheck: .venv download-libraries typeshed ## Run type check
4854
@$(UV) run -m pyright .
4955

5056
.PHONY: install

pyproject.toml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ dev = [
1111
"adafruit-circuitpython-typing==1.12.1",
1212
"circuitpython-stubs==9.2.8",
1313
"pre-commit==4.2.0",
14-
"pyright[nodejs]==1.1.402",
14+
"pyright[nodejs]==1.1.404",
1515
]
1616

1717
[tool.ruff.format]
@@ -37,6 +37,8 @@ exclude = [
3737
"artifacts",
3838
"src/*/lib",
3939
"typings",
40+
"typeshed",
4041
]
4142
stubPath = "./typings"
43+
typeshedPath = "./typeshed"
4244
reportMissingModuleSource = false

typings/gc.pyi

Lines changed: 0 additions & 116 deletions
This file was deleted.

uv.lock

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

0 commit comments

Comments
 (0)