Overview
The tif1 CLI gives access to Formula 1 data from the terminal. The CLI is built with Typer and Rich. It prints formatted output with progress indicators and tables.
The CLI is designed for:
- Quick data exploration - Browse events, sessions, and drivers without writing code
- Performance testing - Benchmark data loading and cache performance
- Cache management - Inspect and manage the local data cache
- Debugging - Enable detailed logging to troubleshoot issues
- Scripting - Integrate F1 data into shell scripts and automation workflows
Installation
The tif1 package installs the CLI automatically:
After installation, the tif1 command is available in the terminal. Verify the installation:
Global Options
All commands support standard help output:
Commands Reference
events - List Events for a Season
Display all Formula 1 events (Grand Prix weekends) for a specific year.
Syntax:
Arguments:
year (required): Season year (2018-current)
Output:
- Formatted table with event numbers and names
- Total event count for the season
Examples:
Sample Output:
Use Cases:
- Discover available events for a season
- Find the exact event name for use in other commands
- Verify data availability for a specific year
sessions - List Sessions for an Event
Display all sessions available for a specific Grand Prix event.
Syntax:
Arguments:
year (required): Season year (2018-current)
event (required): Event name (use quotes for multi-word names)
Output:
- Formatted table with session numbers and names
- Typical sessions include: Practice 1, Practice 2, Practice 3, Qualifying, Sprint, Sprint Qualifying, Race
Examples:
Sample Output:
Use Cases:
- Determine available sessions for an event
- Find the exact session name for data queries
- Identify sprint weekends (which have Sprint and Sprint Qualifying sessions)
drivers - List Drivers in a Session
Display all drivers who participated in a specific session, along with their team information.
Syntax:
Arguments:
year (required): Season year (2018-current)
event (required): Event name (use quotes for multi-word names)
session (required): Session name (use quotes for multi-word names)
Output:
- Formatted table with driver codes and team names
- Total driver count
- Progress indicator during data loading
Examples:
Sample Output:
Use Cases:
- Identify which drivers participated in a session
- Find driver codes for use in other commands
- Verify team lineups for a specific event
- Check for reserve drivers or substitutions
fastest - Show Fastest Laps
Display the fastest lap times for all drivers or a specific driver in a session.
Syntax:
Arguments:
year (required): Season year (2018-current)
event (required): Event name (use quotes for multi-word names)
session (required): Session name (use quotes for multi-word names)
Options:
--driver <code> or -d <code>: Filter to a specific driver (3-letter code)
Output:
- All drivers mode: Sorted table of fastest laps with position, driver, team, and time
- Single driver mode: The fastest lap time of the driver
- Progress indicator during data loading
Examples:
Sample Output (All Drivers):
Sample Output (Single Driver):
Use Cases:
- Compare driver performance in a session
- Identify the fastest driver in qualifying or practice
- Analyze individual driver lap times
- Generate performance reports for specific drivers
Display detailed information about the local tif1 cache: location, file count, and total size.
Syntax:
Arguments:
None
Output:
- Cache directory path
- Number of cache files
- Total cache size in megabytes
Examples:
Sample Output:
Use Cases:
- Monitor cache disk usage
- Verify cache location
- Determine if cache needs cleaning
- Troubleshoot cache-related issues
Cache Details:
The tif1 cache uses SQLite with Write-Ahead Logging (WAL):
- Main cache database:
cache.sqlite - Stores session data, lap data, and metadata
- WAL files:
cache.sqlite-wal and cache.sqlite-shm - Transaction logs for concurrent access
- In-memory cache: LRU caches for frequently accessed data (not shown in file count)
The cache stores:
- Event schedules
- Session metadata
- Lap data
- Telemetry data
- Weather information
- Race control messages
cache-clear - Clear Cache
Remove all cached data to free up disk space or force fresh data downloads.
Syntax:
Options:
--yes or -y: Skip confirmation prompt (useful for scripts)
Output:
- Confirmation prompt (unless
--yes is used)
- Success or cancellation message
Examples:
Sample Output (With Confirmation):
Sample Output (Without Confirmation):
Sample Output (Cancelled):
Use Cases:
- Free up disk space
- Force fresh data downloads after data corrections
- Troubleshoot cache corruption issues
- Reset cache during development/testing
Warning: Clearing the cache removes all local data. The next access downloads all data again. The download time depends on the network speed and the amount of data requested.
Display the installed version of tif1.
Syntax:
Arguments:
None
Output:
Examples:
Sample Output:
Use Cases:
- Verify installed version
- Check for updates
- Report version in bug reports
- Confirm successful installation
debug - Debug Mode Session Loading
Load a session with debug-level logging enabled to troubleshoot issues or understand data loading behavior.
Syntax:
Arguments:
year (required): Season year (2018-current)
event (required): Event name (use quotes for multi-word names)
session (required): Session name (use quotes for multi-word names)
Output:
- Detailed debug logs showing:
- HTTP requests and responses
- Cache hits and misses
- Data parsing steps
- Performance metrics
- Session summary (driver count, lap count)
- Progress indicator during loading
Examples:
Sample Output:
Use Cases:
- Troubleshoot data loading issues
- Understand cache behavior
- Measure performance and identify bottlenecks
- Debug network connectivity problems
- Report detailed information in bug reports
- Verify data sources and CDN behavior
Debug Information Includes:
- Cache operations (hits, misses, writes)
- HTTP requests (URLs, response times, status codes)
- JSON parsing performance
- DataFrame construction steps
- Data validation results
- Retry and circuit breaker activity
Configuration
The CLI reads all tif1 configuration options from environment variables and from the .tif1rc configuration file.
Environment Variables
Key environment variables that affect CLI behavior:
Configuration File
Create a .tif1rc file in the home directory for persistent configuration:
See the Environment Variables documentation for complete details.
Advanced Usage
Scripting and Automation
The CLI is designed for use in shell scripts and automation workflows:
Use the CLI to benchmark cache performance:
Pipeline Integration
Combine CLI commands with other tools:
Common Workflows
Exploring a New Season
Cache Management
Troubleshooting
Tips and Best Practices
Event and Session Names
- Use quotes for multi-word names:
"Abu Dhabi Grand Prix"
- Single-word event names do not need quotes:
Monaco
- Session names are case-sensitive:
Qualifying not qualifying
- Use
tif1 events and tif1 sessions to find exact names
- The first data access is slower (cold cache)
- Subsequent accesses are much faster (warm cache)
- Use
cache-clear sparingly to maintain performance
- Enable debug mode to identify performance bottlenecks
Error Handling
- If a command fails, use the
debug command for detailed error information
- Check the internet connection for network-related errors
- Verify event and session names are correct
- Ensure the year is within the supported range (2018-current)
Cache Location
- Default cache location varies by OS:
- Linux/other POSIX:
~/.cache/tif1 or ~/.tif1
- macOS:
~/Library/Caches/tif1
- Windows:
%LOCALAPPDATA%\Temp\tif1
- Override the location with the
TIF1_CACHE_DIR environment variable
- Cache permissions are restricted to the user (0o700)
Troubleshooting
Command Not Found
If the tif1 command is not found after installation:
Network Errors
If network errors occur:
Cache Issues
If the cache is corrupt:
Data Not Found
If data is not available:
Support
For issues, questions, or feature requests:
Quick Reference
Last modified on September 3, 2026