Sample from custom discrete and continuous distributions (Python bindings for the simsam Rust crate)
Project description
simsam-rs (Python)
Python bindings for the simsam Rust crate, built with PyO3 and maturin.
Install from PyPI (import name is still simsam):
pip install simsam-rs
import simsam
dist = simsam.from_pdf(lambda x: 2.0 * x, simsam.Interval(0.0, 1.0))
print(dist.mean())
print(dist.sample_n(10_000))
Development
cd python
uv sync
uv run maturin develop --release
uv run pytest
Publishing to PyPI (maintainers)
PyPI package name: simsam-rs. User code: import simsam.
Default wheels do not include the optional symbolic feature.
One-off local release
cd python
uv run maturin build --release
uv run maturin publish --username __token__ --password "$PYPI_API_TOKEN"
Or upload artifacts from dist/ with twine.
CI release (recommended)
- On PyPI, create project simsam-rs and configure a trusted publisher for this GitHub repo (workflow:
publish-pypi.yml, environment:pypi). - Push a tag:
git tag py-v0.1.0 && git push origin py-v0.1.0 - GitHub Actions builds macOS / Linux / Windows wheels plus an sdist, then uploads to PyPI.
Bump version in python/pyproject.toml and python/Cargo.toml (keep in sync with the root Rust crate when releasing together).
Dry-run CI locally
From the repository root (same layout as GitHub Actions):
# macOS wheel (needs python.org CPython framework, e.g. 3.9 from python.org)
uv tool run cibuildwheel --platform macos --output-dir wheelhouse python
# Linux wheel — closest match to CI; requires Docker
uv tool run cibuildwheel --platform linux --output-dir wheelhouse python
# Windows wheel — only on Windows
uv tool run cibuildwheel --platform windows --output-dir wheelhouse python
Note: the GitHub Action uses package-dir: python; the CLI equivalent is the positional python argument at the end (not --package-dir).
On macOS outside CI, cibuildwheel expects official python.org framework installs. If you only have Homebrew/uv Python, either install the python.org pkg or use the simpler dev loop below.
Quick local check without cibuildwheel (builds a wheel for your current machine only):
cd python
uv sync
uv run maturin build --release
uv run pytest -k "not symbolic"
Smoke-test a built wheel:
uv venv /tmp/simsam-wheel-test
source /tmp/simsam-wheel-test/bin/activate
pip install wheelhouse/simsam_rs-*.whl # or python/target/wheels/*.whl
pytest python/tests -k "not symbolic"
Skip cibuildwheel tests while debugging build-only issues:
CIBW_TEST_SKIP='*' uv tool run cibuildwheel --platform macos --output-dir wheelhouse python
Optional symbolic builds (not published to PyPI by default)
uv run maturin develop --release --features symbolic,pyo3/extension-module
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file simsam_rs-0.1.0.tar.gz.
File metadata
- Download URL: simsam_rs-0.1.0.tar.gz
- Upload date:
- Size: 86.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6f268c488d168124d98154213633c2621141e37676449414566c33b86b3f6e0e
|
|
| MD5 |
e8840625e3a775a7c1b647a1795a4553
|
|
| BLAKE2b-256 |
00495b3e291444bb4939dbc1b080f8eb570fb99e9d9cf06bdc0f8c5a6ed057cb
|
Provenance
The following attestation bundles were made for simsam_rs-0.1.0.tar.gz:
Publisher:
publish-pypi.yml on shanziheng1721/simsam
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
simsam_rs-0.1.0.tar.gz -
Subject digest:
6f268c488d168124d98154213633c2621141e37676449414566c33b86b3f6e0e - Sigstore transparency entry: 1741243064
- Sigstore integration time:
-
Permalink:
shanziheng1721/simsam@6aded3d31e1d2f50a6ee67e2cdf36e71e6091e9b -
Branch / Tag:
refs/tags/py-v0.1.0 - Owner: https://github.com/shanziheng1721
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-pypi.yml@6aded3d31e1d2f50a6ee67e2cdf36e71e6091e9b -
Trigger Event:
push
-
Statement type:
File details
Details for the file simsam_rs-0.1.0-cp38-abi3-win_amd64.whl.
File metadata
- Download URL: simsam_rs-0.1.0-cp38-abi3-win_amd64.whl
- Upload date:
- Size: 328.2 kB
- Tags: CPython 3.8+, Windows x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
459749b830b3cb43d82eaf0487a1fdce4db45bbb90ea70f9bb3e449410f52732
|
|
| MD5 |
a541c3a41158d88998e996f3e7044808
|
|
| BLAKE2b-256 |
2317669d62e0b63dac2b153e55afe3f7af73be4fea42659baf82bd3c6d064b21
|
Provenance
The following attestation bundles were made for simsam_rs-0.1.0-cp38-abi3-win_amd64.whl:
Publisher:
publish-pypi.yml on shanziheng1721/simsam
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
simsam_rs-0.1.0-cp38-abi3-win_amd64.whl -
Subject digest:
459749b830b3cb43d82eaf0487a1fdce4db45bbb90ea70f9bb3e449410f52732 - Sigstore transparency entry: 1741243091
- Sigstore integration time:
-
Permalink:
shanziheng1721/simsam@6aded3d31e1d2f50a6ee67e2cdf36e71e6091e9b -
Branch / Tag:
refs/tags/py-v0.1.0 - Owner: https://github.com/shanziheng1721
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-pypi.yml@6aded3d31e1d2f50a6ee67e2cdf36e71e6091e9b -
Trigger Event:
push
-
Statement type:
File details
Details for the file simsam_rs-0.1.0-cp38-abi3-win32.whl.
File metadata
- Download URL: simsam_rs-0.1.0-cp38-abi3-win32.whl
- Upload date:
- Size: 301.2 kB
- Tags: CPython 3.8+, Windows x86
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0e5106176bf9d7aeb1fc919b0c6e0d96815cfab8f2613a2504b73b8edbd0f815
|
|
| MD5 |
a8b3564285caa5dc5435972638f457d9
|
|
| BLAKE2b-256 |
0355cd38a5607ebb1942fdefbcd906de6481f6692a8182b5dbcf1be5034593e5
|
Provenance
The following attestation bundles were made for simsam_rs-0.1.0-cp38-abi3-win32.whl:
Publisher:
publish-pypi.yml on shanziheng1721/simsam
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
simsam_rs-0.1.0-cp38-abi3-win32.whl -
Subject digest:
0e5106176bf9d7aeb1fc919b0c6e0d96815cfab8f2613a2504b73b8edbd0f815 - Sigstore transparency entry: 1741243067
- Sigstore integration time:
-
Permalink:
shanziheng1721/simsam@6aded3d31e1d2f50a6ee67e2cdf36e71e6091e9b -
Branch / Tag:
refs/tags/py-v0.1.0 - Owner: https://github.com/shanziheng1721
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-pypi.yml@6aded3d31e1d2f50a6ee67e2cdf36e71e6091e9b -
Trigger Event:
push
-
Statement type:
File details
Details for the file simsam_rs-0.1.0-cp38-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl.
File metadata
- Download URL: simsam_rs-0.1.0-cp38-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
- Upload date:
- Size: 461.4 kB
- Tags: CPython 3.8+, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f1820742d5239c5fc19ab5649c4faafbb077b3cce36927ac5fa2636fe5e75e2c
|
|
| MD5 |
e36276b672b7121d698e4be5de568ef0
|
|
| BLAKE2b-256 |
1c1b8defec912121cd9be320a0220e298f364a5bd03e93e846887ef1176462d5
|
Provenance
The following attestation bundles were made for simsam_rs-0.1.0-cp38-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl:
Publisher:
publish-pypi.yml on shanziheng1721/simsam
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
simsam_rs-0.1.0-cp38-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl -
Subject digest:
f1820742d5239c5fc19ab5649c4faafbb077b3cce36927ac5fa2636fe5e75e2c - Sigstore transparency entry: 1741243105
- Sigstore integration time:
-
Permalink:
shanziheng1721/simsam@6aded3d31e1d2f50a6ee67e2cdf36e71e6091e9b -
Branch / Tag:
refs/tags/py-v0.1.0 - Owner: https://github.com/shanziheng1721
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-pypi.yml@6aded3d31e1d2f50a6ee67e2cdf36e71e6091e9b -
Trigger Event:
push
-
Statement type:
File details
Details for the file simsam_rs-0.1.0-cp38-abi3-macosx_11_0_arm64.whl.
File metadata
- Download URL: simsam_rs-0.1.0-cp38-abi3-macosx_11_0_arm64.whl
- Upload date:
- Size: 402.7 kB
- Tags: CPython 3.8+, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
61d09391c3a3d414c91640fa5666a5d31f8538fb945382ddb93349ffb66a219c
|
|
| MD5 |
42feaef53885e2cd61c1a86cde6b03c1
|
|
| BLAKE2b-256 |
e22bd4be53f74c1e59ea8cd67e7ba013ada3ad59474594e7479810f920cab317
|
Provenance
The following attestation bundles were made for simsam_rs-0.1.0-cp38-abi3-macosx_11_0_arm64.whl:
Publisher:
publish-pypi.yml on shanziheng1721/simsam
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
simsam_rs-0.1.0-cp38-abi3-macosx_11_0_arm64.whl -
Subject digest:
61d09391c3a3d414c91640fa5666a5d31f8538fb945382ddb93349ffb66a219c - Sigstore transparency entry: 1741243079
- Sigstore integration time:
-
Permalink:
shanziheng1721/simsam@6aded3d31e1d2f50a6ee67e2cdf36e71e6091e9b -
Branch / Tag:
refs/tags/py-v0.1.0 - Owner: https://github.com/shanziheng1721
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-pypi.yml@6aded3d31e1d2f50a6ee67e2cdf36e71e6091e9b -
Trigger Event:
push
-
Statement type: