A lightweight, dependency-free Python tool to parse and validate tire codes
Project description
Tire Codes
Description
Tire codes is a lightweight, easy-to-use Python tool designed to parse various tire specifications from tire codes.
Features
- Parses tire specifications from various formats.
- Extractable specs include:
- FORMAT
- SERVICE_TYPE
- WIDTH
- ASPECT_RATIO
- WHEEL_DIAMETER
- CONSTRUCTION
- OVERALL_DIAMETER
- LOAD_INDEX
- LOAD_INDEX_DUAL
- SPEED_RATING
Installation
Install directly with pip. No external dependencies.
pip install tire-codes
Example
For a tire code like "215/70R16 100T" (metric) or "35X12.5R20 125S" (off-road), the parser will automatically detect the format and extract the details into a TireSpecs
object.
Usage
To parse a tire code, pass your tire code string to the TireCodeParser
object:
from tire_codes import TireCodeParser, TireCodeParsingError, TireCodeValidationError
try:
parser = TireCodeParser("295/40R21 111Y")
specs = parser.parse()
print(specs)
except TireCodeParsingError as e:
print(f"Parsing error: {e}")
except TireCodeValidationError as e:
print(f"Validation error: {e}")
You can also access all spec values as a dictionary:
print(specs.to_dict())
Command-Line Interface
You can also run the parser from the command line:
python3 main.py "295/40R21 111Y"
Contributing
Any suggestions or contributions are welcome! I hope you find this package useful.
License
MIT License
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
Hashes for tire_codes-0.1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 651f5b54f8eed4b0258bdaeea0229cb70ee8b6f3cdf15e8c92cf8c25617f7721 |
|
MD5 | 6f7f21e45c5736db76bb87c231385bff |
|
BLAKE2b-256 | 89c339eb2b5c9797e1205dae078b8b87de27a8b3b1fa529d468e314ab82317c6 |