Skip to content

Commit aa5faaf

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

File tree

9 files changed

+64
-125
lines changed

9 files changed

+64
-125
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: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,22 @@ 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+
lint-ruff:
1115
@poetry run python -m ruff check optional tests
1216

17+
# Lint code using basedpyright
18+
lint-basedpyright:
19+
@poetry run python -m basedpyright optional tests
20+
1321
# Format code using ruff
1422
format:
1523
@poetry run python -m ruff format optional tests
1624

17-
# Check types using mypy
18-
typecheck:
19-
@poetry run python -m mypy optional tests
20-
2125
# Check for editorconfig violations using editorconfig-checker
2226
editorconfig:
2327
@editorconfig-checker

optional/optional.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# pyright: reportOverlappingOverload = false
2+
13
from typing import TypeAlias, TypeVar, overload
24

35
from optional.nothing import Nothing

optional/something.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
# pyright: reportUnknownMemberType = false
2+
# pyright: reportUnknownVariableType = false
3+
14
from types import NotImplementedType
25
from typing import Generic, TypeVar, final
36

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)