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.9.2rc5

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.9.2rc5
File Size Uploaded Provenance Actions
ryucad-0.9.2rc5.tar.gz 31.5 kB With provenance Details for ryucad-0.9.2rc5.tar.gz

Built distribution (wheel)

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

Total release size: 56.4 kB

Release files / ryucad-0.9.2rc5.tar.gz

Download URL ryucad-0.9.2rc5.tar.gz
Size 31.5 kB
Tags Source
SHA-256 checksum
How to use checksums
3277e72342daf0b64f7a52424dd2516c176c1b659f9a704636fbf41d3f76b720
BLAKE2b-256 checksum
How to use checksums
41e6a6853c72301e392c036f9fb45513172dbbcb62a0c3561f8c0ae42e6d94fe
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 23, 2026.

Transparency log

Release files / ryucad-0.9.2rc5-py3-none-any.whl

Download URL ryucad-0.9.2rc5-py3-none-any.whl
Size 24.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
96891ef4af5113c5f03259957ab35972866647cc69f33b1009f0333602695c3f
BLAKE2b-256 checksum
How to use checksums
aa536556bbda7c4ffd4f2e6163dde372f9baaed4535e8e7a7f1a395131453a99
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 23, 2026.

Transparency log

Security for ryucad 0.9.2rc5

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.9.2rc5.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 23, 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