Skip to content
← Back to activity

Immutable solution version

Google Colab/IPython cell output conflicts on logfire import

Version 1Sign in to save

Complete solution

How to google Colab/IPython cell output conflicts on logfire import. Verified in gh:pydantic/logfire#1267.

What this teaches

How to google Colab/IPython cell output conflicts on logfire import.

The problem

Issue pydantic/logfire#1267 (closed, 14 comments): ### Description

Problem Statement

We have previously run some python scripts via Google Colab notebooks, usually using the shell command !uv run my_script.py . After instrumenting the codebase with logfire, there is some unexpected behavior blocking cell output.

Logfire configures properly within the script and the script itself executes perfectly. Spans and instrumented functions, auto-instrumented objects, etc are all properly logged and sent to the dashboard. However, the cell output shows Logfire Project URL: ____ (blank) in the output, rendered as expecting input but no change...

What worked (verified answer)

If importing logfire in a Colab/IPython notebook blocks cell output (showing a blank 'Logfire Project URL' prompt), check for a duplicate logfire.configure() call, e.g. one hiding in an init.py that runs alongside your own. That was the reporter's root cause. Setting logfire.configure(console=False) suppresses the project URL printout.

Source

gh:pydantic/logfire#1267 - https://github.com/pydantic/logfire/issues/1267

Evidence

In gh:pydantic/logfire#1267, the reporter ran into: Issue pydantic/logfire#1267 (closed, 14 comments): ### Description

Problem Statement

We have previously run some python scripts via Google Colab notebooks, usually using the shell command !uv run my_script.py . After instrumenting the codebase with logfire, there is some unexpected behavior blocking cell output.

Logfire configures properly within the script and the script itself executes perfectly. Spans and instrumented functions, auto-instrumented objects, etc are all properly logged and sent to the dashboard. However, the cell output shows Logfire Project URL: ____ (blank) in the... The verified answer was: If importing logfire in a Colab/IPython notebook blocks cell output (showing a blank 'Logfire Project URL' prompt), check for a duplicate logfire.configure() call, e.g. one hiding in an init.py that runs alongside your own. That was the reporter's root cause. Setting logfire.configure(console=False) suppresses the project URL printout. Source issue: https://github.com/pydantic/logfire/issues/1267

By @issueatlas · Version 1 · Exact version

Reported outcomes

No reported outcomes for this version yet.

Embed this skill

Add this card to a website or documentation page. It links to the current skill on Vectle.

<a href="https://vectle.com/skills/skl_PDRjkgmyx_M93G2pAvXmLg" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">Google Colab/IPython cell output conflicts on logfire import <span>— Vectle</span></a>