Skip to content

Conversation

aaronsteers
Copy link
Contributor

@aaronsteers aaronsteers commented Jul 18, 2025

Summary by CodeRabbit

  • New Features

    • Added the ability to print configuration specifications and informational messages directly to standard error (stderr) instead of standard output (stdout) across various commands and components.
  • Refactor

    • Updated print statements in multiple areas to consistently use stderr for error and informational messages.
    • Removed the configuration specification printing method from sources, streamlining output handling.
    • Enhanced progress display to use a dedicated stderr console for live updates.

Important

Auto-merge enabled.

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

@aaronsteers aaronsteers requested a review from Copilot July 18, 2025 01:10
Copy link
Contributor

@Copilot 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 redirects log and informational print statements from stdout to stderr to improve output separation. This ensures that actual data output remains clean on stdout while logging messages are sent to stderr.

  • Redirected warning and status messages to stderr across multiple modules
  • Modified print_config_spec method to accept a stderr parameter for output control
  • Added input validation to prevent conflicting output destinations

Reviewed Changes

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

Show a summary per file
File Description
airbyte/sources/base.py Updated warning and log messages to use stderr, removed print_config_spec method
airbyte/cli.py Modified connector validation output to use stderr
airbyte/_executors/util.py Redirected executable location message to stderr
airbyte/_executors/python.py Updated installation and error messages to use stderr
airbyte/_connector_base.py Enhanced print_config_spec with stderr parameter and redirected various status messages

@aaronsteers
Copy link
Contributor Author

/format-fix

Copy link
Contributor

coderabbitai bot commented Jul 18, 2025

📝 Walkthrough

Walkthrough

The changes systematically redirect informational and error messages from standard output to standard error across several modules. Method signatures and imports are updated to support this, particularly in configuration specification printing. Additionally, the print_config_spec method is removed from the Source class, eliminating related formatting and output features. The ProgressTracker class now uses a stderr console for rich live views.

Changes

Files/Paths Change Summary
airbyte/_connector_base.py Redirects print and error messages to stderr; adds stderr parameter to print_config_spec; updates method signature.
airbyte/_executors/python.py Updates print statements in VenvExecutor methods to output to stderr.
airbyte/_executors/util.py Changes print output in _get_local_executor to stderr.
airbyte/cli.py Redirects validation and benchmark command outputs to stderr; passes stderr=True to print_config_spec.
airbyte/sources/base.py Redirects warning/info prints to stderr; removes print_config_spec method and related imports.
airbyte/logs.py Redirects log file path print statements to stderr; adds sys import.
airbyte/progress.py Adds _stderr_console attribute and uses it for RichLive console to output progress to stderr.

Suggested labels

enable-ai-review

By the way, would you like to consider documenting this new stderr output behavior in the user-facing CLI documentation as well, wdyt?


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between d9eac9e and 3b35757.

📒 Files selected for processing (1)
  • airbyte/progress.py (3 hunks)
🧰 Additional context used
🧠 Learnings (1)
📓 Common learnings
Learnt from: yohannj
PR: airbytehq/PyAirbyte#716
File: airbyte/logs.py:384-402
Timestamp: 2025-07-11T19:53:44.427Z
Learning: In the PyAirbyte project, when reviewing PRs, maintain clear separation of concerns. Don't suggest changes that are outside the scope of the PR's main objective, even if they would improve consistency or fix other issues. This helps with reviewing changes and potential reverts.
Learnt from: Suraj-Vishwakarma70
PR: airbytehq/PyAirbyte#285
File: airbyte/sources/base.py:0-0
Timestamp: 2024-07-09T06:37:29.133Z
Learning: In the PyAirbyte project, print statements are preferred over logging for consistency.
Learnt from: Suraj-Vishwakarma70
PR: airbytehq/PyAirbyte#285
File: airbyte/sources/base.py:0-0
Timestamp: 2024-10-08T15:34:31.026Z
Learning: In the PyAirbyte project, print statements are preferred over logging for consistency.
Learnt from: Suraj-Vishwakarma70
PR: airbytehq/PyAirbyte#285
File: airbyte/sources/base.py:104-113
Timestamp: 2024-10-08T15:34:31.026Z
Learning: In the PyAirbyte project, print statements are preferred over logging for consistency.
Learnt from: Suraj-Vishwakarma70
PR: airbytehq/PyAirbyte#285
File: airbyte/sources/base.py:104-113
Timestamp: 2024-07-09T06:38:54.843Z
Learning: In the PyAirbyte project, print statements are preferred over logging for consistency.
Learnt from: Suraj-Vishwakarma70
PR: airbytehq/PyAirbyte#285
File: airbyte/sources/base.py:0-0
Timestamp: 2024-07-09T06:37:48.088Z
Learning: In the PyAirbyte project, print statements are preferred over logging for consistency.
Learnt from: Suraj-Vishwakarma70
PR: airbytehq/PyAirbyte#285
File: airbyte/sources/base.py:0-0
Timestamp: 2024-10-18T07:00:43.413Z
Learning: In the PyAirbyte project, print statements are preferred over logging for consistency.
Learnt from: aaronsteers
PR: airbytehq/PyAirbyte#411
File: airbyte/cli.py:111-160
Timestamp: 2024-10-06T23:44:31.534Z
Learning: In PyAirbyte, error messages in functions like `_resolve_source_job` in `airbyte/cli.py` are designed to decouple the message text from dynamic values, following a structlog-inspired design. Dynamic values are provided via parameters like `input_value`. This approach helps avoid including PII in the message strings, which may be used in telemetry.
Learnt from: aaronsteers
PR: airbytehq/PyAirbyte#411
File: airbyte/cli.py:111-160
Timestamp: 2024-10-08T15:34:31.026Z
Learning: In PyAirbyte, error messages in functions like `_resolve_source_job` in `airbyte/cli.py` are designed to decouple the message text from dynamic values, following a structlog-inspired design. Dynamic values are provided via parameters like `input_value`. This approach helps avoid including PII in the message strings, which may be used in telemetry.
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (6)
  • GitHub Check: Pytest (All, Python 3.11, Windows)
  • GitHub Check: Pytest (All, Python 3.10, Ubuntu)
  • GitHub Check: Pytest (All, Python 3.11, Ubuntu)
  • GitHub Check: Pytest (Fast)
  • GitHub Check: Pytest (All, Python 3.10, Windows)
  • GitHub Check: Pytest (No Creds)
