Skip to main content

logfire-setup

Interactive CLI to set up Pydantic Logfire with optional dependencies.

What is this?

logfire-setup is a CLI tool that helps you quickly add Logfire to your Python project with an interactive setup process similar to create-next-app. It:

  • Interactive selection with arrow keys and checkboxes for an intuitive user experience
  • Checks authentication - Validates your Logfire credentials automatically
  • Project selection - Fetches your projects and runs logfire projects use to configure your project
  • Auto-detects your existing dependencies (FastAPI, Django, SQLAlchemy, etc.)
  • Pre-selects matching Logfire integrations
  • Installs Logfire with your chosen extras using uv
  • Validates environment - Checks for LOGFIRE_TOKEN and MCP configuration
  • Generates best practices documentation for your AGENTS.md or CLAUDE.md

Installation & Usage

Run directly with uvx (no installation needed):

uvx logfire-setup

Or install globally:

uv tool install logfire-setup
logfire-setup

Features

1. Authentication & Project Setup

Automatically checks if you're authenticated with Logfire by validating ~/.logfire/default.toml. If authenticated, fetches your projects, lets you select one, and runs logfire projects use to create .logfire/logfire_credentials.json in your project.

2. Automatic Dependency Detection

The CLI scans your pyproject.toml or requirements.txt to detect existing packages and pre-selects relevant Logfire integrations.

3. Interactive Integration Selection

Choose from two organized sections using arrow keys and spacebar:

Recommended Integrations:

  • HTTPX, FastAPI, Pydantic AI, SQLAlchemy

Other Integrations (alphabetically sorted):

  • Web Frameworks: Django, Flask, Starlette, ASGI, WSGI
  • HTTP Clients: Requests, aiohttp
  • Databases: PostgreSQL (asyncpg/psycopg/psycopg2), MySQL, SQLite3, Redis, MongoDB
  • Task Queues: Celery
  • Cloud: AWS Lambda
  • LLM & AI: Google GenAI, LiteLLM
  • Monitoring: System Metrics

Detected integrations are pre-selected with checkmarks.

4. One-Command Installation

Automatically runs:

uv add logfire[fastapi,sqlalchemy,redis]

5. Environment Validation

After installation, checks for:

  • LOGFIRE_TOKEN environment variable or .env file
  • MCP (Model Context Protocol) configuration for IDE integrations (Cursor, Claude Desktop, etc.)

Provides helpful links to create tokens and example configurations if missing.

6. AI Assistant Instructions

Generates custom Logfire best practices for AGENTS.md or CLAUDE.md:

  • Core patterns (spans, structured logging, exception handling)
  • Integration-specific setup based on your selections
  • MCP usage instructions (if configured)
  • Security and performance tips
  • Direct links to documentation

The instructions are tailored to your selected integrations and displayed inline for review before adding.

Requirements

  • Python 3.9+
  • uv package manager

Development

Clone the repository:

git clone https://github.com/pydantic/logfire-setup.git
cd logfire-setup

Install dependencies:

uv sync

Run locally:

uv run logfire-setup

Test with uvx:

uvx --from . logfire-setup

License

MIT - see LICENSE for details.

Links

Metadata

Release files for logfire-setup 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for logfire-setup 0.1.0
File Size Uploaded Provenance
logfire_setup-0.1.0.tar.gz 40.5 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for logfire-setup 0.1.0
File Interpreter ABI Platform
logfire_setup-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 60.9 kB

Release files / logfire_setup-0.1.0.tar.gz

Download URL logfire_setup-0.1.0.tar.gz
Size 40.5 kB
Tags Source
SHA-256 checksum
How to use checksums
043db7f969e824d7f9d18b76593cad42789b8d4a20d66822804625d584922f89
BLAKE2b-256 checksum
How to use checksums
f3a53329531cffcef0f5fa76e6d58a351196459df86e0140455c94c0bc8b1e93
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.7.12

Release files / logfire_setup-0.1.0-py3-none-any.whl

Download URL logfire_setup-0.1.0-py3-none-any.whl
Size 20.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e5236bf350e36e72e35b0574b9619472e1901e53a83a1bb9665c1cb66154046f
BLAKE2b-256 checksum
How to use checksums
64ca39f429d0c33041ed23c29c5ba08935b4684b72ea544777a6c001000d7876
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.7.12

Security for logfire-setup 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page