A tool to validate and audit iRacing league sessions against expected parameters
Project description
iRacing League Session Auditor
A tool to validate and audit iRacing league sessions against expected parameters. This utility helps league administrators ensure that their racing sessions are configured correctly and consistently.
Features
- Validates iRacing league sessions against predefined expectations
- Monitors sessions for changes and only re-validates when needed
- Supports advanced validation rules including time-based scheduling with cron expressions
- Sends notifications via webhooks when validation fails
- State tracking to avoid redundant validations
- Docker support for containerized deployment
Installation
Using pip
pip install iracing_league_session_auditor
From source
git clone https://github.com/TylerAgostino/iracing_league_session_auditor.git
cd iracing_league_session_auditor
pip install -e .
Using Docker
# Build the Docker image
docker build -t iracing_league_session_auditor .
# Run with command-line arguments
docker run -v $(pwd)/expectations.json:/app/expectations.json -v $(pwd)/data:/data iracing_league_session_auditor --username "your_iracing_email" --password "your_iracing_password" --league-id 12345
Usage
Command Line
iracing-audit --username "your_iracing_email" --password "your_iracing_password" --league-id 12345 --expectations-path "expectations.json"
Windows may require using iracing-audit.exe instead of iracing-audit.
Or directly with:
python -m iracing_league_session_auditor --username "your_iracing_email" --password "your_iracing_password" --league-id 12345 --expectations-path "expectations.json"
Options
--username: iRacing account email (required)--password: iRacing account password (required)--league-id: iRacing league ID (required)--expectations-path: Path to the JSON file containing expectations (default: "expectations.json")--state-path: Path to the JSON file for storing state (default: "state.json")--webhook-url: URL of the webhook to send results to (optional)--keep-alive: Keep the application running to monitor changes (default: false)--interval: Interval in minutes to re-run the validation when keep-alive is enabled (default: 60)--force: Force re-validation of all sessions, even if they haven't changed
Docker Compose
A sample docker-compose.yaml is included in the repository:
# Create and configure your environment file
cp .env.example .env
# Edit the .env file with your credentials
# Run with Docker Compose
docker-compose up -d
The Docker Compose setup:
- Mounts your expectations.json file into the container
- Creates a persistent volume for the state.json file
- Uses environment variables from your .env file
- Runs as a service that can be restarted automatically
Configuration
Expectations File
The expectations file is a JSON document that defines the expected configuration for your league sessions. Each entry in the expectations array represents a different session type that might be found in your league.
Example:
[
{
"name": "NASCAR Trucks",
"expectation": {
"cars": [
{
"car_id": 123,
"car_name": "NASCAR Truck Ford F150",
"car_class_id": 0
}
],
"launch_at": { "cron": "30 0 * * 4", "margin": 15 },
"max_drivers": { "operator": ">", "value": 20 },
"league_id": 8579,
"practice_length": 20,
"qualify_length": 20,
"race_length": 20
}
}
]
If there is no expectations file, the tool will create one using the first session it finds in the league. This can be useful for initial setup.
Cron Expressions for Session Scheduling
The tool supports validating session start times using cron expressions with a margin of error in minutes:
"launch_at": { "cron": "30 0 * * 4", "margin": 15 }
This example expects sessions to start at 00:30 on Thursdays with a 15-minute margin.
For whatever reason, Python has to be different and uses different numbers for the days of the week in cron expressions. This is dumb, and I choose to use unix style instead. So, in this case, 0 = Sunday, 1 = Monday, ..., 6 = Saturday.
State File
The state file tracks session states to avoid unnecessary revalidation. This file is managed automatically by the tool. You can force revalidation of all sessions using the --force flag.
Environment Variables
When using Docker or Docker Compose, you can configure the application using environment variables:
# Required variables
IRACING_USERNAME=your_iracing_email@example.com
IRACING_PASSWORD=your_iracing_password
LEAGUE_ID=8579
# Optional variables
WEBHOOK_URL=https://discord.com/api/webhooks/your_webhook_url
A .env.example file is included in the repository. Copy it to .env and update with your credentials:
cp .env.example .env
Notifications
When validation fails, the tool can send notifications to a webhook URL. This is currently only implemented for Discord webhooks
Development
Requirements
- Python 3.8+
- Development dependencies: pytest, black, flake8, mypy
Setup Development Environment
# Create a virtual environment
python -m venv .venv
source .venv/bin/activate # On Windows: .venv\Scripts\activate
# Install development dependencies
pip install -e ".[dev]"
Project details
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 iracing_league_session_auditor-1.1.3.tar.gz.
File metadata
- Download URL: iracing_league_session_auditor-1.1.3.tar.gz
- Upload date:
- Size: 57.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f30c35283e0ea31b6c5895b7201b09b486ef8c91f1f34b296cac8df0b8ba597e
|
|
| MD5 |
646de9889df08c4c0bb99d2cd2ead2ad
|
|
| BLAKE2b-256 |
bc6904c0f534f85d26bcc7c223c244d17721d7b90355ce6eb45bd7fca4de4e26
|
Provenance
The following attestation bundles were made for iracing_league_session_auditor-1.1.3.tar.gz:
Publisher:
python-publish.yml on TylerAgostino/iracing_league_session_auditor
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
iracing_league_session_auditor-1.1.3.tar.gz -
Subject digest:
f30c35283e0ea31b6c5895b7201b09b486ef8c91f1f34b296cac8df0b8ba597e - Sigstore transparency entry: 668483923
- Sigstore integration time:
-
Permalink:
TylerAgostino/iracing_league_session_auditor@11b904d3ca3263bde76e44df95750204750a9d6e -
Branch / Tag:
refs/tags/v1.1.3 - Owner: https://github.com/TylerAgostino
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@11b904d3ca3263bde76e44df95750204750a9d6e -
Trigger Event:
release
-
Statement type:
File details
Details for the file iracing_league_session_auditor-1.1.3-py3-none-any.whl.
File metadata
- Download URL: iracing_league_session_auditor-1.1.3-py3-none-any.whl
- Upload date:
- Size: 62.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1605a425507c2b808a1a5b750d51bb25a0425e5216ca969c7e3ac4cd810fc06b
|
|
| MD5 |
e3da17989eefa6640503ccdba4c3e3f0
|
|
| BLAKE2b-256 |
9a2c245e78e4f3fbc3eb15d0a70c23fcf3af837827e7a19bb52e0de761d3dfe6
|
Provenance
The following attestation bundles were made for iracing_league_session_auditor-1.1.3-py3-none-any.whl:
Publisher:
python-publish.yml on TylerAgostino/iracing_league_session_auditor
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
iracing_league_session_auditor-1.1.3-py3-none-any.whl -
Subject digest:
1605a425507c2b808a1a5b750d51bb25a0425e5216ca969c7e3ac4cd810fc06b - Sigstore transparency entry: 668483951
- Sigstore integration time:
-
Permalink:
TylerAgostino/iracing_league_session_auditor@11b904d3ca3263bde76e44df95750204750a9d6e -
Branch / Tag:
refs/tags/v1.1.3 - Owner: https://github.com/TylerAgostino
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@11b904d3ca3263bde76e44df95750204750a9d6e -
Trigger Event:
release
-
Statement type: