Florian Vazelle created FLINK-39578:
---------------------------------------
Summary: 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
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:java}
uv init test
cd test/
$ uv add apache-flink$ uv add mypy --group dev
{code}
Edit the main.py:
{code:java}
from pyflink.datastream.functions import FlatMapFunction
class Filter(FlatMapFunction):
def flat_map(self, event):
if event:
yield event
{code}
{code:java}
$ 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}
--
This message was sent by Atlassian Jira
(v8.20.10#820010)