Metadata-Version: 2.4
Name: coreason_publisher
Version: 0.4.0
Summary: agent from Development (mutable drafts) to Production (immutable artifacts)
License: # The Prosperity Public License 3.0.0
         
         Contributor: CoReason, Inc.
         
         Source Code: https://github.com/CoReason-AI/coreason_publisher
         
         ## Purpose
         
         This license allows you to use and share this software for noncommercial purposes for free and to try this software for commercial purposes for thirty days.
         
         ## Agreement
         
         In order to receive this license, you have to agree to its rules.  Those rules are both obligations under that agreement and conditions to your license.  Don't do anything with this software that triggers a rule you can't or won't follow.
         
         ## Notices
         
         Make sure everyone who gets a copy of any part of this software from you, with or without changes, also gets the text of this license and the contributor and source code lines above.
         
         ## Commercial Trial
         
         Limit your use of this software for commercial purposes to a thirty-day trial period.  If you use this software for work, your company gets one trial period for all personnel, not one trial per person.
         
         ## Contributions Back
         
         Developing feedback, changes, or additions that you contribute back to the contributor on the terms of a standardized public software license such as [the Blue Oak Model License 1.0.0](https://blueoakcouncil.org/license/1.0.0), [the Apache License 2.0](https://www.apache.org/licenses/LICENSE-2.0.html), [the MIT license](https://spdx.org/licenses/MIT.html), or [the two-clause BSD license](https://spdx.org/licenses/BSD-2-Clause.html) doesn't count as use for a commercial purpose.
         
         ## Personal Uses
         
         Personal use for research, experiment, and testing for the benefit of public knowledge, personal study, private entertainment, hobby projects, amateur pursuits, or religious observance, without any anticipated commercial application, doesn't count as use for a commercial purpose.
         
         ## Noncommercial Organizations
         
         Use by any charitable organization, educational institution, public research organization, public safety or health organization, environmental protection organization, or government institution doesn't count as use for a commercial purpose regardless of the source of funding or obligations resulting from the funding.
         
         ## Defense
         
         Don't make any legal claim against anyone accusing this software, with or without changes, alone or with other technology, of infringing any patent.
         
         ## Copyright
         
         The contributor licenses you to do everything with this software that would otherwise infringe their copyright in it.
         
         ## Patent
         
         The contributor licenses you to do everything with this software that would otherwise infringe any patents they can license or become able to license.
         
         ## Reliability
         
         The contributor can't revoke this license.
         
         ## Excuse
         
         You're excused for unknowingly breaking [Notices](#notices) if you take all practical steps to comply within thirty days of learning you broke the rule.
         
         ## No Liability
         
         ***As far as the law allows, this software comes as is, without any warranty or condition, and the contributor won't be liable to anyone for any damages related to this software or this license, under any kind of legal claim.***
License-File: LICENSE
License-File: NOTICE
Author: Gowtham A Rao
Author-email: gowtham.rao@coreason.ai
Requires-Python: >=3.11
Classifier: License :: Other/Proprietary License
Classifier: Programming Language :: Python :: 3.12
Classifier: Operating System :: OS Independent
Requires-Dist: anyio (>=4.12.1,<5.0.0)
Requires-Dist: coreason-identity
Requires-Dist: fastapi (>=0.111.0,<0.112.0)
Requires-Dist: gitpython (>=3.1.46,<4.0.0)
Requires-Dist: httpx (>=0.28.1,<0.29.0)
Requires-Dist: jinja2 (>=3.1.6,<4.0.0)
Requires-Dist: loguru (>=0.7.2,<0.8.0)
Requires-Dist: pydantic-settings (>=2.12.0,<3.0.0)
Requires-Dist: python-gitlab (>=7.1.0,<8.0.0)
Requires-Dist: python-multipart (>=0.0.9,<0.0.10)
Requires-Dist: tenacity (>=9.1.2,<10.0.0)
Requires-Dist: typer (>=0.21.1,<0.22.0)
Requires-Dist: uvicorn (>=0.30.0,<0.31.0)
Project-URL: Documentation, https://github.com/CoReason-AI/coreason_publisher
Project-URL: Homepage, https://github.com/CoReason-AI/coreason_publisher
Project-URL: Repository, https://github.com/CoReason-AI/coreason_publisher
Description-Content-Type: text/markdown

# coreason-publisher

> **The Regulatory Gatekeeper & Artifact Packager**

[![CI](https://github.com/CoReason-AI/coreason_publisher/actions/workflows/ci.yml/badge.svg)](https://github.com/CoReason-AI/coreason_publisher/actions/workflows/ci.yml)
![Python](https://img.shields.io/badge/python-3.12%20%7C%203.13%20%7C%203.14-blue)
![License](https://img.shields.io/badge/License-Prosperity%203.0-blue.svg)
![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)

coreason-publisher is the "Final Gatekeeper" of the CoReason platform. It orchestrates the transition of an agent from a mutable "Development Experiment" to an immutable "Clinical-Grade Product."

It solves the "Big AI" problem in GxP environments. Agents are not just code; they are a complex dependency of Logic (Prompts), Evidence (Test Results), and Binary Assets (Fine-Tuned Weights). This package bundles these diverse assets into a verifiable package, manages the **Git LFS (Large File Storage)** pointers for heavy models, and enforces a strict **Two-Stage Governance Workflow** (Submission $\to$ SRB Approval) before any code reaches production.

It can be run as a **CLI tool** for local development or as a **Centralized Service** (REST API) for platform integration.

## Functional Philosophy

The agent must implement the **Package-Propose-Approve-Merge Loop**:

1. **The "Thick" Artifact:** A release is monolithic. It must contain the *exact* Prompts, Code, Test Data, and Model Weights used during validation. If one piece is missing, the release is void.
2. **Governance as Code:** The Scientific Review Board (SRB) approval is a digital state transition, not an email. coreason-publisher blocks the Git merge until a cryptographically signed approval from an authorized SRB member is registered.
3. **Semantic Versioning (SemVer):** The tool manages versioning (v1.0 $\to$ v1.1) automatically based on the nature of the change (Patch/Minor/Major), preventing human error.
4. **Reproducibility:** The "Council of Models" (the specific LLM versions used for testing) must be locked in the release manifest to ensure the test results are reproducible 5 years from now.

## Key Features

-   **Governance Service (API):** Exposes REST endpoints (`/propose`, `/release`) for Foundry/Assay integration.
-   **Artifact Bundling:** Aggregates code, data, and models into a single deployment folder.
-   **Git LFS Management:** Automatically handles large files and model weights.
-   **Governance as Code:** Blocks merges until a cryptographically signed SRB approval is received.
-   **Automated Versioning:** Manages SemVer based on change types (Patch/Minor/Major).
-   **Reproducibility:** Locks the specific "Council of Models" used for validation.

## Documentation

For detailed documentation, please refer to the `docs/` directory or the deployed MkDocs site:

-   [Architecture](docs/architecture.md)
-   [Usage Guide](docs/usage.md)
-   [Product Requirements](docs/requirements.md)

## Quick Start

### Prerequisites

-   Python 3.12+
-   Poetry
-   Git LFS

### Installation

```bash
git clone https://github.com/CoReason-AI/coreason_publisher.git
cd coreason_publisher
poetry install
```

### Server Mode

Run the service via Docker:

```bash
docker run -p 8000:8000 \
  -e GITLAB_TOKEN="<token>" \
  coreason-publisher:latest
```

### CLI Usage

To propose a new release locally:

```bash
poetry run python -m coreason_publisher.main propose \
    --project-id <PROJECT_ID> \
    --draft-id <DRAFT_ID> \
    --bump minor \
    --user-id <USER_ID> \
    --description "Release description"
```

For more details, see the [Usage Guide](docs/usage.md).

