KotlinIsland / KotlinIsland/basedmypy

A flag to treat third-party `Any` as `object`/`Untyped`

Open
#148 2 comments 0 reactions 0 assignees View on GitHub
feature feedback p-1 topic-any
Dominant language
Python
Stars
202
Forks
6
PR merge metrics
No merged PRs in 30d

Description

The flag will default to false and will be mandatory for all targets.

Eg:
thirdparty.pyi
```py
def foo(a: list[Any]) -> Any: ...
```

my.py
```py
from thirdparty import foo
reveal_type(foo) # def (a: list[object]) -> object

a: int = foo([1]) # error: expression has type "object" variable has type "int"
```

I don't see any value in converting it to `Untyped` or showing an error that a parameter is typed as `Any`, how would you be able to do anything to fix it?

Contributor guide

Open the contributing guide

Research direction

Start by tracing how the checker processes third-party stubs such as thirdparty.pyi and propagates Any into my.py, including reveal_type output. Define the flag's behavior and target requirements from the examples, then verify the resulting type of foo and the assignment error.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.