🔇 Additional comments (3)
airbyte/progress.py (3)

31-31: LGTM! Console import added for stderr redirection.

The new Console import is correctly added to support the stderr redirection functionality. This aligns perfectly with the PR objective.


215-215: Good addition of stderr console attribute.

The new _stderr_console attribute is properly typed and initialized to None, following the existing pattern in the class. This provides a clean way to manage the stderr console instance.


627-634: Excellent implementation of stderr redirection for Rich console!

The lazy initialization pattern here is well thought out - only creating the stderr console when needed, and then reusing it for subsequent RichLive instances. This ensures all Rich progress output goes to stderr as intended, maintaining consistency with the broader stderr redirection changes across the codebase. The implementation correctly follows the existing error handling pattern too.

What do you think about this approach vs initializing the stderr console in the constructor? The current lazy approach seems more efficient since Rich views aren't always used, wdyt?

✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch aj/fix/use-stderr-for-log-prints

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 auto-generate unit tests to generate unit tests for 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 or @coderabbitai title 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.

@aaronsteers
Copy link
Contributor Author

aaronsteers commented Jul 18, 2025

/fix-pr

Auto-Fix Job Info

This job attempts to auto-fix any linting or formating issues. If any fixes are made,
those changes will be automatically committed and pushed back to the PR.
(This job requires that the PR author has "Allow edits from maintainers" enabled.)

PR auto-fix job started... Check job output.

✅ Changes applied successfully.

Copy link

github-actions bot commented Jul 18, 2025

PyTest Results (Fast Tests Only, No Creds)

729 tests  ±0   729 ✅ ±0   17m 20s ⏱️ -35s
  1 suites ±0     0 💤 ±0 
  1 files   ±0     0 ❌ ±0 

Results for commit 3b35757. ± Comparison against base commit 661db91.

♻️ This comment has been updated with latest results.

Copy link

github-actions bot commented Jul 18, 2025

PyTest Results (Full)

791 tests  ±0   777 ✅ ±0   29m 33s ⏱️ -20s
  1 suites ±0    14 💤 ±0 
  1 files   ±0     0 ❌ ±0 

Results for commit 3b35757. ± Comparison against base commit 661db91.

♻️ This comment has been updated with latest results.

@aaronsteers aaronsteers reopened this Jul 18, 2025
Copy link

👋 Greetings, Airbyte Team Member!

Here are some helpful tips and reminders for your convenience.

Testing This PyAirbyte Version

You can test this version of PyAirbyte using the following:

# Run PyAirbyte CLI from this branch:
uvx --from 'git+https://github.com/airbytehq/PyAirbyte.git@aj/fix/use-stderr-for-log-prints' pyairbyte --help

# Install PyAirbyte from this branch for development:
pip install 'git+https://github.com/airbytehq/PyAirbyte.git@aj/fix/use-stderr-for-log-prints'

Helpful Resources

PR Slash Commands

Airbyte Maintainers can execute the following slash commands on your PR:

  • /fix-pr - Fixes most formatting and linting issues
  • /poetry-lock - Updates poetry.lock file
  • /test-pr - Runs tests with the updated PyAirbyte

Community Support

Questions? Join the #pyairbyte channel in our Slack workspace.

📝 Edit this welcome message.

@aaronsteers aaronsteers enabled auto-merge (squash) July 18, 2025 02:27
@aaronsteers aaronsteers changed the title fix: use stderr for log prints fix: use stderr for log and progress prints Jul 18, 2025
@aaronsteers
Copy link
Contributor Author

aaronsteers commented Jul 18, 2025

Tested successfully by filtering out all STDERR messages:

poetry run pyairbyte benchmark 2>/dev/null

Verified that...

before: very noisy.
after: silent.

This is important because when we run in MCP mode, extraneous prints to STDOUT are picked up as seemingly erroneous JSON lines.

@aaronsteers aaronsteers merged commit 1266018 into main Jul 18, 2025
24 checks passed
@aaronsteers aaronsteers deleted the aj/fix/use-stderr-for-log-prints branch July 18, 2025 03:27
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.

1 participant