mv-laplace
mv-laplace is a sampler-focused implementation of the Multivariate Laplace distribution.
Overview
The package exposes a MvLaplaceSampler class for generating multivariate Laplace-like samples from a location vector and covariance matrix. It is intentionally focused on sampling and practical workflow support rather than a full SciPy-style distribution API.
Installation
pip install mv-laplace
Python Version
Python >= 3.11
Support
- Supported Python:
3.11+ - Primary package index: PyPI (
mv-laplace)
Quick Start
import numpy as np
from mv_laplace import MvLaplaceSampler
loc = np.array([0.0, 1.0, -2.0])
cov = np.array([
[1.0, 0.2, 0.1],
[0.2, 2.0, -0.3],
[0.1, -0.3, 1.5],
])
sampler = MvLaplaceSampler(loc=loc, cov=cov)
samples = sampler.sample(sample_size=1000)
Implemented API
Constructor
MvLaplaceSampler(loc, cov)
Methods
sample(sample_size=None)
Input Expectations
locshould be a length-Mvector.covshould be anM x Mcovariance matrix.- Input validation and most constructor error behavior are delegated to underlying SciPy distributions.
sample(sample_size=None)returns:- shape
(M,)whensample_sizeisNone - shape
(N, M)whensample_sizeis an integerN
- shape
Testing
The project includes a pytest suite under tests/, including coverage for:
- output shape behavior for single and batched sampling
- finite-value checks for generated samples
- empirical mean/variance checks for diagonal-covariance cases
Run tests with:
uv run pytest -q
Development Setup
Install development dependencies:
uv sync --all-extras --dev
Run lint and tests:
uv run ruff check .
uv run pytest -q
Roadmap
- Add richer input validation and explicit error messages.
- Add summary-statistic utilities and SciPy-style API extensions.
- Explore a Multivariate Asymmetric Laplace distribution class.
Version History
See VersionHistory.md.
Contributing
- Community and core-developer contribution workflow is documented in
CONTRIBUTING.md. - Repository guardrails and policy details are defined in
AGENTS.md.
Release Process (High-Level)
- Pull requests from
release/*andhotfix/*intomainrun publish dry-run checks. - Merged
release/*/hotfix/*PRs tomaintrigger publish, tagging, release metadata, and post-release verification workflows. - Recovery actions (including yank/unyank verification with runbook guidance) are run manually when needed.
Reporting Issues
- Bug reports and feature requests: GitHub Issues
- Security-sensitive concerns can be reported privately using GitHub repository security reporting.
Repository Policy
High-level development policy summary (full details in AGENTS.md):
- GitFlow is used:
feature/* -> dev,release/*|hotfix/* -> main, with PR-based merges. - Release and hotfix branches must use SemVer suffixes:
release/<MAJOR.MINOR.PATCH>,hotfix/<MAJOR.MINOR.PATCH>. - Community contributions are welcome through
feature/* -> devpull requests;release/*andhotfix/*flows are core-developer managed. - CI runs on PRs to
devandmain; release dry-runs run onrelease/*/hotfix/*PRs tomain; release publish runs after merge tomain. - Semantic Versioning is required (
MAJOR.MINOR.PATCH) and versioning must be intentional. - Some defaults are guidance (for example draft PR by default) and developer discretion is explicitly supported.
uv.lockis developer-local and is not tracked in this repository.- Functional library code is authored manually.
- AI tooling may assist with test authoring, documentation drafting/editing, GitHub Actions/workflow authoring and maintenance, and development guidance for planning/decision support.
For release notes and historical change context, see VersionHistory.md.
License
This project is licensed under the GNU GPL. See LICENSE.
Metadata
Release files for mv-laplace 0.2.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| mv_laplace-0.2.1.tar.gz | 3.8 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| mv_laplace-0.2.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 8.3 kB
Release files / mv_laplace-0.2.1.tar.gz
| Download URL | mv_laplace-0.2.1.tar.gz |
|---|---|
| Size | 3.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ee83b33692c5b429a244099be13a5c6d96a7651e7360ecfe409e25256588ecfd
|
|
BLAKE2b-256 checksum How to use checksums |
57325a52a79832ac3d829e8ae39a708af13325db460a19dc9b939c8db822bf58
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.10.8 {"installer":{"name":"uv","version":"0.10.8","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / mv_laplace-0.2.1-py3-none-any.whl
| Download URL | mv_laplace-0.2.1-py3-none-any.whl |
|---|---|
| Size | 4.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
66013a9e5be3796ae5598442c27fc196ad4239d9be47d543843e2baf9fbcd3f4
|
|
BLAKE2b-256 checksum How to use checksums |
4d8b6e9c9a7052b579e743731d6b2d365590013cff708a7a4b77cf5abd574cff
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.10.8 {"installer":{"name":"uv","version":"0.10.8","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|