Metadata-Version: 2.4
Name: attestant
Version: 0.23.1
Summary: Upload model data to Attestant for compliance analysis
Author-email: "Attestant, Inc." <contact@getattestant.com>
License-Expression: Apache-2.0
Project-URL: Homepage, https://getattestant.com
Keywords: ml,compliance
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Financial and Insurance Industry
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Requires-Python: >=3.9
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: numpy>=1.24
Requires-Dist: pandas>=2.0
Provides-Extra: fast
Requires-Dist: orjson>=3.9; extra == "fast"
Requires-Dist: scipy>=1.10; extra == "fast"
Provides-Extra: fairness
Requires-Dist: shap>=0.45; extra == "fairness"
Provides-Extra: dev
Requires-Dist: pytest>=7.0; extra == "dev"
Requires-Dist: build; extra == "dev"
Requires-Dist: twine; extra == "dev"
Requires-Dist: cython>=3.0; extra == "dev"
Provides-Extra: all
Requires-Dist: orjson>=3.9; extra == "all"
Requires-Dist: scipy>=1.10; extra == "all"
Requires-Dist: shap>=0.45; extra == "all"
Dynamic: license-file

# Attestant

AI compliance for regulated lenders. Validate, approve, monitor, and defend AI-driven models and decisions.

## Install

```bash
pip install attestant
```

## Quick Start

```python
import attestant
import pandas as pd

# Configure (or set ATTESTANT_API_KEY environment variable)
attestant.configure(api_key="pvt_live_...")

# 1. Declare data sources — provenance tracks automatically
data = attestant.source(pd.read_csv("applicants.csv"), "applicants")
demographics = attestant.source(
    pd.read_csv("demographics.csv"), "demographics",
    protected=["race", "gender", "age"],
)

# 2. Normal pandas — taint propagation happens behind the scenes
merged = data.merge(demographics, on="id")
X = merged[["income", "credit_score", "dti"]]
y = merged["approved"]

# 3. Validate before deployment
result = attestant.upload(
    model=model,
    X_test=X, y_test=y,
    protected_columns=["race", "gender", "age"],
    model_name="credit_approval",
    model_version="v2.1",
)
print(result.dashboard_url)

# 4. Gate in production (one line)
attestant.gate("credit_approval", "v2.1")

# 5. Log predictions for monitoring
attestant.log_predictions(
    model_name="credit_approval",
    model_version="v2.1",
    predictions=model.predict_proba(X_new)[:, 1],
    features=X_new,
    protected_data=demographics_new,
    protected_columns=["race", "gender", "age"],
    applicant_ids=df["application_id"].tolist(),
)
```

## What It Does

- **41 automated compliance checks** across ECOA/Reg B, SR 11-7, and EU AI Act
- **Fairness analysis** with disparate impact detection and SHAP-based adverse action reason codes
- **Model gating** -- block unapproved models from production with one line
- **Inference monitoring** -- track predictions, detect drift, generate alerts
- **Decision defense** -- reconstruct any individual decision for examiner review
- **Data provenance** -- automatic lineage tracking through pandas operations

## Protected Columns

Mark columns containing protected attributes (race, gender, age, etc.) so Attestant can check for disparate impact and proxy discrimination:

```python
data = attestant.source(df, "applicants", protected=["race", "gender", "age"])
```

Attestant automatically tracks whether protected data influences predictions -- even through indirect feature engineering.

## Age Column Handling

Specify how age data is formatted:

```python
result = attestant.upload(
    ...,
    age_column="applicant_age",
    age_format="years",  # or: "months", "days", "dob", "birth_year"
)
```

## Vendor Models

Validate vendor/third-party models the same way -- just pass predictions instead of a model:

```python
# Get predictions from vendor API
vendor_predictions = vendor_api.score(X_test)

# Validate with full compliance suite
result = attestant.upload(
    predictions=vendor_predictions,
    X_test=X_test, y_test=y_test,
    protected_columns=["race", "gender", "age"],
    model_name="vendor_credit_score",
    model_version="v3.2",
)

# Gate and monitor in production
attestant.gate("vendor_credit_score", "v3.2")
attestant.log_predictions(
    model_name="vendor_credit_score",
    model_version="v3.2",
    predictions=vendor_api.score(X_new),
    features=X_new,
    protected_data=demographics_new,
    protected_columns=["race", "gender", "age"],
)
```

All 41 compliance checks, fairness analysis, model gating, and inference monitoring work identically for vendor models.

## CI/CD Integration

```bash
export ATTESTANT_API_KEY=pvt_live_...
attestant gate-check --model credit_approval --version v2.1
# Exit 0 = approved, 1 = blocked
```

## Documentation

Full documentation at [getattestant.com/docs](https://getattestant.com/docs)

## License

Apache 2.0
