You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by "Dian Fu (Jira)" <ji...@apache.org> on 2026/08/25 02:13:00 UTC
[jira] [Closed] (FLINK-39578) Missing py.typed in PyFlink wheel prevents type checking with mypy
[ https://issues.apache.org/jira/browse/FLINK-39578?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Dian Fu closed FLINK-39578.
---------------------------
Fix Version/s: 2.4.0
Resolution: Fixed
Merged to master via f3cfe3e869dcc96d72724b5a3223cd909b1136e8
> Missing py.typed in PyFlink wheel prevents type checking with mypy
> ------------------------------------------------------------------
>
> Key: FLINK-39578
> URL: https://issues.apache.org/jira/browse/FLINK-39578
> Project: Flink
> Issue Type: Bug
> Components: API / Python
> Reporter: Florian Vazelle
> Assignee: Florian Vazelle
> Priority: Minor
> Labels: pull-request-available
> Fix For: 2.4.0
>
>
> PyFlink currently does not include a {{py.typed}} marker file in its distributed wheel. As a result, static type checkers like {{mypy}} treat the package as untyped, even though type annotations are present in the source code.
> This prevents users from benefiting from type checking when using PyFlink, as {{mypy}} ignores inline type hints unless the package explicitly declares itself as typed per [PEP 561|https://peps.python.org/pep-0561/].
> *Steps to Reproduce:*
> {code:bash}
> $ uv init test
> $ cd test/
> $ uv add apache-flink
> $ uv add mypy --group dev{code}
> Edit the {{{}main.py{}}}:
> {code:python}
> from pyflink.datastream.functions import FlatMapFunction
> class MyFlatMapFunction(FlatMapFunction):
> pass{code}
> {code:bash}
> $ uv run mypy .
> main.py:1: error: Skipping analyzing "pyflink.datastream.functions": module is installed, but missing library stubs or py.typed marker [import-untyped]
> main.py:1: note: See https://mypy.readthedocs.io/en/stable/running_mypy.html#missing-imports
> {code}
> *Expected Behavior:*
> PyFlink should be recognized as a typed package, allowing mypy to analyze its type annotations.
> *Suggested Fix:*
> Include an empty {{py.typed}} file in the pyflink package and ensure it is packaged in the wheel.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)