Skip to content

Add py.typed for PEP 561 compliance #913

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

mohamadghaffari
Copy link

@mohamadghaffari mohamadghaffari commented May 24, 2025

Summary

This PR adds a py.typed marker file to the google.adk package and updates the pyproject.toml to include it in the Flit build.

This change ensures the package is PEP 561 compliant, allowing tools like mypy, pyright, and pytype to recognize and use the type hints provided in the source.

Changes

  • Added src/google/adk/py.typed (empty file)
  • Updated [tool.flit.module] to include py.typed in the build

Testing Plan

Built the package locally using:
uv build

Installed the .whl locally using:

uv pip install dist/google_adk-<version>.whl

Verified the presence of py.typed in the installed package:

python -c "import google.adk, os; print(os.path.exists(os.path.join(os.path.dirname(google.adk.__file__), 'py.typed')))"
# Output: True

Verified that both mypy and pyright detect and use the type hints correctly.

Fixes #914

CLA

☑️ I have signed the Google Contributor License Agreement

This adds a py.typed marker file to the google.adk package and updates
the Flit configuration in pyproject.toml to include it in the distribution.

This ensures the package is PEP 561 compliant and allows static type
checkers (like mypy and pyright) to recognize that the package supports type hints.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Missing py.typed prevents mypy/pyright from recognizing google-adk as typed
1 participant