Skip to content

Commit 54ecdaa

Browse files
committed
Switch to basedpyright for typechecking/LSP
1 parent 74b0a67 commit 54ecdaa

File tree

9 files changed

+63
-127
lines changed

9 files changed

+63
-127
lines changed

.github/workflows/typecheck.yaml

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

README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
[![Build Status](https://img.shields.io/pypi/v/optional.py.svg)](https://pypi.org/project/optional.py/)
44
[![test](https://github.com/Python-Optional/optional.py/actions/workflows/test.yaml/badge.svg)](https://github.com/Python-Optional/optional.py/actions/workflows/test.yaml)
55
[![lint](https://github.com/Python-Optional/optional.py/actions/workflows/lint.yaml/badge.svg)](https://github.com/Python-Optional/optional.py/actions/workflows/lint.yaml)
6-
[![typecheck](https://github.com/Python-Optional/optional.py/actions/workflows/typecheck.yaml/badge.svg)](https://github.com/Python-Optional/optional.py/actions/workflows/typecheck.yaml)
76
[![format](https://github.com/Python-Optional/optional.py/actions/workflows/format.yaml/badge.svg)](https://github.com/Python-Optional/optional.py/actions/workflows/format.yaml)
87
[![editorconfig](https://github.com/Python-Optional/optional.py/actions/workflows/editorconfig.yaml/badge.svg)](https://github.com/Python-Optional/optional.py/actions/workflows/editorconfig.yaml)
98
[![License](https://img.shields.io/pypi/l/optional.py.svg)](https://pypi.org/project/optional.py/)

justfile

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,24 @@ commands:
66
test:
77
@poetry run python -m pytest
88

9+
# Lint source code
10+
[parallel]
11+
lint: lint-ruff lint-basedpyright
12+
913
# Lint code using ruff
10-
lint:
14+
[private]
15+
lint-ruff:
1116
@poetry run python -m ruff check optional tests
1217

18+
# Lint code using basedpyright
19+
[private]
20+
lint-basedpyright:
21+
@poetry run python -m basedpyright optional tests
22+
1323
# Format code using ruff
1424
format:
1525
@poetry run python -m ruff format optional tests
1626

17-
# Check types using mypy
18-
typecheck:
19-
@poetry run python -m mypy optional tests
20-
2127
# Check for editorconfig violations using editorconfig-checker
2228
editorconfig:
2329
@editorconfig-checker

optional/optional.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ def of() -> Nothing: ...
2121

2222
@staticmethod
2323
@overload
24-
def of(thing: None) -> Nothing: ...
24+
def of(thing: None) -> Nothing: ... # pyright: ignore[reportOverlappingOverload]
2525

2626
@staticmethod
2727
@overload

optional/something.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ def __eq__(self, other: object) -> bool | NotImplementedType:
2525
if not isinstance(other, Something):
2626
return NotImplemented
2727

28-
return self._value == other._value
28+
return self._value == other._value # pyright: ignore[reportUnknownVariableType, reportUnknownMemberType]
2929

3030
@override
3131
def __repr__(self) -> str:

poetry.lock

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

pyproject.toml

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ version = "2.0.0"
44
description = "An implementation of the Optional object in Python"
55
license = "MIT"
66
authors = [
7-
{name = "Chad Befus", email = "crbefus@gmail.com"},
8-
{name = "Derek Passen", email = "dpassen1@gmail.com"}
7+
{ name = "Chad Befus", email = "crbefus@gmail.com" },
8+
{ name = "Derek Passen", email = "dpassen1@gmail.com" },
99
]
1010
readme = "README.md"
1111
repository = "https://github.com/Python-Optional/optional.py"
@@ -14,22 +14,18 @@ keywords = ["optional datatype library"]
1414
requires-python = ">= 3.10"
1515

1616
[project.optional-dependencies]
17-
dev = ["ruff", "mypy"]
17+
dev = ["ruff", "basedpyright", "typing-extensions"]
1818
test = ["pytest", "pytest-cov", "coveralls", "coverage"]
1919

2020
[tool.poetry]
21-
packages = [
22-
{ include = "optional" },
23-
]
21+
packages = [{ include = "optional" }]
2422

2523
[tool.coverage.report]
2624
exclude_lines = ["@overload"]
2725

2826
[tool.pytest.ini_options]
2927
addopts = "--cov=optional"
30-
testpaths = [
31-
"tests",
32-
]
28+
testpaths = ["tests"]
3329

3430
[tool.ruff]
3531
line-length = 88

tests/test_optional.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
# pyright: reportUnnecessaryComparison=false
2+
# pyright: reportUnreachable=false
3+
# pyright: reportUnusedCallResult = false
4+
15
import pytest
26

37
from optional import Nothing, Optional, Something

tests/test_something.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# pyright: reportUnusedCallResult = false
2+
13
import pytest
24

35
from optional import Optional, Something

0 commit comments

Comments
 (0)