Skip to content

Commit a2d910b

Browse files
committed
feat: add devsper CLI entry point and restructure as devsper._core extension
1 parent 921599b commit a2d910b

5 files changed

Lines changed: 72 additions & 3 deletions

File tree

crates/devsper-py/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ repository.workspace = true
88
homepage.workspace = true
99

1010
[lib]
11-
name = "devsper"
11+
name = "_core"
1212
crate-type = ["cdylib"]
1313

1414
[dependencies]

crates/devsper-py/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -440,7 +440,7 @@ fn run_specs_async<'py>(
440440
// ── Module registration ───────────────────────────────────────────────────────
441441

442442
#[pymodule]
443-
fn devsper(m: &Bound<'_, PyModule>) -> PyResult<()> {
443+
fn _core(m: &Bound<'_, PyModule>) -> PyResult<()> {
444444
m.add_class::<PyNodeSpec>()?;
445445
m.add_class::<PyWorkflowIr>()?;
446446
m.add_function(wrap_pyfunction!(run, m)?)?;

python/devsper/__init__.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
from devsper._core import (
2+
NodeSpec,
3+
WorkflowIr,
4+
load_workflow,
5+
run,
6+
run_async,
7+
run_specs,
8+
run_specs_async,
9+
run_workflow,
10+
run_workflow_async,
11+
)
12+
13+
__all__ = [
14+
"NodeSpec",
15+
"WorkflowIr",
16+
"load_workflow",
17+
"run",
18+
"run_async",
19+
"run_specs",
20+
"run_specs_async",
21+
"run_workflow",
22+
"run_workflow_async",
23+
]

python/devsper/_cli.py

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
import argparse
2+
import json
3+
import sys
4+
5+
6+
def main() -> None:
7+
parser = argparse.ArgumentParser(
8+
prog="devsper",
9+
description="Devsper — self-evolving AI workflow engine",
10+
)
11+
sub = parser.add_subparsers(dest="command", required=True)
12+
13+
run_p = sub.add_parser("run", help="Run a .devsper workflow")
14+
run_p.add_argument("spec", help="Path to .devsper file")
15+
run_p.add_argument(
16+
"--input",
17+
metavar="KEY=VALUE",
18+
action="append",
19+
default=[],
20+
dest="inputs",
21+
help="Workflow input (repeatable)",
22+
)
23+
24+
args = parser.parse_args()
25+
26+
if args.command == "run":
27+
inputs: dict[str, str] = {}
28+
for kv in args.inputs:
29+
if "=" not in kv:
30+
print(f"error: expected KEY=VALUE, got '{kv}'", file=sys.stderr)
31+
sys.exit(1)
32+
k, v = kv.split("=", 1)
33+
inputs[k] = v
34+
35+
from devsper._core import run as _run
36+
37+
results = _run(args.spec, inputs or None)
38+
print(json.dumps(results, indent=2))
39+
40+
41+
if __name__ == "__main__":
42+
main()

python/pyproject.toml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ build-backend = "maturin"
44

55
[project]
66
name = "devsper"
7-
version = "3.1.2"
7+
version = "3.1.3"
88
description = "Devsper — self-evolving AI workflow engine"
99
readme = "README.md"
1010
requires-python = ">=3.11"
@@ -18,7 +18,11 @@ classifiers = [
1818
]
1919
dependencies = []
2020

21+
[project.scripts]
22+
devsper = "devsper._cli:main"
23+
2124
[tool.maturin]
2225
bindings = "pyo3"
26+
module-name = "devsper._core"
2327
manifest-path = "../crates/devsper-py/Cargo.toml"
2428
strip = true

0 commit comments

Comments
 (0)