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

Closed
wants to merge 1 commit into from

Conversation

mohamadghaffari
Copy link
Contributor

@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.
@Jacksunwei Jacksunwei added the ready to pull for importing back to Google label May 29, 2025
copybara-service bot pushed a commit that referenced this pull request May 29, 2025
Copybara import of the project:

--
f56fd74 by Mohammad <mohammaddevgermany@gmail.com>:

build(package): add py.typed and include it in flit config

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.

COPYBARA_INTEGRATE_REVIEW=#913 from mohamadghaffari:add-py-typed f56fd74
PiperOrigin-RevId: 764603119
@hangfei
Copy link
Collaborator

hangfei commented May 30, 2025

merged in the commit. thanks!

@hangfei hangfei closed this May 30, 2025
whhlct pushed a commit to whhlct/adk-python that referenced this pull request Jun 6, 2025
Copybara import of the project:

--
f56fd74 by Mohammad <mohammaddevgermany@gmail.com>:

build(package): add py.typed and include it in flit config

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.

COPYBARA_INTEGRATE_REVIEW=google#913 from mohamadghaffari:add-py-typed f56fd74
PiperOrigin-RevId: 764603119
coder-aditi pushed a commit to coder-aditi/adk-python that referenced this pull request Jul 2, 2025
Copybara import of the project:

--
f56fd74 by Mohammad <mohammaddevgermany@gmail.com>:

build(package): add py.typed and include it in flit config

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.

COPYBARA_INTEGRATE_REVIEW=google#913 from mohamadghaffari:add-py-typed f56fd74
PiperOrigin-RevId: 764603119
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ready to pull for importing back to Google
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
3 participants