Skip to content

v0.3.0

Choose a tag to compare

@velikodniy velikodniy released this 09 Jul 16:36
2fdb6d7

⚠️ Breaking release

This release renames the year-month value type and everything named after it, and ships the first Python bindings on PyPI.

Python bindings — new

pip install hmrc-rates (Python ≥ 3.10). abi3 wheels for Linux (glibc + musl, x86_64 + aarch64), macOS (universal2) and Windows (x64); the sdist builds anywhere with a Rust toolchain.

from decimal import Decimal
from hmrc_rates import YearMonth, Rates, YearEnd

rates = Rates()
rate = rates.monthly_rate("USD", YearMonth(2025, 8))   # also accepts datetime.date or "2025-08"
gbp = rate.to_gbp(Decimal("2500"))                     # exact decimal.Decimal — you choose the rounding

Breaking changes

Rust crate

  • MonthYearMonth, and ParseMonthErrorParseYearMonthError.
  • month arguments → year_month on Rates::monthly_rate, monthly_rate_or_earlier, monthly.
  • YearEnd::from_monthfrom_year_month; YearEnd::end_monthend_year_month.
  • Period::Month variant → Period::YearMonth.
  • Serde wire format changed: a Period now serializes as {"year_month": "2025-08"} (previously {"month": …}). Data serialized by earlier versions will not deserialize.
  • The dependency pin is now hmrc-rates = "0.3".

Python

  • Class MonthYearMonth; type alias MonthLikeYearMonthLike.
  • Keyword argument month=year_month= on the lookup methods.
  • YearEnd.from_monthfrom_year_month; YearEnd.end_monthend_year_month.
  • Period.kind now returns "year_month" (was "month"); the Period.month property is now Period.year_month.

Unchanged

YearMonth.month/.year (the numeric 1–12 month and the year), RateType/MONTHLY, the monthly*() lookups, the exception hierarchy, and the bundled data coverage.