Skip to content

Conversation

@Shriya-23
Copy link

Summary
This PR adds a GitHub Actions presubmit workflow that runs mypy on the Python samples directory.

Details

  • The workflow runs automatically on pull requests that modify Python sample files.
  • It installs mypy and the sample dependencies.
  • It performs type checking with:
    mypy samples/python --ignore-missing-imports
  • This helps catch type errors early and improves the developer experience for anyone using or contributing to the samples.

Motivation
As requested in issue #13303, adding a presubmit ensures that type failures in Python samples are detected before merging, preventing runtime errors for end users and maintaining code quality.

How to Test

  • This workflow will run automatically on all new pull requests affecting the samples.

What was done in this PR
Step 1 Created a new workflow file**: workflows/mypy-presubmit.yml inside the .github/ folder.
Step 2 Configured the workflow to run on pull requests** that modify Python sample files (samples/python/**).
Step 3 Installed dependencies** in the workflow:

  • mypy for type checking
  • requirements.txt from the samples folder (if it exists)
    step 4 Added a mypy type check step**:
mypy samples/python --ignore-missing-imports did we 100% do this in 

References
- Closes #13303

This commit adds a GitHub Actions presubmit workflow that runs mypy on the
Python samples directory.

This helps detect type errors early and improves the overall user experience,
as requested in issue GoogleCloudPlatform#13303.

The workflow runs on pull requests that modify Python sample files, installs
mypy and the sample dependencies, and performs type checking with:
    mypy samples/python --ignore-missing-imports

This presubmit aligns the samples with recommended typing practices and makes
type failures visible before merge.

Closes GoogleCloudPlatform#13303.
@Shriya-23 Shriya-23 requested review from a team as code owners December 3, 2025 05:20
@gemini-code-assist
Copy link
Contributor

Note

Gemini is unable to generate a summary for this pull request due to the file types involved not being currently supported.

@google-cla
Copy link

google-cla bot commented Dec 3, 2025

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@product-auto-label product-auto-label bot added samples Issues that are directly related to samples. api: workflows Issues related to the Workflows API. labels Dec 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api: workflows Issues related to the Workflows API. samples Issues that are directly related to samples.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant