Skip to content

Commit

Permalink
feat: use existing, then snap, then uv pyright (#299)
Browse files Browse the repository at this point in the history
This changes the way we get pyright, preferring the snap and no longer
having it frozen to a specific version.
  • Loading branch information
lengau authored Dec 13, 2024
1 parent 4918168 commit 0b70cf1
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
17 changes: 13 additions & 4 deletions common.mk
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ setup-tests: install-uv install-build-deps ##- Set up a testing environment with
uv sync --frozen

.PHONY: setup-lint
setup-lint: install-uv install-shellcheck install-lint-build-deps ##- Set up a linting-only environment
setup-lint: install-uv install-shellcheck install-pyright install-lint-build-deps ##- Set up a linting-only environment
uv sync --frozen --no-install-workspace --extra lint --extra types

.PHONY: setup-docs
Expand Down Expand Up @@ -121,9 +121,7 @@ endif
ifneq ($(shell which pyright),) # Prefer the system pyright
pyright --pythonpath .venv/bin/python
else
# Fix for a bug in npm
[ -d "/home/ubuntu/.npm/_cacache" ] && chown -R 1000:1000 "/home/ubuntu/.npm" || true
uv run pyright --pythonpath .venv/bin/python
uv tool run pyright --pythonpath .venv/bin/python
endif
ifneq ($(CI),)
@echo ::endgroup::
Expand Down Expand Up @@ -234,6 +232,17 @@ else
$(warning Codespell not installed. Please install it yourself.)
endif

.PHONY: install-pyright
install-pyright: install-uv
ifneq ($(shell which pyright),)
else ifneq ($(shell which snap),)
sudo snap install --classic pyright
else
# Workaround for a bug in npm
[ -d "$(HOME)/.npm/_cacache" ] && chown -R `id -u`:`id -g` "$(HOME)/.npm" || true
uv tool install pyright
endif

.PHONY: install-ruff
install-ruff:
ifneq ($(shell which ruff),)
Expand Down
1 change: 0 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ lint = [
]
types = [
"mypy[reports]~=1.13.0",
"pyright==1.1.390",
"types-Pygments",
"types-colorama",
"types-setuptools",
Expand Down

0 comments on commit 0b70cf1

Please sign in to comment.