Skip to content

Conversation

@pnilan
Copy link
Contributor

@pnilan pnilan commented May 16, 2025

What

pre-commit

  • Fixes pre-commit-config exclusions
  • Adds mypy type checking to pre-commit-config
  • Aligns prettier pre-commit hook w/ poe task

pyproject

Other Notes

I originally set out to clean up the poe tasks but found that I do think most of these are useful/necessary. So my primary suggestion is:

  • Use pre-commit as the primary source of truth -- this should align with the CI checks (as of now). Green pre-commit should mean green CI checks.
  • If using the poe tasks, don't look at the tasks definitions in pyproject, Look at the available tasks and their respective descriptions by running poetry run poe. You'll get a nice list:
Screenshot 2025-05-16 at 11 36 20 AM

Summary by CodeRabbit

  • Chores
    • Updated pre-commit checks to include type checking and poetry lockfile validation.
    • Added a new pre-commit hook for Poetry lockfile verification.
    • Improved and standardized task names and descriptions for development scripts.
    • Consolidated and clarified formatting and linting tasks for easier usage.
    • Enhanced test task to better handle slow tests.

Important

Auto-merge enabled.

This PR is set to merge automatically when all requirements are met.

@github-actions github-actions bot added bug Something isn't working security labels May 16, 2025
@pnilan pnilan marked this pull request as ready for review May 16, 2025 18:37
Copilot AI review requested due to automatic review settings May 16, 2025 18:37
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR fixes issues in the pre-commit configuration and updates the poe tasks in pyproject.toml to improve type-checking and overall clarity.

  • Updated poe task definitions with additional help text and renamed tasks for clarity.
  • Adjusted pre-commit hook configurations for Ruff, Prettier, Poetry, and MyPy.

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
pyproject.toml Updated poe tasks with added help messages and task renaming, and removed isort skip exclusion.
.pre-commit-config.yaml Adjusted exclusion regex formatting, updated the Prettier hook, and added new hooks for Poetry check and MyPy.
Comments suppressed due to low confidence (1)

.pre-commit-config.yaml:48

  • Ensure that replacing the 'types_or' option with the explicit '--write' argument in the Prettier hook is intentional and that it does not affect file type detection required for your formatting checks.
args: [--write]

@pnilan pnilan added airbyte-python-cdk bug Something isn't working and removed bug Something isn't working security labels May 16, 2025
@pnilan pnilan requested review from aaronsteers and brianjlai May 16, 2025 18:40
@coderabbitai
Copy link
Contributor

coderabbitai bot commented May 16, 2025

📝 Walkthrough

Walkthrough

The updates modify the .pre-commit-config.yaml and pyproject.toml files. The pre-commit configuration adds new hooks for Poetry lockfile and mypy checks, adjusts exclusion patterns, and updates hook arguments. The Poe task runner configuration is reorganized with improved help descriptions, task renaming, deduplication, and minor command tweaks for clarity and consistency.

Changes

File(s) Change Summary
.pre-commit-config.yaml Removed exclusion of __init__.py from checks, adjusted .ruff_cache exclusion pattern by adding a trailing pipe, updated prettier hook arguments to use explicit --write, removed comments before ruff and ruff-format hooks, added a local poetry-check hook to run poetry check, and introduced a mypy hook targeting files under airbyte_cdk/.
pyproject.toml Added descriptive help messages to all Poe tasks, consolidated and updated format-check and format-fix tasks to sequences combining Ruff and Prettier, renamed _lint-ruff to lint, renamed check-lockfile to _check-lockfile and updated sequences accordingly, extended help messages on lint-fix tasks, modified pytest-fast to use --skipslow flag instead of -m 'not slow'.

Sequence Diagram(s)

sequenceDiagram
    participant Developer
    participant Pre-commit
    participant Poetry
    participant Mypy

    Developer->>Pre-commit: Run pre-commit hooks
    Pre-commit->>Poetry: Run poetry check (lockfile validation)
    Pre-commit->>Mypy: Run mypy type checks on airbyte_cdk/
    Pre-commit-->>Developer: Report results
Loading

Would you like me to dive deeper into the new pre-commit hook interactions or keep it at this high-level overview? Wdyt?

Note

⚡️ AI Code Reviews for VS Code, Cursor, Windsurf

CodeRabbit now has a plugin for VS Code, Cursor and Windsurf. This brings AI code reviews directly in the code editor. Each commit is reviewed immediately, finding bugs before the PR is raised. Seamless context handoff to your AI code agent ensures that you can easily incorporate review feedback.
Learn more here.


Note

⚡️ Faster reviews with caching

CodeRabbit now supports caching for code and dependencies, helping speed up reviews. This means quicker feedback, reduced wait times, and a smoother review experience overall. Cached data is encrypted and stored securely. This feature will be automatically enabled for all accounts on May 16th. To opt out, configure Review - Disable Cache at either the organization or repository level. If you prefer to disable all data retention across your organization, simply turn off the Data Retention setting under your Organization Settings.
Enjoy the performance boost—your workflow just got faster.


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
Cache: Disabled due to data retention organization setting
Knowledge Base: Disabled due to data retention organization setting

📥 Commits

Reviewing files that changed from the base of the PR and between fede4c7 and eacb1f3.

