Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

CmdStanPy

codecov

CmdStanPy is a lightweight pure-Python interface to CmdStan which provides access to the Stan compiler and all inference algorithms. It supports both development and production workflows. Because model development and testing may require many iterations, the defaults favor development mode and therefore output files are stored on a temporary filesystem. Non-default options allow all aspects of a run to be specified so that scripts can be used to distributed analysis jobs across nodes and machines.

CmdStanPy is distributed via PyPi: https://pypi.org/project/cmdstanpy/

or Conda Forge: https://anaconda.org/conda-forge/cmdstanpy

Goals

  • Clean interface to Stan services so that CmdStanPy can keep up with Stan releases.

  • Provide access to all CmdStan inference methods.

  • Easy to install,

    • minimal Python library dependencies: numpy, pandas
    • Python code doesn't interface directly with c++, only calls compiled executables
  • Modular - CmdStanPy produces a MCMC sample (or point estimate) from the posterior; other packages do analysis and visualization.

  • Low memory overhead - by default, minimal memory used above that required by CmdStanPy; objects run CmdStan programs and track CmdStan input and output files.

Source Repository

CmdStanPy and CmdStan are available from GitHub: https://github.com/stan-dev/cmdstanpy and https://github.com/stan-dev/cmdstan

Docs

The latest release documentation is hosted on https://mc-stan.org/cmdstanpy, older release versions are available from readthedocs: https://cmdstanpy.readthedocs.io

Licensing

The CmdStanPy, CmdStan, and the core Stan C++ code are licensed under new BSD.

Example

import os
from cmdstanpy import cmdstan_path, CmdStanModel

# specify locations of Stan program file and data
stan_file = os.path.join(cmdstan_path(), 'examples', 'bernoulli', 'bernoulli.stan')
data_file = os.path.join(cmdstan_path(), 'examples', 'bernoulli', 'bernoulli.data.json')

# instantiate a model; compiles the Stan program by default
model = CmdStanModel(stan_file=stan_file)

# obtain a posterior sample from the model conditioned on the data
fit = model.sample(chains=4, data=data_file)

# summarize the results (wraps CmdStan `bin/stansummary`):
fit.summary()

Metadata

Release files for cmdstanpy 2.0.0rc1

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

Source distribution (sdist)

Source distribution for cmdstanpy 2.0.0rc1
File Size Uploaded Provenance Actions
cmdstanpy-2.0.0rc1.tar.gz 142.5 kB With provenance Details for cmdstanpy-2.0.0rc1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for cmdstanpy 2.0.0rc1
File Interpreter ABI Platform Actions
cmdstanpy-2.0.0rc1-py3-none-any.whl Python 3 none any Details for cmdstanpy-2.0.0rc1-py3-none-any.whl

Total release size: 245.3 kB

Release files / cmdstanpy-2.0.0rc1.tar.gz

Download URL cmdstanpy-2.0.0rc1.tar.gz
Size 142.5 kB
Tags Source
SHA-256 checksum
How to use checksums
c8c87dd8ab6fafa22ce6e27b4063db338d2e5f6ac1ab7596e2997aa144520571
BLAKE2b-256 checksum
How to use checksums
3eec68980091fadf0139cffba786643574295bf2b5df893755e3ba0db45c26e4
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 17, 2026.

Transparency log

Release files / cmdstanpy-2.0.0rc1-py3-none-any.whl

Download URL cmdstanpy-2.0.0rc1-py3-none-any.whl
Size 102.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
bdb5857e4c0f24b7d7770a9b833c67b3f0849c0c363d631038a68cfe41044a19
BLAKE2b-256 checksum
How to use checksums
508adc37490f6856336a41adf3318d5b49bb7a74a8e0bec47e23f0b0f83cdcdd
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 17, 2026.

Transparency log

Security for cmdstanpy 2.0.0rc1

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.

Select from 2 files

Attestation for cmdstanpy-2.0.0rc1.tar.gz

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 17, 2026.

Transparency log

A 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.

Release history Release notifications | RSS feed

This release
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