todo2code Python SDK
Paczka udostępnia dwa tryby:
T2CClient/Todo2CodeClient— klient uruchomionego serwera A2A/REST;TypeScriptRuntime— lokalny most Python → Node.js, wykonujący kanoniczny runtime TypeScript bez uruchamiania serwera.
Instalacja lokalna:
python3 -m pip install .
Użycie:
import json
from todo2code_sdk import Todo2CodeClient
client = Todo2CodeClient("http://localhost:8787")
print(client.health())
result = client.diff_graph_files(".intent/run-a/intent.graph.json", ".intent/run-b/intent.graph.json")
print(result["diff"]["summary"])
files = client.diff_text_files("before.ts", "after.ts", include_html=True)
git = client.diff_git(revision="HEAD", include_svg=False)
with open(".intent/run-b/intent.graph.json", encoding="utf-8") as graph_file:
after_graph = json.load(graph_file)
reality = client.reality(after_graph, gaps_only=True)
SDK korzysta wyłącznie z biblioteki standardowej Python i opcjonalnego Bearer tokenu. Metody grafowego diffu używają REST, natomiast diff plików/Git, reality i ogólne run korzystają z A2A v1.0.
Lokalny runtime TypeScript
Najpierw zbuduj TypeScript i paczkę Python:
npm run build
make python-wheel
python3 -m pip install .intent-packages/python/todo2code-*.whl
Kanoniczny manifest Python znajduje się w katalogu głównym repozytorium. Dystrybucję wheel i sdist do publikacji zbudujesz poleceniem:
python3 -m build
python3 -m twine check dist/todo2code-*
python3 -m build dopisuje archiwa Python do współdzielonego dist/ i nie
usuwa istniejącego wyniku kompilacji TypeScript. Paczka zawiera wyłącznie
todo2code, moduł zgodności todo2code_sdk i metadane dystrybucji.
Następnie Python może uruchomić ten sam pipeline i Intent vs Reality bez
transportu HTTP:
from todo2code import TypeScriptRuntime
runtime = TypeScriptRuntime("/path/to/repository")
run = runtime.pipeline(documentation_llm=False, output_dir=".intent-python")
reality = runtime.reality(
run["graphPath"],
diagnostics_path=run["diagnosticsPath"],
gaps_only=True,
)
print(reality["view"]["totals"])
TypeScriptRuntime.pipeline() domyślnie ustawia deterministyczne NL i Markdown
oraz summary_llm=False, więc nawet obecność klucza w .env nie uruchamia
OpenRouter. Wywołania LLM wymagają jawnego ustawienia odpowiednich parametrów.
Wymagany jest Node.js oraz dostępny skompilowany dist/src/cli.js albo
wykonywalny t2c. Dla instalacji poza repo ustaw T2C_TYPESCRIPT_CLI na
bezwzględną ścieżkę CLI. Paczka Python nie replikuje logiki DSL — proces Node.js
pozostaje jedynym źródłem semantyki.
Metadata
Release files for todo2code 0.5.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| todo2code-0.5.1.tar.gz | 32.8 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| todo2code-0.5.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 48.8 kB
Release files / todo2code-0.5.1.tar.gz
| Download URL | todo2code-0.5.1.tar.gz |
|---|---|
| Size | 32.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
8fe1df4b28c1ecf8c41ba4cc54f415052c7d2637d6ec19554ba0ac07126624e2
|
|
BLAKE2b-256 checksum How to use checksums |
7b85f9b283dda3900a02b9e98d5ad866acbb733bde5436e38973c25797a65eae
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.7
|
Release files / todo2code-0.5.1-py3-none-any.whl
| Download URL | todo2code-0.5.1-py3-none-any.whl |
|---|---|
| Size | 16.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
d69a9bd33f5097162fadf1596f47b71b8c294c911dd3441f473e116773b2000e
|
|
BLAKE2b-256 checksum How to use checksums |
7b9194973d39c98bbea2e321ddff6e8727dd1c54dbdcc5f646fdf9f8ea399d09
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.7
|