📒 Files selected for processing (1)
  • pyproject.toml (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • pyproject.toml
⏰ Context from checks skipped due to timeout of 90000ms (9)
  • GitHub Check: Check: 'source-pokeapi' (skip=false)
  • GitHub Check: Check: 'source-amplitude' (skip=false)
  • GitHub Check: Check: 'source-shopify' (skip=false)
  • GitHub Check: Check: 'source-hardcoded-records' (skip=false)
  • GitHub Check: Pytest (All, Python 3.10, Ubuntu)
  • GitHub Check: Pytest (All, Python 3.11, Ubuntu)
  • GitHub Check: SDM Docker Image Build
  • GitHub Check: Pytest (Fast)
  • GitHub Check: Analyze (python)

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

‼️ IMPORTANT
Auto-reply has been disabled for this repository in the CodeRabbit settings. The CodeRabbit bot will not respond to your replies unless it is explicitly tagged.

  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (9)
.pre-commit-config.yaml (2)

48-48: Explicit --write for Prettier. Replacing types_or with args: [--write] aligns nicely with the corresponding Poe task; should we also scope this hook with a files: pattern (e.g., \.(js|ts|css|md)$) to limit it to relevant file types? wdyt?


60-67: Add poetry-check hook for lockfile validation. Great to enforce poetry check pre-commit—aligns with _check-lockfile. Might it help to restrict this hook to only run when pyproject.toml or poetry.lock change (via a files: regex)? wdyt?

pyproject.toml (7)

131-131: Consider clarifying install help text. The install task runs poetry install --all-extras; should we update its help to explicitly mention "all extras"? wdyt?


140-140: Updated format-check sequence. Using _format-check-ruff and _format-check-prettier is clear; would adding --quiet or --diff flags help surface only the relevant issues? wdyt?


154-154: lint-fix help clarity. The description mentions "excluding 'unsafe' fixes"; would specifying a brief example or linking to Ruff docs improve usability? wdyt?


155-155: Document lint-fix-unsafe workflow. The help hints at best practice; perhaps we could reference an example or note that manual review is required for these fixes? wdyt?


164-164: Adjust check-all sequence. Including _check-lockfile at the end is logical; should we reorder to have type-check run before format-check so type errors surface earlier? wdyt?


170-170: pytest-fast filter redundancy. You’re using both --skipslow and -m 'not slow'; could we simplify by choosing one mechanism for excluding slow tests? wdyt?


177-177: CI task sequence clarity. Omitting type-check from check-ci makes sense for faster CI, but should we note that detail in the help text to avoid confusion? wdyt?

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
Cache: Disabled due to data retention organization setting
Knowledge Base: Disabled due to data retention organization setting

📥 Commits

Reviewing files that changed from the base of the PR and between d6a087c and fede4c7.

📒 Files selected for processing (2)
  • .pre-commit-config.yaml (4 hunks)
  • pyproject.toml (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (6)
  • GitHub Check: Check: 'source-shopify' (skip=false)
  • GitHub Check: Check: 'source-hardcoded-records' (skip=false)
  • GitHub Check: Check: 'source-amplitude' (skip=false)
  • GitHub Check: Pytest (All, Python 3.10, Ubuntu)
  • GitHub Check: Pytest (All, Python 3.11, Ubuntu)
  • GitHub Check: Pytest (Fast)
🔇 Additional comments (7)
.pre-commit-config.yaml (2)

13-13: Exclude .ruff_cache added for consistency. This ensures Ruff’s cache directory is ignored alongside other tool caches.


68-76: Introduce mypy pre-commit hook. Nice to add type checking for airbyte_cdk/. Can we verify that mypy.ini lives at the repo root so this hook picks up the correct config? wdyt?

pyproject.toml (5)

132-132: Public lock task exposure. The lock task runs poetry lock—do we want to expose it directly, or make it private (e.g., _lock) to encourage using the pre-commit hook instead? wdyt?


145-145: New format-fix task. Consistent naming with format-check—nice! Should we also rename _format-fix-ruff to _format-fix-ruff (already consistent) or consider aligning its naming more explicitly with Poe conventions? wdyt?


150-150: Rename lint task to lint. Swapping from _lint-ruff to lint improves discoverability and consistency.


160-160: Private lockfile check task. Renaming check-lockfile to _check-lockfile aligns with the pre-commit hook—nice consistency.


176-176: Verify check-local task coverage. This runs unit-test-with-cov but skips format-check; was that intentional to speed up local dev cycles? wdyt?

Copy link
Contributor

@bnchrch bnchrch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Love this! Ill leave it to someone whos impacted by this to approve. (cc: @aaronsteers @brianjlai @aldogonzalez8 etc...)

Copy link
Contributor

@aaronsteers aaronsteers left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is awesome. Thank you, @pnilan!

QQ - do you find that one "run-me before pushing" format/lint fix step?

Should we add something like a poe pre-commit alias as a slightly more concise way to run pre-commit run --all-files?

Copy link
Contributor

@aaronsteers aaronsteers left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Approved! One comment/question, non-blocking. Approving since this is already a improvement even without further changes.

@pnilan pnilan enabled auto-merge (squash) May 16, 2025 21:01
@pnilan pnilan merged commit 5ed05f2 into main May 16, 2025
27 of 29 checks passed
@pnilan pnilan deleted the pnilan/fix/pre-commit-config branch May 16, 2025 21:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants