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
File details
Details for the file tire_codes-0.1.0.tar.gz
.
File metadata
- Download URL: tire_codes-0.1.0.tar.gz
- Upload date:
- Size: 15.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.10.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0d349b59a7fe765a96c032cdd1ab7680a45b7083bc8443c045e959628e405bbf |
|
MD5 | ef9bea591639d8a16e4e807c1218dc54 |
|
BLAKE2b-256 | 2b3b839ad509d259cbeb46f666798f36a0bdacb99628a51df8f889ae22e52141 |
File details
Details for the file tire_codes-0.1.0-py3-none-any.whl
.
File metadata
- Download URL: tire_codes-0.1.0-py3-none-any.whl
- Upload date:
- Size: 16.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.10.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 651f5b54f8eed4b0258bdaeea0229cb70ee8b6f3cdf15e8c92cf8c25617f7721 |
|
MD5 | 6f7f21e45c5736db76bb87c231385bff |
|
BLAKE2b-256 | 89c339eb2b5c9797e1205dae078b8b87de27a8b3b1fa529d468e314ab82317c6 |