Bug Report
On an attrs class, mypy appears to resolve the httpx in the method parameter type annotation to the instance variable httpx instead of the module httpx.
To Reproduce
from __future__ import annotations
import httpx
from attrs import define, field
@define
class Foo:
httpx: httpx.AsyncClient = field(factory=httpx.AsyncClient)
def bar(self, response: httpx.Response) -> None:
pass
Expected Behavior
The code should type check.
Actual Behavior
test.py:11: error: Name "httpx.Response" is not defined [name-defined]
Your Environment
Using attrs 25.4.0
- Mypy version used: 1.18.2
- Mypy command-line flags: N/A
- Python version used: 3.13.5