Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/TracingInsights/tif1/llms.txt

Use this file to discover all available pages before exploring further.

Basic Installation

Install tif1 via pip:
pip install tif1
Requirements: Python 3.10 or higher

Optional Dependencies

tif1 supports optional features through extra dependencies:
Install development tools for contributing to tif1:
pip install tif1[dev]
Includes:
  • pytest - Testing framework with xdist for parallel execution
  • pytest-cov - Code coverage reporting
  • pytest-benchmark - Performance benchmarking
  • ruff - Fast Python linter and formatter
  • ty - Type checking
  • hypothesis - Property-based testing
For faster, more reliable installations, use uv:
# Install uv
curl -LsSf https://astral.sh/uv/install.sh | sh

# Install tif1
uv pip install tif1

# Or install with extras
uv pip install tif1[dev]

Why uv?

uv is 10-100x faster than pip and provides better dependency resolution. Perfect for data science workflows.

Verify Installation

Verify that tif1 is installed correctly:
import tif1

print(f"tif1 version: {tif1.__version__}")

# Quick test - get available events
events = tif1.get_events(2025)
print(f"Found {len(events)} events for 2025")
print(f"First event: {events[0]}")
tif1 version: 0.1.0
Found 24 events for 2025
First event: Australian Grand Prix

Configuration

Configuration File (.tif1rc)

tif1 supports optional configuration via a .tif1rc file in your home directory:
# Create configuration file
vim ~/.tif1rc
Example configuration:
{
  "max_retries": 5,
  "validate_data": true,
  "backend": "polars",
  "cache_enabled": true,
  "cache_dir": "~/.tif1/cache"
}
max_retries
integer
default:3
Maximum number of retry attempts for failed HTTP requests
validate_data
boolean
default:false
Enable Pydantic validation for all data payloads (slower but safer)
backend
string
default:"pandas"
DataFrame backend: "pandas" or "polars"
cache_enabled
boolean
default:true
Enable SQLite caching for faster repeated access
cache_dir
string
default:"~/.tif1/cache"
Directory for SQLite cache database

Runtime Configuration

You can also configure tif1 programmatically:
import tif1

# Get configuration
config = tif1.get_config()

# Update settings
config.set("validate_data", True)
config.set("backend", "polars")

# Save to ~/.tif1rc
config.save()

# Check current settings
print(f"Max retries: {config.get('max_retries')}")
print(f"Backend: {config.get('backend')}")

Environment Setup

Jupyter Notebook

tif1 works seamlessly in Jupyter notebooks with rich HTML display:
# Install Jupyter
pip install jupyter

# Start notebook
jupyter notebook
In your notebook:
import tif1

# DataFrames display with rich formatting
session = tif1.get_session(2025, "Monaco Grand Prix", "Qualifying")
session.laps.head()  # Pretty HTML table
tif1 automatically detects Jupyter environments and enables rich display formatting.

Command Line Interface

tif1 includes a CLI tool for quick data exploration:
# List available events
tif1 events 2025

# Get session information
tif1 session 2025 "Monaco Grand Prix" "Qualifying"

# Show driver laps
tif1 laps 2025 "Monaco Grand Prix" "Qualifying" --driver VER
Run tif1 --help for full CLI documentation.

Cache Directory

On first use, tif1 creates a cache directory:
~/.tif1/
├── cache/
│   └── tif1.db          # SQLite cache database
└── .tif1rc              # Optional configuration file
The cache can grow to several hundred MB depending on usage. Clear it periodically with cache.clear() if needed.

Managing Cache

import tif1

# Get cache instance
cache = tif1.get_cache()

# Check cache location
print(f"Cache directory: {cache.cache_dir}")

# Clear all cached data
cache.clear()
print("Cache cleared")

Network Configuration

Proxy Support

tif1 uses niquests which respects standard HTTP proxy environment variables:
# Set proxy environment variables
export HTTP_PROXY="http://proxy.example.com:8080"
export HTTPS_PROXY="http://proxy.example.com:8080"
export NO_PROXY="localhost,127.0.0.1"

python your_script.py

Firewall Considerations

tif1 fetches data from:
  • Primary: cdn.jsdelivr.net (jsDelivr CDN)
  • Fallback: Additional CDN sources
Ensure your firewall allows HTTPS (port 443) access to these domains.

Logging

Enable debug logging to troubleshoot issues:
import tif1
import logging

# Enable debug logging
tif1.setup_logging(logging.DEBUG)

# Now all HTTP requests, cache hits, and data fetches are logged
session = tif1.get_session(2025, "Monaco Grand Prix", "Qualifying")
Log levels:
  • logging.DEBUG - Verbose output including HTTP requests and cache operations
  • logging.INFO - General information about data fetching
  • logging.WARNING - Warnings and retries (default)
  • logging.ERROR - Errors only

Troubleshooting

Ensure tif1 is installed in the correct Python environment:
python -m pip install tif1
python -c "import tif1; print(tif1.__version__)"
Check your internet connection and firewall settings. Enable debug logging:
import tif1
import logging
tif1.setup_logging(logging.DEBUG)
Verify the event and session names:
# List available events
events = tif1.get_events(2025)
print(events)

# List available sessions
sessions = tif1.get_sessions(2025, "Monaco Grand Prix")
print(sessions)
First access is slower as data is fetched and cached. Subsequent access is fast:
# First time: fetches from CDN (~1-2s)
session = tif1.get_session(2025, "Monaco Grand Prix", "Qualifying")
laps = session.laps

# Second time: reads from cache (~0.05s)
session2 = tif1.get_session(2025, "Monaco Grand Prix", "Qualifying")
laps2 = session2.laps  # Instant!

Next Steps

Quick Start Guide

Build your first F1 data analysis script

API Reference

Explore the complete API documentation

Build docs developers (and LLMs) love