Skip to main content

mkdocs-unirate

MkDocs plugin that bakes live UniRate API exchange rates into your documentation at build time — through inline Markdown placeholders and a Jinja template global.

PyPI Python License: MIT CI

Installation

pip install mkdocs-unirate

Quick start

Add the plugin to mkdocs.yml:

plugins:
  - unirate:
      api_key: !ENV UNIRATE_API_KEY   # or hard-code (not recommended)
      base_currency: USD
      currencies: [EUR, GBP, JPY]
      strict: false
      decimals: 4

Then drop placeholders into any Markdown page:

1 USD = {{ unirate_rate:USD:EUR }} EUR
100 USD converts to {{ unirate_convert:USD:JPY:100 }} JPY

Build with your key in the environment:

UNIRATE_API_KEY=your_key mkdocs build

Get a free key at unirateapi.com.

Placeholders

Placeholder Renders
{{ unirate_rate:FROM:TO }} Current exchange rate for the pair
{{ unirate_convert:FROM:TO:AMOUNT }} AMOUNT converted at the current rate

Currency codes are case-insensitive and uppercased before the API call. Each distinct pair is fetched once per build and cached, so repeated placeholders cost a single request.

Jinja global

For pages rendered through Jinja (a custom theme, or mkdocs-macros-plugin), a unirate global is registered via on_env:

{{ unirate.base_currency }}
{{ unirate.rate("USD", "EUR") }}
{{ unirate.convert(250, "USD", "EUR") }}
{{ unirate.currencies | length }}

Configuration

Option Type Default Description
api_key str "" UniRate API key. Falls back to UNIRATE_API_KEY env var.
base_url str "" Override the API base URL (rare — self-hosted proxy).
base_currency str "USD" Default base exposed to the Jinja global.
currencies list [] Currencies of interest (informational / templates).
enable_markdown bool true Toggle Markdown placeholder substitution.
enable_jinja bool true Toggle the unirate Jinja global.
strict bool false Fail the build on any UniRate error instead of warning.
decimals int 4 Decimal places for rendered values.
timeout int 30 HTTP request timeout in seconds.

Error handling

On a UniRate error (bad key, unknown currency, rate limit, service outage):

  • strict: false (default) — a warning is logged and the original placeholder text is left untouched, so the build still succeeds.
  • strict: true — the build aborts with a clear error message.

Status codes map to the canonical UniRate error taxonomy: 401 → authentication, 404 → invalid currency, 429 → rate limit, 403 → Pro subscription required, 503 → service unavailable.

Other UniRate integrations: Python · Node.js · Go · Rust · Ruby · PHP · Java · Swift · .NET · FastAPI · Flask · Streamlit · Hugo · Jekyll · Eleventy · MCP Server · CLI

License

MIT — see LICENSE.

Metadata

Release files for mkdocs-unirate 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for mkdocs-unirate 0.1.0
File Size Uploaded
mkdocs_unirate-0.1.0.tar.gz 11.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for mkdocs-unirate 0.1.0
File Interpreter ABI Platform
mkdocs_unirate-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 20.7 kB

Release files / mkdocs_unirate-0.1.0.tar.gz

Download URL mkdocs_unirate-0.1.0.tar.gz
Size 11.3 kB
Tags Source
SHA-256 checksum
How to use checksums
3a3720dbb6517b2be931c80cf79573e9957dcbb4eafb1c86833c7b7092c7045f
BLAKE2b-256 checksum
How to use checksums
264d0c1cae417392b7cbb3ef59cbd54e350b579c28b58de8ea72c616970d29cf
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 11, 2026.

Transparency log

Release files / mkdocs_unirate-0.1.0-py3-none-any.whl

Download URL mkdocs_unirate-0.1.0-py3-none-any.whl
Size 9.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
24e08f14663807809d1f09810f172b9de61397e527326f7d7ebb23d4f292c0ab
BLAKE2b-256 checksum
How to use checksums
83ab0629b346fd59c1a0b4faebf563903a5c06da7f31b3eb31919df6ef253419
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 11, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page