Metadata-Version: 2.4
Name: gp3bayespy
Version: 0.5.0
Summary: Contract-first Bayesian workflows for hierarchical behavioural data in Python, ported from gp3bayes 0.5.0.
Author: Stefanos Balaskas
License-Expression: MIT
Project-URL: Homepage, https://stefanosbalaskas.github.io/gp3bayespy/
Project-URL: Repository, https://github.com/stefanosbalaskas/gp3bayespy
Project-URL: Issues, https://github.com/stefanosbalaskas/gp3bayespy/issues
Project-URL: R reference, https://cran.r-project.org/package=gp3bayes
Keywords: bayesian,hierarchical-models,repeated-measures,pupillometry,behavioural-data
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Science/Research
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Scientific/Engineering :: Information Analysis
Requires-Python: >=3.11
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: numpy>=1.26
Requires-Dist: pandas>=2.1
Requires-Dist: scipy>=1.11
Provides-Extra: bayes
Requires-Dist: arviz<1,>=0.18; python_version < "3.12" and extra == "bayes"
Requires-Dist: pymc<6,>=5.10; python_version < "3.12" and extra == "bayes"
Requires-Dist: arviz>=1.0; python_version >= "3.12" and extra == "bayes"
Requires-Dist: pymc>=6.3.1; python_version >= "3.12" and extra == "bayes"
Requires-Dist: numpy<2.5,>=2.0; python_version >= "3.12" and extra == "bayes"
Requires-Dist: numba<=0.66.0,>=0.64; python_version >= "3.12" and extra == "bayes"
Requires-Dist: cmdstanpy>=1.2; extra == "bayes"
Requires-Dist: xarray>=2024.1; extra == "bayes"
Provides-Extra: plots
Requires-Dist: matplotlib>=3.8; extra == "plots"
Provides-Extra: dev
Requires-Dist: pytest>=8; extra == "dev"
Requires-Dist: pytest-cov>=5; extra == "dev"
Requires-Dist: hypothesis>=6; extra == "dev"
Requires-Dist: ruff>=0.6; extra == "dev"
Requires-Dist: mypy>=1.10; extra == "dev"
Requires-Dist: pandas-stubs>=2.2; extra == "dev"
Requires-Dist: build>=1.2; extra == "dev"
Requires-Dist: twine>=5; extra == "dev"
Requires-Dist: arviz<1,>=0.18; python_version < "3.12" and extra == "dev"
Requires-Dist: arviz>=1.0; python_version >= "3.12" and extra == "dev"
Requires-Dist: xarray>=2024.1; extra == "dev"
Provides-Extra: docs
Requires-Dist: mkdocs>=1.6; extra == "docs"
Requires-Dist: mkdocs-material>=9.5; extra == "docs"
Requires-Dist: mkdocstrings[python]>=0.25; extra == "docs"
Provides-Extra: all
Requires-Dist: arviz<1,>=0.18; python_version < "3.12" and extra == "all"
Requires-Dist: pymc<6,>=5.10; python_version < "3.12" and extra == "all"
Requires-Dist: arviz>=1.0; python_version >= "3.12" and extra == "all"
Requires-Dist: pymc>=6.3.1; python_version >= "3.12" and extra == "all"
Requires-Dist: numpy<2.5,>=2.0; python_version >= "3.12" and extra == "all"
Requires-Dist: numba<=0.66.0,>=0.64; python_version >= "3.12" and extra == "all"
Requires-Dist: cmdstanpy>=1.2; extra == "all"
Requires-Dist: xarray>=2024.1; extra == "all"
Requires-Dist: matplotlib>=3.8; extra == "all"
Requires-Dist: pytest>=8; extra == "all"
Requires-Dist: pytest-cov>=5; extra == "all"
Requires-Dist: hypothesis>=6; extra == "all"
Requires-Dist: ruff>=0.6; extra == "all"
Requires-Dist: mypy>=1.10; extra == "all"
Requires-Dist: pandas-stubs>=2.2; extra == "all"
Requires-Dist: build>=1.2; extra == "all"
Requires-Dist: twine>=5; extra == "all"
Requires-Dist: mkdocs>=1.6; extra == "all"
Requires-Dist: mkdocs-material>=9.5; extra == "all"
Requires-Dist: mkdocstrings[python]>=0.25; extra == "all"
Dynamic: license-file

