Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
70 changes: 70 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
name: release

# Triggers PyPI publish when a tag matching `v*` is pushed.
# Uses PyPI trusted-publisher (OIDC) so no secrets need to live in
# this repo. Setup, one-time, on PyPI side:
# pypi.org → manage cacp-protocol → publishing → add trusted publisher
# owner: zenprocess
# repository: cacp
# workflow: release.yml
# environment: pypi
#
# Fallback: if trusted-publisher is not configured, the upload step
# fails with a loud "trusted publisher not registered" error. Add
# `PYPI_API_TOKEN` as a repo secret and replace the `with:` block on
# the publish step with `password: ${{ secrets.PYPI_API_TOKEN }}` to
# unblock without OIDC.

on:
push:
tags:
- "v*"

permissions:
contents: read

jobs:
build:
name: Build sdist + wheel
runs-on: ubuntu-latest
defaults:
run:
working-directory: cacp-python
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Install build tooling
run: python -m pip install --upgrade pip build
- name: Build distributions
run: python -m build
- name: Verify version matches the tag
run: |
set -eu
DIST_VERSION=$(python -c "import tomllib; print(tomllib.load(open('pyproject.toml','rb'))['project']['version'])")
TAG_VERSION="${GITHUB_REF_NAME#v}"
if [ "$DIST_VERSION" != "$TAG_VERSION" ]; then
echo "::error::pyproject version $DIST_VERSION does not match tag v$TAG_VERSION"
exit 1
fi
- uses: actions/upload-artifact@v4
with:
name: dist
path: cacp-python/dist/

publish:
name: Publish to PyPI
needs: build
runs-on: ubuntu-latest
environment: pypi
permissions:
id-token: write # required for trusted-publisher OIDC
steps:
- uses: actions/download-artifact@v4
with:
name: dist
path: dist/
- uses: pypa/gh-action-pypi-publish@release/v1
with:
packages-dir: dist/
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
__pycache__/
10 changes: 7 additions & 3 deletions cacp-python/README.md
Original file line number Diff line number Diff line change
@@ -1,22 +1,26 @@
# cacp — Reference Python parser for CACP
# cacp-protocol — Reference Python parser for CACP

Canonical Python reference implementation of [CACP (Compressed Agent
Communication Protocol)](https://github.com/zenprocess/cacp). The spec
lives in the parent [`README.md`](../README.md); this package implements
the parser against it.

> **Naming**: distributed on PyPI as `cacp-protocol` (the unprefixed
> `cacp` slot was already taken by an unrelated project — Classification
> Algorithms Comparison Pipeline). Imports as `cacp_protocol`.

## Install

```
pip install cacp
pip install cacp-protocol
```

Zero runtime dependencies — pure stdlib.

## Usage

```python
from cacp import parse
from cacp_protocol import parse

text = open("agent_response.txt").read()
response = parse(text)
Expand Down
2 changes: 1 addition & 1 deletion cacp-python/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[project]
name = "cacp"
name = "cacp-protocol"
version = "0.1.0"
description = "Reference Python parser for CACP (Compressed Agent Communication Protocol)"
readme = "README.md"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
See the canonical spec at https://github.com/zenprocess/cacp.
"""

from cacp.parser import parse
from cacp.models import (
from cacp_protocol.parser import parse
from cacp_protocol.models import (
CACPResponse,
CANONICAL_STATUS_VALUES,
CANONICAL_TESTS_BUILD_VALUES,
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

import re

from cacp.models import (
from cacp_protocol.models import (
CACPResponse,
CANONICAL_STATUS_VALUES,
CANONICAL_TESTS_BUILD_VALUES,
Expand Down
2 changes: 1 addition & 1 deletion cacp-python/tests/test_conformance.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

import pytest

from cacp import (
from cacp_protocol import (
CANONICAL_STATUS_VALUES,
CANONICAL_TESTS_BUILD_VALUES,
parse,
Expand Down
2 changes: 1 addition & 1 deletion cacp-python/tests/test_roundtrip.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

from __future__ import annotations

from cacp import parse
from cacp_protocol import parse


# Verbatim copy of the response example in the parent README.md (§"Response
Expand Down
Loading