Skip to content

ant dev example dispatcher supports only python+csharp; 13 other SDKs have examples but are unreachable #65

@Nic-dorman

Description

@Nic-dorman

Bug

ant dev example <name> -l <language> advertises itself as the way to run the bundled examples, but only Python and C# are wired up. Every other SDK in this repo (antd-cpp, antd-dart, antd-elixir, antd-go, antd-java, antd-js, antd-kotlin, antd-lua, antd-php, antd-ruby, antd-rust, antd-swift, antd-zig) ships runnable examples in its own directory, but the CLI can't reach them:

$ ant dev example --help
usage: ant dev example [-h] [-l {python,csharp}] name

Location

ant-dev/src/ant_dev/cmd_example.py:

def run(args) -> None:
    ...
    if lang == "python":
        _run_python(sdk_root, name)
    else:
        _run_csharp(sdk_root, name)

Only _run_python and _run_csharp exist; the parser also hardcodes choices=["python","csharp"] (see ant-dev/src/ant_dev/cli.py).

What examples exist today

I cloned main and looked at each SDK directory. All 14 desktop SDKs have example source files (Kotlin's are bundled into one Main.kt dispatched by arg; macOS-only Swift has Sources/AntdExamples/Main.swift):

SDK Example sources Invocation today
antd-cpp examples/01-connect.cpp, 02-data.cpp, … CMake build + run binary
antd-dart example/01_connect.dart, … dart run example/02_data.dart
antd-elixir examples/01_connect.exs, … elixir examples/02_data.exs
antd-go examples/02-data/main.go, … cd examples/02-data && go run .
antd-java Example02PublicData.java, … javac + java -cp …
antd-js examples/02-data.ts, … npx tsx examples/02-data.ts
antd-kotlin examples/src/main/kotlin/…/Main.kt ./gradlew :examples:run --args="2"
antd-lua examples/02-data.lua, … lua examples/02-data.lua
antd-php examples/02-data.php, … php examples/02-data.php
antd-ruby examples/02_data.rb, … ruby examples/02_data.rb
antd-rust examples/02-data.rs, … cargo run --example 02-data
antd-swift Sources/AntdExamples/Main.swift swift run (macOS)
antd-zig examples/02-data.zig, … zig build run-02-data

Suggested shape of the fix

Three reasonable directions, in increasing scope:

  1. Plugin per language. Each SDK ships a examples/.runner.json (or a [tool.ant-dev.examples] block in its native manifest) describing how to build and invoke each example. ant-dev reads the file and dispatches — no per-language Python in ant-dev.

  2. Hard-coded dispatchers in ant-dev, one _run_<lang> per SDK that just shells out the canonical command above. Cheap to ship, but ant-dev grows whenever a new SDK joins.

  3. Status quo + escape hatch: leave ant dev example to python+csharp, but add ant dev shell -l <lang> that drops you into the SDK directory with the right env set up. Users run examples themselves.

(1) feels right long-term, (2) is fine as a stopgap.

Why this matters

For anyone standing up a testbox (e.g. cross-language verification of a data round-trip), it's not obvious from the CLI alone that 13/15 SDKs aren't usable through ant dev example. Hitting this lengthens onboarding noticeably.


Surfaced while building a multi-language testbox — happy to take a stab at (2) if there's interest.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions