mftik
Phase 1 is an STS Python SDK, written in Rust and exposed with PyO3, that is compatible with mftiko. Acceptance is mftiko-conformance passing every check in mftiko PROTOCOL §9.
The Python package name is mftik (import mftik). Version 0.14.0 was the first Rust rewrite and is incompatible with the earlier API. Version 1.0.0 is the first stable release, after a Python strategy ran on the mftiko testnet (E05-06). Older releases already on PyPI, including 0.12.x, stay there. The tree before this rewrite is the legacy-final tag.
Decisions for this repo are in docs/DECISIONS.md.
Crates
| Crate | Path | Role |
|---|---|---|
mftik-proto |
crates/mftik-proto |
Prost types for the pinned mftiko protos. Generated code stays out of git. |
mftik-core |
crates/mftik-core |
Pure Rust algorithms. No IO. |
mftik-py |
crates/mftik-py |
PyO3 bindings. The Python package is mftik (python/mftik); the native module is mftik._mftik. |
mftik-rt |
crates/mftik-rt |
Session worker runtime: fd 3, C4, the dispatcher, NATS, and timers. Strategy and Context. |
mftik-testkit |
crates/mftik-testkit |
Dev-only nats-server and fake-shim harness (publish = false). |
mftik-conform |
examples/conform |
The Rust standard conformance strategy (PROTOCOL §9.8), the conform binary. |
mftik-md-watch |
examples/rust/md_watch |
The Rust md_watch example: one instrument's trades and book, the md_watch binary. |
The Python API is snake_case and matches the Go SDK's hook and context names. The user guide and API reference are in docs/python. The Rust user guide is in docs/rust. Its snippets are compiled by cargo test --doc -p mftik-rt (E08-D008).
Proto
contract/proto/mftiko is a copy of BullionBear/mftiko contract/proto/mftiko at 88a03d9de1c0750a2e9be66a5fc83a2d6992ab84. scripts/sync-proto reproduces that copy and writes the source commit to contract/proto/SOURCE.
scripts/sync-proto # copy again and rewrite SOURCE
scripts/sync-proto --check # fail if the tree or SOURCE drifts from the pin
scripts/sync-proto-negative # require --check to fail on a drifted temporary copy
Build
rust-toolchain.toml pins the current stable toolchain (1.99.1). Crates use edition 2024.
cargo build --workspace
mftik-proto's build.rs runs prost-build with protoc from protoc-bin-vendored. Generated Rust is written under target/ and is not committed.
Python uses uv and maturin. Lint with ruff.
uv sync
uv run maturin develop
uv run ruff check python tests/python examples/python examples/rust crates/mftik-py/tests/pystrategies
uv run ruff format --check python tests/python examples/python examples/rust crates/mftik-py/tests/pystrategies
mftik requires Python 3.11 or newer (abi3). A session worker starts with python -m mftik.run module:Class. Class is constructed with no arguments and must be a mftik.Strategy.
CI
GitHub Actions runs on ubuntu-latest, except the Linux release wheel and conformance-rootfs-rust, which run on ubuntu-22.04 (below). cargo clippy --workspace --all-targets -- -D warnings fails the build on warnings. The workflow also checks formatting, tests, and that the proto tree still matches the pinned commit. scripts/sync-proto-negative appends a line to a temporary copy of that tree and requires scripts/sync-proto --check to fail.
The Python job uses Python 3.11 (E04-D014). It syncs the locked uv tools, checks that docs/python names every public mftik symbol and that any code excerpt matches examples/python, runs ruff check and ruff format --check, builds an mftik wheel with maturin, installs that wheel into a fresh environment, and runs tests/python/smoke_import.py, the Python unit tests, mypy.stubtest against mftik._mftik, and the Python session end-to-end tests.
The wheels job builds the two release wheels on every pull request and installs each into a clean virtual environment for the same smoke test (E04-D063). The supported platforms are Ubuntu 22.04 or later on x86_64, and macOS on arm64 (E06-D018). The Linux wheel is manylinux_2_35_x86_64: maturin build --compatibility manylinux_2_35 runs directly on the pinned ubuntu-22.04 runner, whose glibc is 2.35, with no manylinux container (E06-D019). The macOS wheel is built on macos-latest. Both are abi3 wheels for Python 3.11 (cp311-abi3). There is no source distribution. scripts/release-check checks that the workspace version, pyproject.toml, the smoke test's expected version, and mftik.__version__ match.
A v* tag runs .github/workflows/release.yml. That workflow builds those wheels, smokes them, and uploads them to PyPI with trusted publishing from the GitHub environment pypi. The tag is v plus the package version, and the tagged commit is on main. The project owner registers that workflow filename and environment on the existing PyPI project mftik before the tag is pushed. The first tag was v0.14.0. Each tag is pushed after its release PR is merged and Yi Te confirms.
The mftiko-conformance job runs the suite on every pull request. scripts/install-mftiko-conformance is the go install of mftiko-conformance from the pinned mftiko commit. The job runs it against the Rust standard strategy examples/conform, keeps report.json as an artifact, and fails on any failed check. To run it locally (Go 1.26 or newer):
GOBIN="$PWD/bin" scripts/install-mftiko-conformance
cargo build --release -p mftik-conform
bin/mftiko-conformance -json report.json -- target/release/conform
conformance-rootfs-rust packs that binary and examples/rust/md_watch with the pinned mftiko-pack -bin (E08-D001, E08-D009). Every binary that calls mftik_rt::run carries what the packer reads: the mftiko.contracts= marker and the mftiko.sdk=rust <version> record, which makes the manifest's runtime and sdk.lang rust (E08-D005, #489). It carries no Go build info (#490), so packing needs mftiko-pack from mftiko v0.5.1 or later; the job checks that neither binary has a .go.buildinfo section. tests/python/conformance_rootfs_rust.py pushes each image to a registry on 127.0.0.1, pulls and unpacks it with the pinned mftiko artifact package, runs the suite in conform's rootfs, and runs examples/rust/md_watch/test_e2e.py from md_watch's rootfs under the Python md_watch harness. The job builds and runs the binaries on ubuntu-22.04, whose glibc is 2.35 (E08-D002). Locally it needs Docker, or MFTIK_REGISTRY_BIN pointing at a registry binary, and nats-server (MFTIK_NATS_SERVER, or on PATH):
cargo build --release -p mftik-conform -p mftik-md-watch
MFTIK_CONFORMANCE="$PWD/bin/mftiko-conformance" python3 tests/python/conformance_rootfs_rust.py
The Rust writer of the strategy event log (PROTOCOL §12) is checked against mftiko's own reader: scripts/install-mftiko-eventlog is the go install of mftiko-eventlog from the same pinned commit, and the rust job points MFTIK_EVENTLOG at it for crates/mftik-rt/tests/eventlog_dump.rs. Those tests fail when the tool is missing. Locally:
GOBIN="$PWD/bin" scripts/install-mftiko-eventlog
MFTIK_EVENTLOG="$PWD/bin/mftiko-eventlog" cargo test -p mftik-rt --test eventlog_dump
The Python standard strategy is examples/python/conform, started with python -m mftik.run conform:Conform. python-conform-wheel builds one abi3 wheel. mftiko-conformance-python installs that wheel into a clean venv and runs the same suite on Python 3.11, 3.12, and 3.13 in parallel. Each report is an artifact. The pinned harness replaces the worker environment and does not forward PYTHONPATH, so the venv's mftik-conform.pth adds examples/python to sys.path. Locally, with the wheel installed in .venv:
site="$(.venv/bin/python -c 'import sysconfig; print(sysconfig.get_path("purelib"))')"
printf '%s\n' "$PWD/examples/python" > "$site/mftik-conform.pth"
bin/mftiko-conformance -json report.json -- .venv/bin/python -m mftik.run conform:Conform
Example strategies are md_watch (market data), maker (orders), stateful (a fill count kept in the volume), pretrained (a read-only input), and sampler (now and rand). Each directory has an English README and test_e2e.py. sampler's test also records a session with the event log on and replays it with mftik.replay (docs/python/replay.md). The examples CI job installs the mftik-abi3-wheel artifact, runs those tests, and packs each strategy once without pushing. The Rust md_watch is examples/rust/md_watch; conformance-rootfs-rust packs it and runs its e2e test from the unpacked rootfs.
Metadata
Release files for mftik 1.3.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distributions (wheels)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| mftik-1.3.0-cp311-abi3-manylinux_2_35_x86_64.whl | CPython 3.11 | abi3 | Linux glibc 2.35+ x86-64 | Details for mftik-1.3.0-cp311-abi3-manylinux_2_35_x86_64.whl |
| mftik-1.3.0-cp311-abi3-macosx_11_0_arm64.whl | CPython 3.11 | abi3 | macOS 11.0+ ARM64 | Details for mftik-1.3.0-cp311-abi3-macosx_11_0_arm64.whl |
Total release size: 5.8 MB
Release files / mftik-1.3.0-cp311-abi3-manylinux_2_35_x86_64.whl
| Download URL | mftik-1.3.0-cp311-abi3-manylinux_2_35_x86_64.whl |
|---|---|
| Size | 3.0 MB |
| Tags | CPython 3.11 Linux glibc 2.35+ x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
ba11daff607fd4b00148ec9d86eae2b072d14615f9e01c4d436892c878f837bf
|
|
BLAKE2b-256 checksum How to use checksums |
e0d4b0e795a2bc17c33e09fff93747c12a0d743873779c6ad897e99f18c89c5d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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 Nov 1, 2026.
Transparency logRelease files / mftik-1.3.0-cp311-abi3-macosx_11_0_arm64.whl
| Download URL | mftik-1.3.0-cp311-abi3-macosx_11_0_arm64.whl |
|---|---|
| Size | 2.7 MB |
| Tags | CPython 3.11 abi3 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
9b652b6ba87d9b0a088411c9b03ddd8d97d701e835fc20dacf848132e8e19d9e
|
|
BLAKE2b-256 checksum How to use checksums |
44c9546214a0d0a647ea119304be133fe1d665e94267d8fe3da7592d91ac5803
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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 Nov 1, 2026.
Transparency logSecurity for mftik 1.3.0
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.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for mftik-1.3.0-cp311-abi3-manylinux_2_35_x86_64.whl
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 Nov 1, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.