Interactive CLI to set up Pydantic Logfire with optional dependencies
Project description
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 useto 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.mdorCLAUDE.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_TOKENenvironment variable or.envfile- 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
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file logfire_setup-0.1.0.tar.gz.
File metadata
- Download URL: logfire_setup-0.1.0.tar.gz
- Upload date:
- Size: 40.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.7.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
043db7f969e824d7f9d18b76593cad42789b8d4a20d66822804625d584922f89
|
|
| MD5 |
470b22ca5e73fcd47d69e5c59be2aba2
|
|
| BLAKE2b-256 |
f3a53329531cffcef0f5fa76e6d58a351196459df86e0140455c94c0bc8b1e93
|
File details
Details for the file logfire_setup-0.1.0-py3-none-any.whl.
File metadata
- Download URL: logfire_setup-0.1.0-py3-none-any.whl
- Upload date:
- Size: 20.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.7.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e5236bf350e36e72e35b0574b9619472e1901e53a83a1bb9665c1cb66154046f
|
|
| MD5 |
6030c5336d30f4c6b002416f26e5c727
|
|
| BLAKE2b-256 |
64ca39f429d0c33041ed23c29c5ba08935b4684b72ea544777a6c001000d7876
|