Skip to main content

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.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

todo2code-0.5.1.tar.gz (32.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

todo2code-0.5.1-py3-none-any.whl (16.0 kB view details)

Uploaded Python 3

File details

Details for the file todo2code-0.5.1.tar.gz.

File metadata

  • Download URL: todo2code-0.5.1.tar.gz
  • Upload date:
  • Size: 32.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.7

File hashes

Hashes for todo2code-0.5.1.tar.gz
Algorithm Hash digest
SHA256 8fe1df4b28c1ecf8c41ba4cc54f415052c7d2637d6ec19554ba0ac07126624e2
MD5 04a24c29883d6678f8ec44e64a8e4323
BLAKE2b-256 7b85f9b283dda3900a02b9e98d5ad866acbb733bde5436e38973c25797a65eae

See more details on using hashes here.

File details

Details for the file todo2code-0.5.1-py3-none-any.whl.

File metadata

  • Download URL: todo2code-0.5.1-py3-none-any.whl
  • Upload date:
  • Size: 16.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.7

File hashes

Hashes for todo2code-0.5.1-py3-none-any.whl
Algorithm Hash digest
SHA256 d69a9bd33f5097162fadf1596f47b71b8c294c911dd3441f473e116773b2000e
MD5 e7be1a1e899dfe483a9db68be821acb0
BLAKE2b-256 7b9194973d39c98bbea2e321ddff6e8727dd1c54dbdcc5f646fdf9f8ea399d09

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page