skillfed

stanio

Utilities for preparing Stan inputs and processing Stan outputs

stanio v0.5.1 6.0M downloads/30d#1,991 on PyPI3
Permissive license BSD-3-Clause Active released

What it is and what it does

StanIO is a data-wrangling utility for the Stan probabilistic programming language, handling the format conversions needed between Python and Stan. It writes Python dictionaries to Stan-compatible JSON and reads Stan's CSV output format back into numpy arrays, automatically reshaping parameters according to their declared dimensions in Stan programs.

The package is primarily designed as a supporting library for cmdstanpy, the Python interface to Stan. It solves the practical problem of moving data in and out of Stan workflows without manual format handling. With numpy as its only runtime dependency and Python 3.8+ support, it integrates cleanly into existing scientific Python stacks.

Use it for:

  • Prepare input data dictionaries for Stan models by converting them to Stan-compatible JSON format
  • Parse Stan CSV output files into numpy arrays with automatic parameter reshaping based on Stan declarations
  • Extract multi-dimensional parameters from Stan output with correct shape inference
  • Integrate Stan probabilistic models into Python data analysis pipelines
  • Serialize Python data structures for use in Stan programs without manual JSON construction

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

StanIO converts Python dictionaries to Stan-compatible JSON and reads Stan CSV output files into numpy arrays, extracting parameters according to Stan program structure.

Yes, if you use Stan or cmdstanpy in Python. The package has low install friction, no known vulnerabilities, permissive licensing, and active maintenance. It solves a specific but essential problem for Stan workflows. Not relevant for projects that don't use Stan.

Install

stanio on PyPI

pip

pip install stanio

uv

uv add stanio

poetry

poetry add stanio

Installing stanio

Before you install

Low friction install with a single runtime dependency (numpy). Actively maintained with recent commits; Beta status indicates ongoing development but stable enough for use.

License in practice

BSD-3-Clause permissive license allows commercial and private use with minimal restrictions beyond attribution and liability disclaimer.

Quickstart

pip install stanio
import stanio
import numpy
# Convert Python dict to Stan JSON
data = {'x': [1, 2, 3]}
stanio.write_stan_json('input.json', data)
# Read Stan CSV output into numpy array
draws = stanio.read_stan_csv('output.csv')

Requires Python 3.8 or later; numpy must be installed as a runtime dependency.

Verify before relying

  • Whether ujson integration (mentioned as optional) is automatically available or requires separate installation
  • Performance characteristics when handling large Stan output files or high-dimensional parameter arrays

Package facts

License BSD-3-Clause (permissive)
Python support supports the current Python release (>=3.8)
Install friction low — pure-Python wheel
Runtime dependencies 1 — numpy
Maintenance actively maintained — 767 days since the last release
Last repo commit
First released
Downloads 5,998,007/month — #1,991 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: stanio-0.5.1-py3-none-any.whl

Development Status :: 4 - BetaOperating System :: OS IndependentProgramming Language :: Python :: 3

Tags

stan data format conversionstan csv output parsingstan json serializationprobabilistic programming data wranglingstan parameter extractionstan input output utilitiesnumpy array reshaping
stan-integrationdata-wranglingprobabilistic-programming

More Scientific/Engineering packages