-
Notifications
You must be signed in to change notification settings - Fork 32
feat: Replace MyPy with ty type checker (do not merge) #677
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
base: main
Are you sure you want to change the base?
Conversation
- Replace mypy dependency with ty in pyproject.toml - Remove mypy.ini configuration file - Add ty.src configuration with exclude patterns - Update CI workflow from mypy-check to ty-check - Update type-check Poe task to use ty check command - Exclude bin, docs, and unit_tests directories from ty checking This change enables testing of the new Rust-based ty type checker as an alternative to mypy for performance and usability evaluation. Co-Authored-By: AJ Steers <[email protected]>
|
Original prompt from AJ Steers: |
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
👋 Greetings, Airbyte Team Member!Here are some helpful tips and reminders for your convenience. Testing This CDK VersionYou can test this version of the CDK using the following: # Run the CLI from this branch:
uvx 'git+https://github.com/airbytehq/airbyte-python-cdk.git@devin/1738195530-test-ty-type-checker#egg=airbyte-python-cdk[dev]' --help
# Update a connector to use the CDK from this branch ref:
cd airbyte-integrations/connectors/source-example
poe use-cdk-branch devin/1738195530-test-ty-type-checkerHelpful ResourcesPR Slash CommandsAirbyte Maintainers can execute the following slash commands on your PR:
|
.github/workflows/python_lint.yml
Outdated
Check warning
Code scanning / CodeQL
Workflow does not contain permissions Medium
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix
AI 5 months ago
To fix the issue, we will add a permissions block at the root of the workflow file. This block will apply to all jobs in the workflow unless overridden by job-specific permissions blocks. Since the workflow only performs read-only operations (e.g., checking out code, installing dependencies, and running checks), we will set contents: read as the minimal required permission.
-
Copy modified lines R9-R11
| @@ -8,2 +8,5 @@ | ||
|
|
||
| permissions: | ||
| contents: read | ||
|
|
||
| jobs: |
…ion issues Co-Authored-By: AJ Steers <[email protected]>
Co-Authored-By: AJ Steers <[email protected]>
Replace MyPy with ty type checker (do not merge)
Summary
This PR replaces MyPy with
ty(the new Rust-based Python type checker from astral-sh) across both PyAirbyte and airbyte-python-cdk repositories for performance and usability testing. This is an experimental change to evaluate ty as an alternative to MyPy.Key changes:
mypydependency withty ^0.0.1a16in pyproject.toml[tool.ty.src]configurationmypy-checktoty-checktype-checkPoe tasks using ty commandsReview & Testing Checklist for Human
poetry run poe type-checkin both repos to verify ty works correctly[tool.ty.src]exclude settings properly skip tests/docs/fixtures directoriespoetry run poe checkto ensure ty integrates correctly with existing task chainsRecommended test plan: Install dependencies in both repos, run type-check tasks locally, verify output shows expected ty diagnostics, then check that CI workflows complete (failures expected due to existing type violations).
Diagram
%%{ init : { "theme" : "default" }}%% graph TD PyAirbyte_pyproject["PyAirbyte/<br/>pyproject.toml"]:::major-edit PyAirbyte_workflow["PyAirbyte/<br/>.github/workflows/<br/>python_lint.yml"]:::major-edit PyAirbyte_lock["PyAirbyte/<br/>poetry.lock"]:::minor-edit CDK_pyproject["airbyte-python-cdk/<br/>pyproject.toml"]:::major-edit CDK_workflow["airbyte-python-cdk/<br/>.github/workflows/<br/>python_lint.yml"]:::major-edit CDK_mypy_ini["airbyte-python-cdk/<br/>mypy.ini"]:::major-edit ty_config["[tool.ty.src]<br/>configuration"]:::context poe_tasks["poethepoet<br/>type-check tasks"]:::context PyAirbyte_pyproject --> ty_config CDK_pyproject --> ty_config PyAirbyte_pyproject --> poe_tasks CDK_pyproject --> poe_tasks PyAirbyte_workflow --> |"replaces mypy-check<br/>with ty-check"| PyAirbyte_pyproject CDK_workflow --> |"replaces mypy-check<br/>with ty-check"| CDK_pyproject CDK_mypy_ini --> |"deleted"| CDK_pyproject subgraph Legend L1["Major Edit"]:::major-edit L2["Minor Edit"]:::minor-edit L3["Context/No Edit"]:::context end classDef major-edit fill:#90EE90 classDef minor-edit fill:#87CEEB classDef context fill:#FFFFFFNotes