[
https://issues.apache.org/jira/browse/FLINK-39578?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
ASF GitHub Bot updated FLINK-39578:
-----------------------------------
Labels: pull-request-available (was: )
> 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
> Priority: Minor
> Labels: pull-request-available
>
> 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)