# gp3bayespy

**gp3bayespy** is the Python port of the R package **gp3bayes**, a contract-first Bayesian workflow package for repeated-measures, hierarchical behavioural data, posterior validation, predictive diagnostics, sensitivity analysis, and dynamic pupillometry.

> **Status:** **gp3bayespy 0.5.0** is the first public Python release with frozen parity against **gp3bayes 0.5.0**: 458/458 canonical exports implemented, 59/59 canonical articles ported, eight executable workflow examples, cross-platform CI, and a committed deep-freeze validation manifest.

## Frozen reference

The port is governed by the frozen CRAN source archive `gp3bayes_0.5.0.tar.gz`:

- 458 public exports
- 230 S3 registrations
- 60 R source files
- 465 Rd help files
- 59 vignette sources
- 54 `tests/testthat/test-*.R` test files plus the package-level test runner
- SHA-256: `537eb05f949de1bcc1d6f8234066f064597951ecfa9cbbdf938d0a895ce5dd8a`

`dev/parity/function_map.csv` is the machine-readable 458-function ledger. `dev/parity/articles.json` tracks the 59-article documentation map.

## Release coverage

The current candidate includes the complete public namespace across:

- model contracts, readiness, formula/prior/specification closure;
- hierarchical binary and lognormal-duration simulation, preparation, fitting, diagnostics, PPC, prediction, sensitivity, recovery, and reporting;
- posterior extraction, sampler diagnostics, hierarchical effects, prior/posterior comparison, PSIS-LOO, influence diagnostics, model comparison, predictive scoring/calibration, surfaces, uncertainty and atlases;
- simulation-based calibration, power-scaling and governed optional Bayesian workflows;
- reproducibility manifests, analysis bundles, evidence inventories, model cards, publication registries and Matplotlib graphics;
- ordinary, advanced, binocular, Gaussian-process, temporal/ARMA, robust/distributional, missing-data/measurement-error, response-shape and model-comparison pupillometry workflows;
- all 59 mapped Python-facing articles and eight executable workflow examples.

The final closure tests require all 458 exports to be root-importable, all ledger rows to be `implemented`, all 59 articles to be present, and no frozen public function to expose an unrestricted `**kwargs` catchall.

## Installation

Core numerical functionality:

```bash
python -m pip install gp3bayespy
```

Bayesian backends and plotting:

```bash
python -m pip install "gp3bayespy[bayes,plots]"
```

Everything used by the completion/release gate:

```bash
python -m pip install "gp3bayespy[all]"
```

## Minimal example

```python
import pandas as pd
from gp3bayespy import (
    audit_model_readiness,
    create_model_contract,
    create_model_specification,
    create_prior_specification,
)

data = pd.DataFrame({
    "participant_id": ["p1"] * 4 + ["p2"] * 4,
    "trial_id": [1, 2, 3, 4] * 2,
    "condition": ["control", "treatment"] * 4,
    "selected": [0, 1, 0, 1, 1, 0, 1, 0],
})

contract = create_model_contract(
    family="binary",
    outcome_col="selected",
    participant_col="participant_id",
    trial_col="trial_id",
    condition_col="condition",
)
audit = audit_model_readiness(data, contract)
priors = create_prior_specification(contract, baseline=0.5)
specification = create_model_specification(contract, audit, priors)
print(specification.formula_text)
```

See `examples/`, `docs/articles/`, `docs/migration.md`, and `docs/plot-gallery.md` for end-to-end workflows.

## Governance

Creating or fitting a model does **not** automatically establish convergence, model adequacy, causal identification, robustness, exclusion decisions, preferred-model status, or psychological/cognitive/emotional interpretation. The Python port preserves these boundaries from gp3bayes and makes automatic-selection/adequacy flags explicit where relevant.

## Python integrations

Core: NumPy, pandas, SciPy. Optional: PyMC, CmdStanPy, ArviZ/xarray and Matplotlib where the gp3bayes model contract can be preserved.
