fxtranslate
Translate with Firefox Translations models from Python — a library powered by the same lightweight, CPU-only models Firefox ships for on-device translation. The engine is native compiled Rust (fast, CPU-only, no GPU), and it discovers, downloads, and caches the models for you; no API keys, no network round-trips to a translation service, nothing leaves your machine after the model download.
Unlike the npm/wasm build, the Python wheel ships the fast, batteries-included engine: the gemmology SIMD int8 GEMM kernel, mmap, ICU4X sentence segmentation, and built-in networked model discovery/download/caching. Prefer a native binary, a Rust dependency, or Node? See Related packages.
Install
$ pip install fxtranslate
The first release ships an sdist plus one platform wheel (built on the release machine). On other platforms pip compiles from source — that needs a Rust and C++ toolchain, and it falls back to the portable scalar kernel automatically if no SIMD backend is wired for your target — until the full binary-wheel matrix lands.
Library, batteries-included
Lead with this — the native advantage over the wasm build. One call discovers the model for the pair, downloads and hash-verifies it into a local cache, builds the engine, and is ready to translate:
from fxtranslate import Translator
t = Translator.load("en", "es") # discover → download → cache → ready
print(t.translate("The weather is nice today."))
# El clima es agradable hoy.
# translate_long segments multi-sentence / long input and translates each part
# within the model's context window, instead of truncating.
print(t.translate_long(long_article))
Library, bring-your-own model
If you already have the model files on disk (recommended for production — see The models), pass the bytes directly. You supply the marian .bin model and the source/target SentencePiece vocabularies (the same file for most pairs; only CJK pairs differ) — pass the source vocab twice for a shared-vocab pair:
from fxtranslate import Translator
model = open("en-es/model.bin", "rb").read()
vocab = open("en-es/vocab.spm", "rb").read()
t = Translator(model, vocab, vocab) # src vocab twice for shared-vocab pairs
print(t.translate("The weather is nice today."))
Discovery helpers
fxtranslate.discovery re-exports the pure model-discovery/routing surface the batteries-included path is built on — over a Remote Settings records body, returning native Python objects (no JSON strings) — for building your own model-management flow:
from fxtranslate import discovery
route = discovery.resolve_route(records_json, "en", "es") # {"kind": "direct", ...}
cat = discovery.catalog(records_json, "en") # {"bidirectional": [...], ...}
pairs = discovery.model_pairs(records_json) # list[(src, trg)]
recs = discovery.parse_records(records_json) # list[dict]
sents = discovery.segment_sentences(text) # list[str] (ICU4X UAX #29)
plain = discovery.verify_and_decompress(zst_bytes, sha256_hex) # bytes
The models
fxtranslate uses the models Firefox ships. They're discovered through Mozilla's Remote Settings and downloaded from Firefox's CDN, then cached under the platform-native cache directory — ~/Library/Caches/fxtranslate/models on macOS, $XDG_CACHE_HOME/fxtranslate/models on Linux, %LOCALAPPDATA%\fxtranslate\models on Windows — one subdirectory per language pair.
That hosting is provisioned for Firefox, not for third-party traffic, and neither the endpoints nor the availability of any particular model are a stable contract for downstream projects. Translator.load is a convenient way to try the engine; if you're shipping a product on top of it, mirror the model files you depend on, serve them from infrastructure you control, and load them with the bring-your-own-model Translator(...) constructor.
Related packages
The same engine is published across ecosystems on one shared version, so you can pick the artifact that fits:
fxtranslate(crates.io) — the Rust engine library. Native SIMD int8 kernel, optional built-in model management.fxtranslate-cli(crates.io) — the native Rust CLI, installed withcargo install fxtranslate-cli.fxtranslate(npm) — the Node CLI + library (WebAssembly core).
License
MPL-2.0. The engine is a Rust port of the Firefox Translations inference engine.
Release files for fxtranslate 0.4.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| fxtranslate-0.4.2.tar.gz | 397.9 kB | Details |
Built distributions (wheels)
| File | Reset | |||
|---|---|---|---|---|
| fxtranslate-0.4.2-cp38-abi3-win_amd64.whl | CPython 3.8 | abi3 | Windows x86-64 | Details |
| fxtranslate-0.4.2-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl | CPython 3.8 | abi3 | Linux glibc 2.17+ x86-64 | Details |
| fxtranslate-0.4.2-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl | CPython 3.8 | abi3 | Linux glibc 2.17+ ARM64 | Details |
| fxtranslate-0.4.2-cp38-abi3-macosx_11_0_arm64.whl | CPython 3.8 | abi3 | macOS 11.0+ ARM64 | Details |
Total release size: 6.7 MB
Release files / fxtranslate-0.4.2.tar.gz
| Download URL | fxtranslate-0.4.2.tar.gz |
|---|---|
| Size | 397.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
2c276d4ff31a2bbb673be37f2d07ce4b477adc13b760d6b91ef0e9984c22aff2
|
|
BLAKE2b-256 checksum How to use checksums |
76047886f4013ed3ca2739d88c84d2f8ebf32f0d61fe3f683980d3c224b85c97
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.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 Jul 20, 2026.
Transparency logRelease files / fxtranslate-0.4.2-cp38-abi3-win_amd64.whl
| Download URL | fxtranslate-0.4.2-cp38-abi3-win_amd64.whl |
|---|---|
| Size | 1.4 MB |
| Tags | CPython 3.8 Windows x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
c882849e744ec869639f36ddec24064e07991b240846609f43e7f5e480ee8507
|
|
BLAKE2b-256 checksum How to use checksums |
7fc2908d75b0a1bcd6f8ac2b510297b9a8708ee33db894135e13072d9400dab0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.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 Jul 20, 2026.
Transparency logRelease files / fxtranslate-0.4.2-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
| Download URL | fxtranslate-0.4.2-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl |
|---|---|
| Size | 1.7 MB |
| Tags | CPython 3.8 Linux glibc 2.17+ x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
b7db1aeb474a7c568ca6531a130ca4ddd528f9421c2da88eca2d19a33bb51c16
|
|
BLAKE2b-256 checksum How to use checksums |
c20791c7d0324f8f427bb0d694422bde99d93270df1994954e9f8733e877b1ef
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.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 Jul 20, 2026.
Transparency logRelease files / fxtranslate-0.4.2-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
| Download URL | fxtranslate-0.4.2-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl |
|---|---|
| Size | 1.7 MB |
| Tags | CPython 3.8 Linux glibc 2.17+ ARM64 abi3 |
|
SHA-256 checksum How to use checksums |
511aafe82ddad8814a11819a018062f35cd3a9dc166d2aa436a6c8c915f64a0b
|
|
BLAKE2b-256 checksum How to use checksums |
05c27e2b0668cc107f6d3b2437732de2105c47b45f6eea0fcbd2e81443b13624
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.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 Jul 20, 2026.
Transparency logRelease files / fxtranslate-0.4.2-cp38-abi3-macosx_11_0_arm64.whl
| Download URL | fxtranslate-0.4.2-cp38-abi3-macosx_11_0_arm64.whl |
|---|---|
| Size | 1.5 MB |
| Tags | CPython 3.8 abi3 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
251ac787436ab9ccf8063e0e8da504e7d68663d2dd03d3bdc1eaeb73f66f191a
|
|
BLAKE2b-256 checksum How to use checksums |
b1955b8faea7d15d6a2c9e671955ed726a354f7d2eacc68e30e4b4660d30704b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.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 Jul 20, 2026.
Transparency log