Thanks for your interest in contributing! C-Two is a resource-oriented RPC framework with a Python front-end and Rust native layer. This guide covers everything you need to get started.
Prerequisites: Python ≥ 3.10, Rust toolchain, uv package manager.
git clone https://github.com/world-in-progress/c-two.git
cd c-two
uv sync # installs dependencies and builds the Python SDK native extensionRelay tests and examples use the standalone Rust c3 relay runtime. From a
source checkout, build and link the local c3 binary before running relay
flows:
python tools/dev/c3_tool.py --build --link
c3 relay --bind 127.0.0.1:8080To force-rebuild after Rust source changes:
uv sync --reinstall-package c-two# Full Python test suite (set C2_RELAY_ANCHOR_ADDRESS= to avoid env interference)
C2_RELAY_ANCHOR_ADDRESS= uv run pytest sdk/python/tests/ -q --timeout=30
# Single file / single test
uv run pytest sdk/python/tests/unit/test_wire.py -q
uv run pytest sdk/python/tests/unit/test_transferable.py::TestTransferableDecorator::test_hello_data_round_trip -q
# Rust core tests
cargo test --manifest-path core/Cargo.toml --workspace
# Python SDK native extension and tests
uv sync --reinstall-package c-two
C2_RELAY_ANCHOR_ADDRESS= uv run pytest sdk/python/tests -q --timeout=30All new code must include tests. Ensure the full suite passes before opening a PR.
- Fork the repository and clone your fork.
- Create a branch from
mainwith a descriptive name (e.g.,feat/grid-pagination,fix/shm-leak). - Make your changes in small, focused commits.
- Push to your fork and open a Pull Request against
main. - Describe what and why in the PR body. Link related issues if applicable.
We encourage Conventional Commits:
feat: add chunked transfer support for large payloads
fix: prevent double-free in buddy allocator
docs: update CRM contract examples
test: add integration test for relay mesh
refactor: simplify MethodTable index lookup
- Import alias: always
import c_two as cc. - Type hints required — use modern syntax (
list[int],str | None). Nofrom __future__needed (Python ≥ 3.10). - CRM contracts: plain class names, no
Iprefix (Grid, notIGrid). Method bodies are...(ellipsis). - Resource classes: named by domain semantics (
NestedGrid), not by the contract. - Transferable types: do not add
@staticmethodtoserialize/deserialize/from_buffer— the metaclass handles it. - Follow existing formatting conventions in the file you're editing.
- Code lives in
core/(a Cargo workspace of 7 crates). - Run
cargo test --manifest-path core/Cargo.toml --workspacebefore submitting core changes. - The Python SDK native extension lives in
sdk/python/native/; rebuild it withuv sync --reinstall-package c-twobefore submitting Python SDK native changes. - Prefer zero-copy and single-allocation patterns in wire/transport code.
core/
├── foundation/
├── protocol/
└── transport/
cli/
└── src/ # Native c3 CLI
sdk/python/src/c_two/
├── crm/ # CRM contracts, @transferable, decorators
├── transport/ # Registry, proxy, server bridge, scheduler
├── config/ # Python override facades backed by Rust config resolution
└── mem/ # Python wrappers for Rust memory subsystem
sdk/python/native/
└── src/ # PyO3 extension crate for c_two._native
sdk/python/tests/
├── unit/
├── integration/
└── fixtures/ # Shared test CRM contracts and resources
examples/python/
Tests may be affected by C2_* environment variables. Always prefix test runs with C2_RELAY_ANCHOR_ADDRESS= to isolate from your local environment. See .env.example for the full reference.
Open an issue or start a discussion on the repository. We're happy to help!