Skip to main content

Strata

:mountain: The easy way to ship Stan models

Build Status

Installation

Strata is a command line tool. To install, run:

pip install strata-cli

This will give you the strata command. You can also install it with Homebrew.

Getting Started

Package a model

strata bernoulli.stan

This creates a dist directory with:

  • bin - Stan binaries
  • lib - TBB libraries
  • licenses - license files

You can also package multiple models

strata bernoulli.stan regression.stan

Running Models

Run a model directly

dist/bin/bernoulli sample data ...

Or load it into CmdStanPy

from cmdstanpy import CmdStanModel

model = CmdStanModel(exe_file='dist/bin/bernoulli')

CmdStanR (not on CRAN yet)

library(cmdstanr)

model <- cmdstan_model(exe_file="dist/bin/bernoulli")

Or CmdStan.rb

require "cmdstan"

model = CmdStan::Model.new(exe_file: "dist/bin/bernoulli")

Portability

  • Linux: package on the oldest platform you support
  • Mac: models run on macOS 10.14+ by default (set MACOSX_DEPLOYMENT_TARGET to override)
  • Windows: not supported yet

Cross-Compiling

Cross-compile for a different architecture (on the same OS)

strata --cross-compile ...

On Ubuntu, this requires:

sudo apt update
sudo apt install gcc-aarch64-linux-gnu g++-aarch64-linux-gnu

Reference

Specify the output directory

strata -o dist ...

Show build output

strata --debug ...

Create a static build (experimental, only working on Mac)

strata --static ...

Homebrew

On Mac, you can use:

brew install ankane/brew/strata

History

View the changelog

Contributing

Everyone is encouraged to help improve this project. Here are a few ways you can help:

To get started with development:

git clone https://github.com/ankane/strata.git
cd strata
pip install -e .

# for tests
pip install -r requirements.txt
pytest

Release files for strata-cli 0.3.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for strata-cli 0.3.0
File Size Uploaded
strata_cli-0.3.0.tar.gz 10.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for strata-cli 0.3.0
File Interpreter ABI Platform
strata_cli-0.3.0-py3-none-any.whl Python 3 none any Details

Total release size: 20.0 kB

Release files / strata_cli-0.3.0.tar.gz

Download URL strata_cli-0.3.0.tar.gz
Size 10.0 kB
Tags Source
SHA-256 checksum
How to use checksums
63837002867094a0cf7963d164695ae28df8abf0a40ad5f0896eb20a09d67898
BLAKE2b-256 checksum
How to use checksums
43f57ed924fe822737ac7c11ee2b7b65d801e7cdbe8964b662c58bed756c058c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.0.0 CPython/3.12.7

Release files / strata_cli-0.3.0-py3-none-any.whl

Download URL strata_cli-0.3.0-py3-none-any.whl
Size 10.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e2e7f3100cd011713964707844cb9ec1cfe5e3e4f1007ec24bbde80d11c6703b
BLAKE2b-256 checksum
How to use checksums
e14107ca52ceb781682f159d7d38f7822115a6314e0e77f9ff4d51d52854de27
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.0.0 CPython/3.12.7

Release history Release notifications | RSS feed

This release

0.3.0 This release

2 release files

0.2.0

2 release files

0.1.1

1 release file

0.1.0

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page