Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

ryucad for Python

The official Python client for ryucad, CAD built for AI agents to drive. It runs an installed ryucad as ryucad session --stdio, one process per connection, and sends ryucad's requests by name: the framing, binary answers, progress and typed errors are handled for you. Standard library only, Python 3.10 or newer, Apache-2.0.

Install

The package finds an installed ryucad; it ships none. Install ryucad first:

curl -fsSL https://github.com/Seiraiyu/ryucad/releases/latest/download/install.sh | sh

or on Windows (PowerShell):

irm https://github.com/Seiraiyu/ryucad/releases/latest/download/install.ps1 | iex

then the package:

pip install ryucad

It looks for ryucad in connect(exe=...), then RYUCAD_EXE, then ryucad on PATH, then the installers' ~/.ryucad/bin (RYUCAD_HOME's bin when that is set), and raises ryucad.NotInstalled with the two commands above when there is none. It needs ryucad's protocol 3 or newer (the one with batch) and warns when ryucad is older than the package.

A build script

import ryucad

def plate(name, width):
    return ryucad.op(
        "part.ensure",
        part=name,
        params={"w": f"{width} mm"},
        features=[{"id": "base", "type": "box", "params": {"x": "w", "y": 30, "z": 6}}],
    )

with ryucad.connect("~/work/fixture") as cad:
    answer = cad.batch([plate("left", 40), plate("right", 60)], prune=True)
    print(answer["parts"])   # {"left": {"status": "created", ...}, ...}

    again = cad.batch([plate("left", 40), plate("right", 60)], prune=True)
    assert again["written"] == 0   # nothing changed, nothing written

    cad.call("export", part="left", out="left.step")   # relative to the project
    stl = cad.call("export", part="left", format="stl")
    print(len(stl.data), "bytes of STL")
  • cad.call(method, params=None, **params) sends any request by name and returns its result as a dict; an answer that carries bytes has them in .data. A param named like a Python keyword (from) goes in the dict.
  • cad.batch(ops, expect=None, dry_run=False, rebuild=None, prune=False) runs many edits as one checked, logged, undoable change; ryucad.op builds each op. cad.ensure(part, features, ...) is part.ensure alone, and cad.undo() takes back this participant's latest change.
  • connect(folder, as_=..., no_daemon=..., exe=..., env=..., on_progress=...): as_ names the participant in the activity log; on_progress receives each progress line of a request sent with progress=True; after the script's own subscribe, notifications collect in cad.notifications.
  • One request at a time per session (threads take turns); open two sessions for two at once. Ctrl+C cancels a long request and waits for its cancelled answer before KeyboardInterrupt reaches the script.

Errors

A refusal raises ryucad.RyucadError with ryucad's stable code, a message, its details, and pointer, path, op and method when it names them (a batch's failing op). It is one of FixableError (the agent can fix it), UsageError, ProjectError (no usable project) or ExternalError (not the agent's fault), with named classes for the codes scripts branch on: Conflict, NotFound, RebuildFailed, HasDependents, AssemblyOverconstrained, Cancelled, DaemonError. Every other code is matched by e.code == ryucad.Code.SOME_CODE. The client's own errors are NotInstalled, Incompatible, SessionClosed and ProtocolError; all derive from ryucad.Error.

try:
    cad.batch(ops)
except ryucad.FixableError as e:
    print(e.code, e.op, e.pointer, e.message)

The protocol

Methods, params and answers are ryucad's own: ryucad <command> --help and --json name them, and the repository's scripting notes describe session --stdio, batch and part.ensure. The package adds no second API.

Versions

The package is released with ryucad, from the same tag: ryucad vX.Y.Z publishes ryucad X.Y.Z here, and a pre-release vX.Y.Z-pre.N publishes X.Y.ZrcN (install it with pip install --pre). Keep the package and ryucad at the same version.

Metadata

Release files for ryucad 0.10.0rc2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ryucad 0.10.0rc2
File Size Uploaded Provenance Actions
ryucad-0.10.0rc2.tar.gz 33.0 kB With provenance Details for ryucad-0.10.0rc2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for ryucad 0.10.0rc2
File Interpreter ABI Platform Actions
ryucad-0.10.0rc2-py3-none-any.whl Python 3 none any Details for ryucad-0.10.0rc2-py3-none-any.whl

Total release size: 59.1 kB

Release files / ryucad-0.10.0rc2.tar.gz

Download URL ryucad-0.10.0rc2.tar.gz
Size 33.0 kB
Tags Source
SHA-256 checksum
How to use checksums
5d8fb1b71642ee8d493e30909f6a929087e6dae4adbf1e645048e7c9b17e0a55
BLAKE2b-256 checksum
How to use checksums
c08d5f4553b84c999a95ee065688a7bd518dabf57c47226169f88ed934304629
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 30, 2026.

Transparency log

Release files / ryucad-0.10.0rc2-py3-none-any.whl

Download URL ryucad-0.10.0rc2-py3-none-any.whl
Size 26.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3337b68b75705d8bddfce93a4542cfc6707262356010b88db0c899e2656c0ad4
BLAKE2b-256 checksum
How to use checksums
ecaedf13b01e3b19aff57174bcf0cb4810f6f71d9d9f7a537b15f4f3e93cecc4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 30, 2026.

Transparency log

Security for ryucad 0.10.0rc2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for ryucad-0.10.0rc2.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 30, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page