Tins · Primitives
brotli
A Mojo binding to libbrotli, the last of the seven Parquet page codecs. Bound rather than written: RFC 7932 needs two prefix-code forms, context maps, block-type switching, a distance cache and a 122 KB static dictionary with 121 word transforms that are part of the format itself.
Install
plain pixi:
pixi init app -c https://conda.modular.com/max -c conda-forge && cd app
sed -i.bak 's/^\[workspace\]/[workspace]\npreview = ["pixi-build"]/' pixi.toml
pixi add "mojo-compiler==1.2.0"
# Without mojoshelf: the tin as a git dependency at its published commit.
# Transitive dependencies may be wrong: pixi takes the tin's own git deps as
# pinned in its pixi.toml, which may not match what other tins pin, and then
# fails with "duplicate records". mojoshelf picks revisions that agree.
pixi add brotli-mojo --git https://github.com/magmalake/brotli.mojo --rev dcbf840d22e3deaf24c587d12d28570a9a882b7f No mojoshelf needed. If pixi reports duplicate records, the mojoshelf tab picks revisions that agree.
Version
0.1.4 on mojoshelf
Source
What it does
Works today
- One-shot compress and decompress, quality 0–11
- A Brotli stream records no uncompressed size, so sized and unsized decoding are separate calls
- The shim is dlopen'd once, not per call
Correctness
Checked against CPython's brotli package, on streams it produced and this one had never seen