portugal-vehicle-tax
Portuguese vehicle-tax calculators — ISV (Imposto Sobre Veículos, the one-off import/registration tax) and IUC (Imposto Único de Circulação, the annual road tax) — as a zero-dependency, pure-Python library.
Maintained by Clara Cars and used in production behind the public
API at https://claracars.pt/api/public. Source: claracarspt/calcs.
A maintained estimate, cross-checked against the official AT simulator; not the official AT figure. These calculators are periodically verified against the Autoridade Tributária (AT) simulator and public tax tables — they are not the official AT number and not a substitute for the AT simulator or a licensed despachante. Tax tables change every year; verify before you rely on a euro amount.
Install
pip install portugal-vehicle-tax
Requires Python 3.10+. No runtime dependencies.
Usage
from portugal_vehicle_tax import isv, iuc
# ISV — 2016 diesel, 1950 cc, 130 g/km CO2, 10.2 years old, used EU import
r = isv.compute_isv("passenger", cc=1950, co2=130, fuel="diesel",
age_years=10.2, year=2016, from_eu=True, used=True)
print(r["isv"]) # 1832.92
print(r["breakdown"]) # itemised like the official AT "Demonstração"
# IUC — annual road tax for the same car
print(iuc.compute(cc=1950, co2=130, fuel="diesel", year=2016)["iuc"]) # 278.85
# Electric → exempt from both
isv.compute_isv("passenger", fuel="electric") # {'isv': 0.0, 'exempt': True, ...}
ISV — isv.compute_isv(category, cc, co2, fuel, age_years, year, ...)
| Arg | Notes |
|---|---|
category |
passenger | autocaravana | motorcycle | van_10 | commercial_15/50/100 | pesados_mercadorias | pesados_passageiros |
cc |
Engine displacement (cm³) |
co2 |
CO₂ g/km (WLTP/NEDC auto-selected by year) |
fuel |
petrol | diesel | electric | phev | hybrid | lpg |
age_years |
Years since first registration (drives the Tabela D reduction) |
year |
First-registration year (NEDC/WLTP + PHEV cap + classic flags) |
from_eu, used |
EU import + used → age reduction eligible |
phev_range_km |
PHEV needs ≥50 km (+ low CO₂) for the 75% reduction |
Returns a dict with isv, exempt, table, breakdown (line-by-line AT demonstração),
age_reduction_pct, and a note where a caveat applies.
IUC — iuc.compute(cc, co2, fuel, year, vehicle_type="passenger")
Categoria B (cars ≥2007, cc+CO₂), Categoria A (<2007, cc × year-band), Categoria E
(motorcycles). For goods vehicles use iuc.compute_iuc(vehicle_type, cc, co2, fuel, year, peso_bruto=...) (Categorias C/D, by gross weight).
Correctness self-check
python -m pytest -q # or: python tests/test_calc.py
Ships a golden case table (petrol, diesel with age reduction, electric-exempt, the €100 minimum, PHEV reduction) frozen against the canonical Clara Cars logic. Any drift fails.
Related
- Live API (key-free):
https://claracars.pt/api/public/isv?cc=1950&co2=130&fuel=diesel&year=2016— returns both ISV and IUC. - JS/TS SDK:
portugal-vehicle-taxon npm - PHP SDK:
claracars/portugal-vehicle-taxon Packagist - MCP server: claracarspt/mcp
MIT © Clara Cars
Release files for portugal-vehicle-tax 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| portugal_vehicle_tax-1.0.0.tar.gz | 22.4 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| portugal_vehicle_tax-1.0.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 43.6 kB
Release files / portugal_vehicle_tax-1.0.0.tar.gz
| Download URL | portugal_vehicle_tax-1.0.0.tar.gz |
|---|---|
| Size | 22.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
e89679d44bf05cbd9035dbf29b82536b8678d5fd1d4b1464d93da46d913633d5
|
|
BLAKE2b-256 checksum How to use checksums |
96b00d900640824fa725205f3f423d7af63c98d152d0daaf63a2996eda858823
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.9.6
|
Release files / portugal_vehicle_tax-1.0.0-py3-none-any.whl
| Download URL | portugal_vehicle_tax-1.0.0-py3-none-any.whl |
|---|---|
| Size | 21.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
51b7480f605642e3470da6d13e835ed13562d632db0aa95f6d8ab08d4b8a46ec
|
|
BLAKE2b-256 checksum How to use checksums |
4a356f636dbc62f1a2f09f21c60bb1cb58177dee2b0b6bf39dd6a083a63d00a8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.9.6
|