basedpyright
basedpyright copied to clipboard
pyright fork with various type checking improvements, improved vscode support and pylance features built into the language server
### Description `py.typed` is the stupidest thing ever. by default, for some insane reason, the spec says that type checkers should ignore type annotations in 3rd party packages unless the...
### Description Code sample in [basedpyright playground](https://basedpyright.com/?typeCheckingMode=all&code=CYUwZgBGD20NoBUC6AKAhgLgtARgKxAGMAXAGghywQEoIBaAPggQwFgAoCLiNAZ15AAnYjwgBLXhQ7cIgkMQCuggHaiAxBCGDogqgE8ADiAgAiXARInxk5dBF9eYgObK0OADbHi0CMUPGTBAABGGgTIA) ```python def foo[T](a: object, b: T) -> T: assert a is b return a # error: Type "object" is not assignable to type...
### Description in my experience, most generics that have both a default and a bound use the same type for both: ```py def foo[T: int = int](): ... ``` maybe...
### Description ```python from __future__ import annotations from functools import wraps from typing import Any, Callable, Generic, Literal, TypeVar, overload if __name__ == "__main__": class Test(): @overload def sendcmd(self, cmd:...
 This screenshot is from [scipy-stubs](https://github.com/jorenham/scipy-stubs), specifically in `scipy-stubs/sparse/csgraph/_validation.pyi` (the relevant code isn't pushed yet, but will be soon). So here the `basedpyright` suggested to import `sparray` from `scipy.sparse._base`, which...
### Description ```py def f() -> object: return lambda: 1 class E(Enum): a = f() # expect error: `object` can potentially be `FunctionType`, wrap this value with `enum.member` to enforce...
`basedpyright`'s type checking is helpful, but sometime I'd just want to ignore the error for the 3rd library without manually typing ` # pyright: ignore[reportUnknownVariableType,reportUnknownMemberType]`...
### Description I noticed that adding non hashable elements to est via `set.add(elem)` was not generating any warning like it is the case for keys with dictionaries. Example: ```python from...
original issue: https://github.com/microsoft/pyright/issues/1997 > **Is your feature request related to a problem? Please describe.** > > I work on a large project (Apache Airflow) and using the "workspace" symbols is...
### Description I have a custom decorator that uses the docstring of a function as a template ```python @prompt def prompt_args_test(name: str, age: int): """Hello, I am {{ name }}...