Skip to main content

PyTo AI

A lightweight, extensible Python-first Code Agent framework for code generation, execution, and tooling with LLMs.

PyTo AI automates your Git workflow by using LLMs to generate commit messages and merge request descriptions. It integrates with GitLab via glab CLI and supports bilingual (Chinese/English) interfaces.

Features

  • AI-powered commit messages — Generates conventional commit messages from your staged diff
  • AI-powered merge requests — Creates structured MR titles and descriptions with background, changes, and impact sections
  • Branch sync analysis — Detects divergence from the target branch and recommends rebase strategies
  • GitLab integration — Creates MRs and opens them in your browser via glab
  • Bilingual support — Chinese (zh) and English (en) prompts and UI
  • Fallback to manual input — If LLM generation fails, prompts for manual input

Installation

# Clone the repository
git clone https://github.com/JoshYuJump/pyto-ai.git
cd pyto-ai

# Install with uv
uv sync

Configuration

1. LLM Settings

Create ~/.pyto/settings.json (auto-created on first run with defaults):

{
  "env": {
    "ANTHROPIC_AUTH_TOKEN": "your-api-key-here",
    "ANTHROPIC_BASE_URL": "https://api.anthropic.com"
  },
  "model": "claude-sonnet-4-20250514"
}

PyTo Code uses the Anthropic API via Pydantic AI. You can point ANTHROPIC_BASE_URL to any Anthropic-compatible endpoint (e.g., Aliyun Dashscope, AWS Bedrock).

2. Project Configuration

Create a pyto.toml in your project root:

[general]
language = "en"  # "en" for English, "zh" for Chinese

[gitflow]
gitlab_host = "gitlab.example.com"
gitlab_port = "443"
repo_name = "group/project"
develop_branch = "main"

3. GitLab CLI

For the submit command, install and authenticate glab:

glab auth login

Usage

Commit

Stage changes, generate a commit message with AI, and push:

pyto commit

Skip the confirmation prompt:

pyto commit --skip-review

Submit

Commit, push, and create a GitLab merge request:

pyto submit

Skip the confirmation prompt:

pyto submit --skip-review

The submit workflow will:

  1. Check for uncommitted changes
  2. Stage and commit with an AI-generated message
  3. Analyze branch divergence from the target branch
  4. Optionally sync/rebase with the target branch
  5. Push to remote
  6. Generate MR title and description with AI
  7. Create the MR and open it in your browser

Architecture

pyto/
├── __init__.py          # Package version
├── main.py              # CLI entry point (argparse)
├── llm.py               # LLM settings & Pydantic AI agent factory
└── commands/
    ├── __init__.py
    ├── commit.py         # GitWorkflow — commit & push
    └── submit.py         # SubmitWorkflow — commit, push & MR

The framework uses Pydantic AI for structured LLM interactions. Each command creates a typed agent with a Pydantic output model (CommitMessage, MRContent) to ensure responses conform to the expected schema.

Development

# Install dev dependencies
uv sync --group dev

# Run tests
uv run pytest

# Lint
uv run ruff check .

License

Apache License 2.0

Metadata

Release files for pyto-ai 0.3.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pyto-ai 0.3.2
File Size Uploaded Provenance Actions
pyto_ai-0.3.2.tar.gz 18.6 kB Without provenance Details for pyto_ai-0.3.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for pyto-ai 0.3.2
File Interpreter ABI Platform Actions
pyto_ai-0.3.2-py3-none-any.whl Python 3 none any Details for pyto_ai-0.3.2-py3-none-any.whl

Total release size: 39.2 kB

Release files / pyto_ai-0.3.2.tar.gz

Download URL pyto_ai-0.3.2.tar.gz
Size 18.6 kB
Tags Source
SHA-256 checksum
How to use checksums
95ad3210498118c2e573808af784d83d5de32a0ed2b25317abd949c25dcc4d76
BLAKE2b-256 checksum
How to use checksums
7e93f6f5ac2cd608a7447b4ffe1ff34e7a0a1f3d74a530db1502eab61ca51ea3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.7 {"installer":{"name":"uv","version":"0.13.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / pyto_ai-0.3.2-py3-none-any.whl

Download URL pyto_ai-0.3.2-py3-none-any.whl
Size 20.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7aa66fb70fe8cf73574be2418fb8d858d574aadb027a643c5eb5b75ef9cc7c9d
BLAKE2b-256 checksum
How to use checksums
5c72000ff8d4339f51649977db2967ef0d417321680b63df4d8d1bc4315259f8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.7 {"installer":{"name":"uv","version":"0.13.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Security for pyto-ai 0.3.2

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

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