Skip to content

Remove Rich link styling from project URL output#1784

Merged
alexmojaki merged 1 commit intopydantic:mainfrom
ameenalkhaldi:fix/remove-rich-link-styling
Mar 20, 2026
Merged

Remove Rich link styling from project URL output#1784
alexmojaki merged 1 commit intopydantic:mainfrom
ameenalkhaldi:fix/remove-rich-link-styling

Conversation

@ameenalkhaldi
Copy link
Copy Markdown
Contributor

@ameenalkhaldi ameenalkhaldi commented Mar 19, 2026

Summary

Remove the Rich [link=...] markup from the project URL console output, replacing it with plain [cyan] styling.

Problem

Rich's [link=...] markup emits OSC 8 terminal hyperlink escape sequences. These escape sequences break output in Google Colab and IPython environments — particularly when the project URL is printed from a background thread during logfire.configure(), the escape sequences interfere with Colab's output handling and can swallow subsequent print() output entirely.

See the detailed investigation in #1267.

Fix

  • Replace [link={url} cyan]{url}[/link] with [cyan]{url}[/cyan] in print_token_summary()
  • Remove the now-unnecessary custom Theme and Style imports from _print_summary() (they were only used to customize the link color)

The URL remains visible and cyan-colored in terminals that support Rich markup, but no longer emits hyperlink escape sequences.

Test plan

  • All existing tests in test_configure.py and test_cli.py pass (162/162) — they assert on the rendered text via capsys, which is unchanged
  • Full non-Docker test suite passes (1262 passed)
  • ruff format, ruff check, and pyright all pass
  • All pre-commit hooks pass

Fixes #1267


Summary by cubic

Remove Rich hyperlink markup from the project URL output. Use plain cyan text to avoid OSC 8 sequences that break Google Colab and IPython output.

  • Bug Fixes
    • Use [cyan]{url}[/cyan] instead of [link={url} cyan]{url}[/link] in print_token_summary().
    • Remove custom Theme/Style; use default Console.
    • URL stays visible and colored; notebook output is no longer swallowed.

Written for commit 17be3c8. Summary will update on new commits.

The Rich `[link=...]` markup emits OSC 8 terminal hyperlink escape
sequences which break output in Google Colab and IPython environments,
especially when the URL is printed from a background thread.

Replace the link markup with plain cyan styling so the URL remains
visible and colored but no longer produces escape sequences that
interfere with notebook output handling.

Fixes pydantic#1267
Copy link
Copy Markdown
Contributor

@devin-ai-integration devin-ai-integration bot left a comment

Choose a reason for hiding this comment

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

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no potential bugs to report.

View in Devin Review to see 1 additional finding.

Open in Devin Review

Copy link
Copy Markdown

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

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

No issues found across 1 file

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

Since this is your first cubic review, here's how it works:

  • cubic automatically reviews your code and comments on bugs and improvements
  • Teach cubic by replying to its comments. cubic learns from your replies and gets better over time
  • Add one-off context when rerunning by tagging @cubic-dev-ai with guidance or docs links (including llms.txt)
  • Ask questions if you need clarification on any suggestion

@codecov
Copy link
Copy Markdown

codecov bot commented Mar 20, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@alexmojaki alexmojaki merged commit 0e49172 into pydantic:main Mar 20, 2026
18 checks passed
@alexmojaki
Copy link
Copy Markdown
Collaborator

Thanks!

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.

Google Colab/IPython cell output conflicts on logfire import

2 participants