Docs
What it is
flare_mlake is a packaged build of flare by Ehsan M. Kermani: TCP, UDP, TLS, DNS, HTTP/1.1, HTTP/2, HTTP/3, QUIC, WebSocket and gRPC for Mojo, with its own reactor. magmalake republishes it only because flare isn’t on a conda channel pixi can resolve. k8s uses it for HTTPS with client certificates. Essentially all of the code is upstream’s, and the module is still imported as flare. Star it and file issues upstream.
Install
mojoshelf:
pixi shelf add flare_mlake # brings json_mlake, threads-mojo; OpenSSL, zlib, brotli from conda-forgepixi shelf comes with mojoshelf: install it first.
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 flare_mlake --git https://github.com/magmalake/flare_mlake --rev b1371866a7844afefe86b25eb8af58aaa9d3fa6cNo mojoshelf needed. If pixi reports duplicate records, the mojoshelf tab picks revisions that agree.
Then from flare.http import HttpClient and the rest, as upstream documents. The package ships its TLS, zlib and brotli shims prebuilt in the environment’s lib/.
What magmalake changed
Seven small source deltas, each worth sending upstream:
- OS threads come from threads (
flare/runtime/_thread.mojo), so a program can use flare and threads.mojo together: Mojo declares an extern per signature, and the two spelledpthread_createandpthread_joindifferently, which kept such programs from linking. - macOS defaults to one shared listener (
flare/runtime/scheduler.mojo), since BSD’sSO_REUSEPORTdoesn’t spread connections across listeners.FLARE_REUSEPORT_WORKERS=1restores one listener per worker. eventfd_writeis Linux-only (flare/runtime/_balance.mojo). Unguarded, anything reaching the unified reactor failed to link on macOS.libflare_tlspins itself in memory withRTLD_NODELETE(flare/tls/ffi/openssl_wrapper.cpp), because macOS’s linker has no-z nodelete.- The FFI shims are found next to the executable too (
flare/utils/_dlopen.mojo):$CONDA_PREFIX/lib, then the executable’s directory and its../lib, then the rpath. A missing shim raises an Error that says to setCONDA_PREFIX. fcntlis declared variadic (flare/net/_libc.mojo), as dista and orca declare it, so flare’s HTTP client links beside Dista on Linux.tests/tools/proto_gen.pydecodesrepeated stringandbytesone element per field, as they are never packed.
And packaging: the package is named flare_mlake while the module stays flare, it depends on json_mlake and its fuzz environment on mozz_mlake instead of upstream’s repositories, and CHANGELOG.md lists every change as it’s made. CI runs upstream’s gRPC, HTTP, TLS, net and crypto tests on the packaged build.
The repository is archived the day flare is on a channel pixi can resolve.
Upstream
- Project, issues and pull requests: github.com/ehsanmok/flare
- Documentation: ehsanmok.github.io/flare
- Upstream’s README, verbatim: README.upstream.md
The full reference is the README on GitHub.