Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Flytekit type hints are ignored by mypy #3681

Open
2 tasks done
tekumara opened this issue May 14, 2023 · 2 comments · May be fixed by flyteorg/flytekit#2411
Open
2 tasks done

[BUG] Flytekit type hints are ignored by mypy #3681

tekumara opened this issue May 14, 2023 · 2 comments · May be fixed by flyteorg/flytekit#2411
Assignees
Labels
bug Something isn't working flytekit FlyteKit Python related issue stale

Comments

@tekumara
Copy link

Describe the bug

Flytekit type hints are ignored by mypy because flytekit does not have a py.typed marker as per PEP 0561

Expected behavior

Usage of flytekit is checked against its types.

Additional context to reproduce

Given

from typing import Dict, List, NamedTuple

from flytekit import task


class OpenFlightsData(NamedTuple):
    routes: List[Dict[str, str]]
    airlines: Dict[str, str]
    airports: Dict[str, Dict[str, str]]


@task()
def extract_reference_data() -> OpenFlightsData:
    return OpenFlightsData(
        routes=[{"MAO": "CIZ"}], airlines={"0B": "Blue Air"}, airports={"AAA": {"lat": "1", "lon": "2"}}
    )

Then when running mypy 1.3.0:

❯ mypy aircraft/test.py
aircraft/test.py:3: error: Skipping analyzing "flytekit": module is installed, but missing library stubs or py.typed marker  [import]
aircraft/test.py:3: note: See https://mypy.readthedocs.io/en/stable/running_mypy.html#missing-imports
Found 1 error in 1 file (checked 1 source file)

Screenshots

No response

Are you sure this issue hasn't been raised already?

  • Yes

Have you read the Code of Conduct?

  • Yes
@tekumara tekumara added bug Something isn't working untriaged This issues has not yet been looked at by the Maintainers labels May 14, 2023
@eapolinario eapolinario self-assigned this Jun 2, 2023
@eapolinario eapolinario removed the untriaged This issues has not yet been looked at by the Maintainers label Jun 2, 2023
@eapolinario
Copy link
Contributor

flyteorg/flytekit#1711 is the first change to address this.

@eapolinario eapolinario added the flytekit FlyteKit Python related issue label Jun 27, 2023
Copy link

Hello 👋, this issue has been inactive for over 9 months. To help maintain a clean and focused backlog, we'll be marking this issue as stale and will engage on it to decide if it is still applicable.
Thank you for your contribution and understanding! 🙏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working flytekit FlyteKit Python related issue stale
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants