Run in Pyodide
Pyodide runs Python and native Python packages compiled to WebAssembly in a browser or Node.js. RefKit publishes PyEmscripten wheels, the wheel format used by Python extensions compiled through Emscripten for this runtime.
Use the refkit Python API in Pyodide. polars-refkit supports native CPython on Linux, macOS, and Windows and does not support Pyodide.
Release tests execute the Pyodide command-line runtime with this compatibility set:
| Component | Tested value |
|---|---|
| Python | 3.14 |
| Pyodide xbuild environment | 314.0.2 |
| PyEmscripten platform | pyemscripten_2026_0_wasm32 |
The xbuild environment pins the runtime application binary interface and build flags. It is a build-environment version rather than the Pyodide product version.
Load refkit
Initialize a compatible runtime using the Pyodide initialization guide. The examples assume its pyodide instance is ready. Install through micropip:
await pyodide.loadPackage("micropip")
await pyodide.runPythonAsync(`
import micropip
await micropip.install("refkit")
`)Run the regular Python API inside that instance:
import refkit as rk
library = rk.Library.parse_bibtex(
"""
@article{doe2024,
author = {Doe, Jane},
title = {Browser Citations},
year = {2024}
}
"""
)
document = rk.Document(library, rk.Style.load("apa"), locale="en-US")
rendered = document.render([rk.Citation("intro", "doe2024")])
print(rendered["intro"].text)Expected output:
(Doe, 2024)Parsing, raw BibTeX editing, formatting, citation rendering, bibliography rendering, and structured output use the same Python API as CPython.
Use the Pyodide CLI
The Pyodide CLI creates a virtual environment that runs the PyEmscripten runtime. Install the pinned build tool, create the environment, and activate it before installing RefKit:
python -m pip install 'pyodide-build==0.35.1'
pyodide xbuildenv install 314.0.2
pyodide venv .venv-pyodide
. .venv-pyodide/bin/activate
python -m pip install refkitAn installation error that reports no compatible wheel means the package index has no wheel for the active PyEmscripten platform. Use the tested compatibility set or choose a RefKit release built for that runtime.
The Pyodide package loading guide covers JavaScript initialization, package repositories, and micropip behavior.