CLI Reference
Thetif1 CLI provides a powerful, feature-rich, and production-ready command-line interface for exploring Formula 1 data directly from your terminal. Built with Typer for robust argument parsing and Rich for beautiful, colorful terminal output with tables and progress indicators, the CLI brings the full power of tif1 to your command line with zero configuration required.
What is the tif1 CLI?
The tif1 CLI is a comprehensive command-line tool that provides instant access to Formula 1 data without writing a single line of Python code. It’s designed for data analysts, F1 enthusiasts, developers, and anyone who wants to explore F1 data quickly and efficiently from their terminal. Key Features:- Zero Configuration: Works out of the box after installation
- Rich Terminal Output: Beautiful tables with color-coded data and Unicode borders
- Intelligent Caching: Automatic caching with SQLite for blazing-fast repeated queries
- Progress Indicators: Real-time feedback during data loading operations
- Comprehensive Error Handling: Clear, actionable error messages
- Cross-Platform: Works on Linux, macOS, and Windows
- Scriptable: Perfect for automation, CI/CD pipelines, and shell scripts
- Performance Optimized: Built for speed with efficient data processing
- Flexible Output: Pipe-friendly output for integration with Unix tools
Overview
The CLI is designed for multiple use cases and user personas:Use Cases
-
Quick Data Exploration
- Instantly view race calendars, session schedules, driver lineups, and lap times
- No Python code required - just type and see results
- Perfect for quick lookups and ad-hoc queries
- Ideal for exploring data structure before writing analysis code
-
Debugging & Development
- Test data availability and verify API responses
- Troubleshoot issues with comprehensive debug logging
- Validate data integrity and completeness
- Identify network issues, cache problems, or data inconsistencies
-
Cache Management
- Monitor cache size, location, and performance metrics
- Clear cache when needed to free disk space
- Verify cache behavior and hit rates
- Optimize storage usage for large-scale analysis
-
Scripting & Automation
- Integrate F1 data into shell scripts and automation workflows
- Build CI/CD pipelines that depend on F1 data
- Create scheduled jobs for data collection and analysis
- Automate repetitive data extraction tasks
-
Learning & Discovery
- Explore the data structure and available information
- Understand F1 data hierarchy (seasons → events → sessions → drivers)
- Learn event naming conventions and session types
- Discover what data is available before committing to analysis
-
Performance Analysis
- Compare lap times across sessions and drivers
- Track driver performance throughout a race weekend
- Analyze qualifying vs race pace
- Identify performance trends and patterns
-
Data Validation
- Verify data completeness for specific events
- Check driver participation in sessions
- Validate lap counts and timing data
- Ensure data quality before analysis
Who Should Use the CLI?
- Data Analysts: Quick data exploration and validation
- F1 Enthusiasts: Instant access to race data and statistics
- Developers: Testing and debugging data pipelines
- DevOps Engineers: Automation and monitoring scripts
- Researchers: Data collection for academic studies
- Journalists: Quick fact-checking and statistics lookup
- Content Creators: Gathering data for articles, videos, or social media
Performance Characteristics
The CLI is optimized for speed and efficiency:- First Request: 2-10 seconds (network fetch + cache write)
- Cached Requests: <1 second (local SQLite read)
- Cache Benefit: 5-10x faster for repeated queries
- Memory Efficient: Streams data without loading entire datasets
- Network Optimized: Uses CDN for fast global access
- Concurrent Safe: Multiple CLI instances can run simultaneously
Installation
The CLI is automatically included when you install tif1. No additional dependencies, configuration files, or setup steps are required - it just works out of the box.Standard Installation
Install tif1 using pip (Python 3.10 or higher required):tif1 command will be available globally in your terminal. The CLI uses the same Python environment as your tif1 installation, ensuring consistency between CLI and programmatic usage.
Installation Methods
1. System-Wide Installation (requires admin/sudo):Verify Installation
Confirm the CLI is installed correctly and check the version:-
Check Python Environment:
-
Verify PATH Configuration:
-
Locate tif1 Executable:
-
Common Issues:
- Virtual environment not activated: Run
source venv/bin/activate(Linux/macOS) orvenv\Scripts\activate(Windows) - User installation PATH issue: Add
~/.local/bin(Linux/macOS) or%APPDATA%\Python\Scripts(Windows) to PATH - Permission issues: Use
pip install --user tif1instead of system-wide installation
- Virtual environment not activated: Run
Upgrading
To upgrade to the latest version:Uninstallation
To remove tif1:Getting Started
Your First Commands
Let’s walk through a complete workflow from discovering events to analyzing lap times: Step 1: Discover Available Events Start by listing all events in a season to see what data is available:Understanding the Data Hierarchy
F1 data in tif1 follows a clear hierarchy:Common Patterns
Pattern 1: Weekend AnalysisQuick Reference Card
Quick Start
Get started with these common commands:Global Usage Pattern
- COMMAND: The action to perform (e.g.,
events,sessions,drivers,fastest) - ARGUMENTS: Required positional arguments in a specific order (e.g., year, event name, session name)
- OPTIONS: Optional flags that modify behavior (e.g.,
--driver,--yes,-d)
Command Structure
Commands are organized hierarchically by data granularity:- Season Level:
events- Lists all events in a season - Event Level:
sessions- Lists all sessions in an event - Session Level:
drivers,fastest- Analyzes data within a session - Utility Commands:
cache-info,cache-clear,version,debug- Management and debugging
Getting Help
Every command has built-in help documentation:- Command description and purpose
- Required arguments with types
- Optional flags and their defaults
- Usage examples
Command Naming Conventions
- Commands use lowercase with hyphens for multi-word names (e.g.,
cache-info,cache-clear) - Arguments use natural language names (e.g.,
year,event,session) - Options use double dashes for long form (
--driver) and single dash for short form (-d)
Core Concepts
Understanding these core concepts will help you use the CLI effectively and avoid common pitfalls.Event Names
Event names are the official Grand Prix names as they appear in the FIA Formula 1 World Championship calendar. They must match exactly - the CLI performs case-sensitive string matching. Standard Event Name Format: Most events follow the pattern:"[Location] Grand Prix"
Examples:
- “Monaco Grand Prix”
- “British Grand Prix”
- “Italian Grand Prix”
- “Japanese Grand Prix”
- “Australian Grand Prix”
- “São Paulo Grand Prix” (note the special character ã)
- “United States Grand Prix” (not “US Grand Prix”)
- “Emilia Romagna Grand Prix” (not “Imola Grand Prix”)
- “Mexico City Grand Prix” (not “Mexican Grand Prix”)
- “Las Vegas Grand Prix” (not “Vegas Grand Prix”)
- “Saudi Arabian Grand Prix” (not “Saudi Grand Prix”)
events command to get the exact event names:
events output:
Session Names
Session names identify specific track sessions within an event. Like event names, they must match exactly and are case-sensitive. Standard Weekend Format: Traditional race weekends have 5 sessions:- “Practice 1” (Friday morning)
- “Practice 2” (Friday afternoon)
- “Practice 3” (Saturday morning)
- “Qualifying” (Saturday afternoon)
- “Race” (Sunday)
- “Practice 1” (Friday)
- “Sprint Qualifying” (Saturday morning)
- “Sprint” (Saturday afternoon)
- “Qualifying” (Saturday evening)
- “Race” (Sunday)
- Practice sessions: “Practice 1”, “Practice 2”, “Practice 3” (note the space)
- Qualifying: “Qualifying” (not “Quali” or “Q”)
- Sprint qualifying: “Sprint Qualifying” (two words)
- Sprint race: “Sprint” (not “Sprint Race”)
- Main race: “Race” (not “Grand Prix” or “Main Race”)
sessions command to see what sessions are available for an event:
Driver Codes
Drivers are identified by standardized three-letter codes assigned by the FIA. These codes are unique and persistent throughout a driver’s career. Code Format:- Always 3 letters (uppercase)
- Usually derived from driver’s surname
- Unique across all active drivers
- Case-insensitive in CLI (VER = ver = Ver)
Finding Driver Codes:
Use the
drivers command to see all driver codes for a session:
--driver option:
Data Loading & Caching
The CLI implements intelligent caching to optimize performance and reduce network requests. Cache Architecture:- Cache Lookup: CLI checks local SQLite cache
- Network Fetch: Data is downloaded from CDN (jsdelivr)
- JSON Parsing: Raw JSON is parsed into structured data
- DataFrame Creation: Data is converted to pandas/polars DataFrame
- Cache Write: Processed data is stored in cache
- Return: Data is displayed to user
- Network fetch: 200-2000ms (depends on connection speed)
- JSON parsing: 50-200ms (depends on data size)
- DataFrame creation: 20-100ms
- Cache write: 50-150ms
- Total: 2-10 seconds
- Cache Lookup: CLI checks local SQLite cache
- Cache Read: Data is loaded from disk
- Deserialization: Cached data is reconstructed
- Return: Data is displayed to user
- Cache read: 10-50ms
- Total: < 1 second
Custom Cache Location:
Override the default cache location:
- Cache persists across CLI sessions
- Cache survives system reboots
- Cache is shared across all CLI commands
- Cache is NOT shared with Python API (separate cache)
- Each session is cached independently
- Different data types (laps, telemetry) are cached separately
- Cache keys include year, event, session, and data type
- Cache is SQLite-based (ACID compliant, crash-safe)
Output Formatting
The CLI uses Rich library for beautiful, colorful terminal output with professional formatting. Table Components:- Title: Event name, year, and session
- Headers: Column names with color coding
- Borders: Unicode box-drawing characters
- Data Rows: Color-coded values
- Summary: Total counts and metadata
- Cyan: Numeric indices, driver codes
- Green: Event names, team names, success messages
- Yellow: Driver codes in results, warnings
- Magenta: Timing data, lap times
- Red: Error messages, failures
- Bold: Emphasis, headers, totals
- Unicode Support: Uses Unicode box-drawing characters
- Color Support: Automatically detects terminal color capabilities
- Width Adaptation: Tables adapt to terminal width
- Fallback: Gracefully degrades on limited terminals
- Screen reader compatible (plain text fallback)
- High contrast colors for visibility
- Clear visual hierarchy
- Consistent formatting across commands
Error Handling & Troubleshooting
The CLI provides clear, actionable error messages to help you quickly identify and resolve issues.Common Error Messages
1. Event Not Foundtif1 events 2025 to find the exact event name
2. Session Not Found
tif1 sessions 2025 "Monaco Grand Prix" to find exact session names
3. Driver Not Found
tif1 drivers 2025 "Monaco Grand Prix" "Race" to see available drivers
4. Network Timeout
- Check internet connection
- Increase timeout:
TIF1_TIMEOUT=60 tif1 fastest ... - Try again later
- Fix permissions:
chmod 755 ~/.cache/tif1 - Use custom cache dir:
export TIF1_CACHE_DIR=/tmp/tif1_cache
Troubleshooting Workflow
Step 1: Verify Command SyntaxPlatform-Specific Issues
Linux:- Permission denied:
sudo chown -R $USER ~/.cache/tif1 - Command not found: Add
~/.local/binto PATH - Encoding issues: Set
export LANG=en_US.UTF-8
- Command not found: Ensure Python bin directory in PATH
- Permission denied: Check SIP (System Integrity Protection) settings
- Special characters: Use UTF-8 terminal encoding
- Command not found: Add Python Scripts directory to PATH
- PowerShell execution policy:
Set-ExecutionPolicy RemoteSigned - Path with spaces: Use quotes:
"C:\Program Files\Python\Scripts\tif1"
Debug Mode
Enable verbose logging for troubleshooting:Getting Help
Built-in Help:- GitHub Issues: https://github.com/TracingInsights/tif1/issues
- Documentation: https://docs.tif1.dev
- Discord: [Community Discord Server]
Platform-Specific Guidance
Linux
Installation:macOS
Installation:- iTerm2: Best Unicode and color support
- Terminal.app: Good default support
- Alacritty: Fast, GPU-accelerated
Windows
Installation:- Windows Terminal: Best modern option (Unicode, colors, tabs)
- PowerShell 7: Improved over PowerShell 5.1
- Git Bash: Unix-like experience on Windows
-
Execution Policy Error:
-
Path with Spaces:
-
Unicode Characters:
Commands
events - List Season Events
Display all Formula 1 events (races) for a specific season year.
Syntax:
Description:
The
events command retrieves and displays the complete race calendar for a given season. This includes all Grand Prix events scheduled for that year, displayed in chronological order with their official event names.
The data is sourced from tif1’s embedded schedule data, which includes historical seasons from 2018 onwards and current/future seasons as they become available.
Output Format:
The command displays a formatted table with:
- #: Sequential event number (1-based index)
- Event: Official event name (e.g., “Monaco Grand Prix”, “British Grand Prix”)
- Total count: Summary line showing total number of events
- Quick reference for race calendar
- Planning data analysis for specific events
- Verifying event names for use in other commands
- Checking season length and schedule
- Event names must match exactly when used in other commands (case-sensitive)
- Use quotes around event names with spaces in subsequent commands
- The command works offline if schedule data is embedded in the package
sessions - List Event Sessions
Display all sessions available for a specific Formula 1 event.
Syntax:
Description:
The
sessions command retrieves all practice, qualifying, sprint, and race sessions for a specific Grand Prix event. Different events may have different session structures (e.g., sprint weekends have different formats).
Typical session types include:
- Practice 1, 2, 3: Free practice sessions (FP1, FP2, FP3)
- Qualifying: Qualifying session
- Sprint Qualifying: Sprint qualifying (on sprint weekends)
- Sprint: Sprint race (on sprint weekends)
- Race: Main Grand Prix race
- #: Sequential session number
- Session: Official session name
- Title: Event name and year
- Verify available sessions before loading data
- Check session naming conventions
- Understand event format (standard vs sprint weekend)
- Plan analysis workflow
- Event names are case-sensitive and must match exactly
- Always use quotes around event names with spaces
- Session names must be used exactly as shown in subsequent commands
- Not all events have the same session structure
drivers - List Session Drivers
Display all drivers who participated in a specific session, along with their team information.
Syntax:
Description:
The
drivers command loads session data and displays all drivers who participated, along with their team affiliations. This is useful for verifying driver availability, checking team rosters, and getting driver codes for use in other commands.
The command shows a progress indicator while loading session data from the network or cache.
Output Format:
The command displays a formatted table with:
- Driver: Three-letter driver code (e.g., VER, HAM, LEC)
- Team: Full team name (e.g., Red Bull Racing, Mercedes, Ferrari)
- Total count: Summary line showing total number of drivers
- Get driver codes for use with
--driveroption in other commands - Verify which drivers participated in a session
- Check team lineups for a specific event
- Identify reserve or substitute drivers
- Confirm driver availability before detailed analysis
- First run requires network fetch (shows progress indicator)
- Subsequent runs use cached data (much faster)
- Loading time depends on session data size and network speed
- Typical load time: 1-5 seconds (first run), <1 second (cached)
- Driver codes are standardized three-letter abbreviations (e.g., VER, HAM, LEC)
- Team names reflect the official team name at the time of the event
- Not all drivers may have complete data in all sessions (e.g., DNS, DNF)
- Use exact driver codes from this output in subsequent commands
fastest - Show Fastest Laps
Display fastest lap times for all drivers or a specific driver in a session.
Syntax:
Options:
Description:
The
fastest command analyzes lap data to find and display the fastest lap times achieved during a session. This is particularly useful for qualifying analysis, race pace comparison, and performance evaluation.
Behavior:
- Without
--driver: Shows fastest lap for each driver, sorted by lap time (fastest first) - With
--driver: Shows only the specified driver’s fastest lap with detailed timing
- Pos: Position in fastest lap ranking (1 = fastest)
- Driver: Three-letter driver code
- Team: Team name
- Time: Lap time in seconds (formatted to 3 decimal places)
--driver specified):
- Simple text output showing driver code and fastest lap time
- Qualifying Analysis: Compare driver performance in qualifying sessions
- Race Pace: Identify fastest race laps for pace analysis
- Driver Comparison: Quickly compare lap times between drivers
- Performance Tracking: Monitor driver/team performance across sessions
- Quick Checks: Verify specific driver’s best performance
- Loads complete lap data for the session (may take 2-10 seconds first time)
- Cached data makes subsequent runs much faster (<1 second)
- Processing time increases with number of laps in session
- Qualifying sessions are typically faster to load than races
- Only includes valid, completed laps (excludes in/out laps, invalid laps)
- Times are shown in seconds with millisecond precision
- Deleted lap times (track limits violations) may be excluded
- Some drivers may not have valid laps (DNS, early DNF)
- Driver codes must match exactly (case-sensitive: VER, not ver)
- Invalid driver codes will result in an error message
- Times are sorted automatically (fastest first)
- The
--driveroption is useful for quick single-driver checks
cache-info - Display Cache Statistics
Show detailed information about the tif1 cache, including location, size, and file count.
Syntax:
cache-info command provides a summary of your local tif1 cache, which stores downloaded F1 data to speed up subsequent requests. This is useful for monitoring cache growth, troubleshooting storage issues, and understanding cache behavior.
Output Format:
The command displays:
- Cache location: Full filesystem path to the cache directory
- Cache files: Number of cache-related files
- Total size: Combined size of all cache files in megabytes (MB)
- Monitor cache growth: Check how much disk space the cache is using
- Troubleshoot performance: Verify cache is being used
- Storage management: Identify if cache needs clearing
- Debugging: Confirm cache location for manual inspection
- Documentation: Record cache paths for team documentation
Cache Structure:
The cache directory typically contains:
cache.sqlite: Main SQLite database filecache.sqlite-wal: Write-Ahead Log file (WAL mode)cache.sqlite-shm: Shared memory file (WAL mode)
- Number of sessions loaded: Each session adds lap data, telemetry, etc.
- Data types requested: Telemetry data is larger than lap times
- Historical data: Older seasons accumulate over time
- Typical sizes:
- Fresh install: ~0 MB
- Light usage (few sessions): 50-200 MB
- Moderate usage (multiple seasons): 200-500 MB
- Heavy usage (extensive analysis): 500+ MB
- Cache hit: Data loads in <1 second (from disk)
- Cache miss: Data loads in 2-10 seconds (from network)
- Cache benefit: 5-10x faster load times for cached data
TIF1_CACHE_DIR environment variable:
- Check for multiple cache locations (environment variable override)
- Verify disk space availability
- Check file permissions on cache directory
- Consider clearing cache if corrupted:
tif1 cache-clear
tif1 cache-clear: Clear all cached data- Environment variable
TIF1_CACHE_DIR: Override cache location - Environment variable
TIF1_ENABLE_CACHE: Disable caching entirely
cache-clear - Clear Cache Database
Delete all cached data to free up disk space or force fresh data fetches.
Syntax:
Description:
The
cache-clear command removes all cached Formula 1 data from your local cache database. This is useful when:
- Freeing disk space: Cache has grown too large
- Forcing fresh data: Suspect cached data is stale or corrupted
- Troubleshooting: Debugging cache-related issues
- Testing: Measuring cold-start performance
- Data updates: Ensuring you get the latest data from the CDN
--yes flag):
Skip the confirmation prompt for scripting or automation:
-
Disk Space Management:
-
Force Data Refresh:
-
Automated Scripts:
-
Troubleshooting:
- All cached session data (laps, telemetry, weather, messages)
- All cached schedule data
- All cached driver information
- SQLite database tables (structure is preserved, data is removed)
- Cache directory itself (remains for future use)
- Configuration files (
.tif1rc) - Log files (if any)
- First data load: 2-10 seconds (network fetch)
- Subsequent loads: <1 second (cached)
- Cache rebuild: Automatic as you use commands
- No data loss: Only cached data is removed; original data remains on CDN
- Reversible: Cache rebuilds automatically as you use the CLI
- No configuration changes: Your settings remain intact
- Safe to interrupt: Can be cancelled with Ctrl+C before confirmation
0: Cache cleared successfully1: Error during cache clearing (permissions, disk issues, etc.)130: User cancelled with Ctrl+C
tif1 cache-info: Check cache size before clearing- Environment variable
TIF1_CACHE_DIR: Custom cache location - Environment variable
TIF1_ENABLE_CACHE: Disable caching entirely
version - Show Version Information
Display the installed tif1 version number.
Syntax:
version command displays the currently installed version of tif1. This is useful for:
- Troubleshooting: Verify which version you’re running when reporting issues
- Compatibility: Check if you have the required version for specific features
- Updates: Confirm successful upgrade after running
pip install --upgrade tif1 - Documentation: Ensure documentation matches your installed version
tif1 version X.Y.Z
Where:
- X: Major version (breaking changes)
- Y: Minor version (new features, backwards compatible)
- Z: Patch version (bug fixes, backwards compatible)
-
Check Current Version:
-
Verify Upgrade:
-
Bug Reports:
-
Scripting:
- 0.2.0: Current release with CLI improvements
- 0.1.0: Initial release
0: Success (always succeeds)
debug - Debug Session Loading
Load a session with detailed debug logging enabled to troubleshoot issues.
Syntax:
Description:
The
debug command loads a session with verbose debug logging enabled, providing detailed information about the data loading process. This is invaluable for:
- Troubleshooting: Diagnose why data isn’t loading correctly
- Performance Analysis: See timing for each loading step
- Network Issues: Identify connection problems or timeouts
- Cache Behavior: Verify cache hits/misses
- Development: Understand internal data flow
debug displays:
- HTTP requests and responses
- Cache lookups and stores
- Data parsing steps
- Error details and stack traces
- Timing information
- Internal state changes
-
Diagnose Loading Failures:
-
Performance Investigation:
-
Cache Verification:
-
Network Troubleshooting:
- [DEBUG] prefix: All debug messages
- Timestamps: Relative timing for operations
- URLs: Full CDN URLs being fetched
- File sizes: Data size being downloaded/parsed
- Cache operations: Hit/miss, read/write timing
- DataFrame info: Row counts, column names
- Errors: Full stack traces for failures
- Cache hit: 10-50ms total
- Cache miss:
- HTTP fetch: 200-2000ms (depends on network)
- JSON parsing: 50-200ms (depends on data size)
- DataFrame creation: 20-100ms
- Cache write: 50-150ms
- Total: 2-10 seconds
debug command sets logging to DEBUG level, which shows:
- DEBUG: Detailed internal operations
- INFO: General information messages
- WARNING: Potential issues
- ERROR: Failures and exceptions
- stdout: Normal output (session loaded message)
- stderr: Debug logging (all [DEBUG] messages)
Important Notes:
- Debug logging adds ~5-10% overhead due to logging operations
- Output can be verbose (hundreds of lines for large sessions)
- Sensitive data (URLs, file paths) may be logged
- Not recommended for production scripts (use normal commands)
0: Session loaded successfully1: Error loading session (network, data, cache issues)
tif1 drivers: Normal driver listing (no debug output)tif1 fastest: Normal fastest lap listing (no debug output)- Environment variable
TIF1_LOG_LEVEL: Set logging level globally
Common Workflows
Explore Available Data
Start with high-level exploration and drill down to specific details:- Discover available data without guessing event/session names
- Verify data exists before writing Python code
- Understand the data structure and hierarchy
Quick Performance Analysis
Compare driver performance across sessions:Driver-Specific Analysis
Focus on a single driver’s performance:Cache Management Workflow
Monitor and maintain cache health:Troubleshooting Workflow
Diagnose and fix data loading issues:Historical Data Analysis
Explore data from past seasons:Sprint Weekend Analysis
Sprint weekends have different session structures:Scripting & Automation
Integrate CLI into shell scripts:Data Validation Workflow
Verify data completeness and accuracy:Batch Processing
Process multiple events efficiently:Advanced Usage
Piping & Text Processing
Combine CLI with standard Unix tools:Output Redirection
Save CLI output to files:Environment Variable Usage
Customize CLI behavior with environment variables:Conditional Execution
Use exit codes for conditional logic:Parallel Processing
Run multiple CLI commands in parallel:JSON Output (Future Enhancement)
While not currently supported, you can parse table output:Tips & Best Practices
General Tips
-
Always use quotes for multi-word names:
-
Use tab completion (if your shell supports it):
-
Check help when unsure:
-
Verify event names first:
-
Use short options for speed:
Performance Tips
-
Let cache warm up:
-
Monitor cache size:
-
Use specific driver queries:
-
Avoid unnecessary debug mode:
Scripting Tips
-
Handle errors gracefully:
-
Use variables for reusability:
-
Suppress output when needed:
-
Check exit codes:
Troubleshooting Tips
-
Start with debug mode:
-
Clear cache when in doubt:
-
Check version compatibility:
-
Verify network connectivity:
-
Use offline mode for testing:
Data Quality Tips
-
Verify driver count:
-
Check for missing data:
-
Compare across sessions:
-
Use historical data for validation:
Exit Codes
0: Success1: General error (network, data not found, etc.)2: Invalid arguments
Environment Variables
The CLI respects the same environment variables as the Python API for consistent behavior across interfaces:Available Environment Variables
Usage Examples
Custom Cache Directory:Configuration File
While the CLI primarily uses environment variables, you can create a shell configuration file for persistent settings: Linux/macOS (~/.tif1rc):Environment Variable Precedence
When multiple configuration sources exist, precedence is:-
Command-line override (highest priority)
-
Shell environment variable
-
Configuration file
- Default value (lowest priority)
Advanced Topics
Performance Optimization
1. Parallel Processing Process multiple sessions simultaneously:Integration with Other Tools
1. jq (JSON Processing) While CLI doesn’t output JSON directly, you can convert:CI/CD Integration
GitHub Actions Example:Docker Integration
Dockerfile:Monitoring and Logging
1. Command Logging Track all CLI usage:Security Considerations
1. Cache Security Protect cached data:Testing and Validation
1. Smoke Tests Verify CLI functionality:Best Practices
General Best Practices
-
Always Quote Multi-Word Arguments
-
Use Exact Names from CLI Output
-
Check Help When Unsure
-
Use Short Options for Speed
-
Leverage Tab Completion
Performance Best Practices
-
Let Cache Warm Up
-
Monitor Cache Size
-
Use Specific Queries
-
Avoid Unnecessary Debug Mode
Scripting Best Practices
-
Handle Errors Gracefully
-
Use Variables for Reusability
-
Suppress Output When Needed
-
Check Exit Codes
-
Use Functions for Repeated Tasks
Data Quality Best Practices
-
Verify Driver Count
-
Check for Missing Data
-
Compare Across Sessions
-
Use Historical Data for Validation
Security Best Practices
-
Validate User Input
-
Use Secure Cache Locations
-
Be Cautious with Piping
Maintenance Best Practices
-
Keep tif1 Updated
-
Monitor Cache Growth
-
Clean Up Old Data
-
Document Your Workflows
Frequently Asked Questions (FAQ)
General Questions
Q: Is the CLI free to use? A: Yes, tif1 CLI is completely free and open-source. Q: Do I need an API key? A: No, tif1 CLI doesn’t require any API keys or authentication. Q: What data is available? A: Historical F1 data from 2018 onwards, including lap times, telemetry, weather, and race control messages. Q: How often is data updated? A: Data is typically available within hours after each session concludes. Q: Can I use this for commercial purposes? A: Check the license terms, but generally yes for analysis and research.Technical Questions
Q: Why is the first command slow? A: The first request fetches data from the network and caches it. Subsequent requests are much faster. Q: How much disk space does the cache use? A: Typically 50-500 MB depending on usage. Check withtif1 cache-info.
Q: Can I use this offline?
A: Yes, if data is already cached. Use TIF1_OFFLINE_MODE=true to prevent network requests.
Q: Does the CLI support Python 2?
A: No, Python 3.10 or higher is required.
Q: Can I run multiple CLI instances simultaneously?
A: Yes, the cache is designed to handle concurrent access safely.
Data Questions
Q: Why is driver X missing from the results? A: The driver may not have participated in that session (DNS, DNF, or reserve driver). Q: Why are lap times different from official timing? A: Data source and processing may differ slightly from official FIA timing. Q: Can I get telemetry data via CLI? A: Currently, the CLI focuses on lap times and driver info. Use the Python API for telemetry. Q: How accurate is the data? A: Data is sourced from official timing systems and is generally very accurate.Troubleshooting Questions
Q: Command not found error? A: Ensure tif1 is installed and Python Scripts directory is in your PATH. Q: Permission denied error? A: Check cache directory permissions or use a custom cache location. Q: Network timeout error? A: Increase timeout withTIF1_TIMEOUT=60 or check your internet connection.
Q: Cache corruption error?
A: Clear cache with tif1 cache-clear -y and try again.
Changelog
Version 0.2.0 (Current)
New Features:- Added
debugcommand for verbose logging - Improved error messages with actionable suggestions
- Enhanced table formatting with Rich library
- Added progress indicators for long operations
- Faster cache lookups with optimized SQLite queries
- Better Unicode support for special characters in event names
- Improved Windows compatibility
- Fixed cache corruption on interrupted downloads
- Fixed driver code case sensitivity issues
- Fixed table rendering on narrow terminals
Version 0.1.0 (Initial Release)
Features:- Basic CLI commands: events, sessions, drivers, fastest
- SQLite-based caching system
- Rich terminal output with tables
- Cross-platform support (Linux, macOS, Windows)
Contributing
We welcome contributions to improve the CLI! Here’s how you can help:Reporting Issues
- Check existing issues on GitHub
- Provide detailed error messages and steps to reproduce
- Include your OS, Python version, and tif1 version
- Use
tif1 debugoutput when relevant
Suggesting Features
- Open a GitHub issue with the “enhancement” label
- Describe the use case and expected behavior
- Provide examples of how the feature would be used
Contributing Code
- Fork the repository
- Create a feature branch
- Make your changes with tests
- Submit a pull request
Documentation
Help improve this documentation:- Fix typos and clarify confusing sections
- Add more examples and use cases
- Translate to other languages
License
tif1 CLI is released under the MIT License. See LICENSE file for details.Support
- Documentation: https://docs.tif1.dev
- GitHub Issues: https://github.com/TracingInsights/tif1/issues
- Discord: [Community Server]
- Email: support@tif1.dev
Acknowledgments
- Typer: CLI framework
- Rich: Terminal formatting
- pandas/polars: Data processing
- niquests: HTTP client
- TracingInsights: Data source
Last updated: April 2026 CLI Version: 0.2.0 Documentation Version: 2.0