ticket-py package provides native Python bindings to ticket-rs, giving you full access to issue management and graph analytics from Python code.
Every visible tk subcommand has a typed Python wrapper, generated from the same clap::Command tree the binary parses against — so the Python surface stays in lockstep with the CLI by construction. Calls go through an in-process PyO3 FFI; no subprocess is spawned.
Installation
- Installer Script (Recommended)
- uv
- pip
The official installer downloads pre-built wheels for your platform:This creates an isolated virtual environment at
~/.ticket/.venv with:- Auto-detected Python version (3.9-3.13)
- Pre-built wheel for your platform (no compilation needed)
- Managed by uv for fast installs
Activating the Environment
If you used the installer script, activate the environment:Quick Start
API Reference
ticket_py exposes three categories of API:
- 76 typed wrappers — one per visible
tksubcommand. Type hints come fromclap. dispatch(argv)— raw escape hatch for any command, including hidden ones.command_spec()— introspect the CLI surface as a nested dict.
Typed wrappers
Each wrapper takes the command’s flags as keyword arguments (kebab-case becomes snake_case:--dry-run → dry_run), plus the global flags dir, format, json, and strict.
Return value depends on format:
format="json"→ parsed JSON (list/dict)- omitted or any other value → the raw stdout string
tk command — linear_sync, github_sync, claude_sync, worktree, stacks, insights, search, similar, validate, lint, and more. Discover them at runtime:
dispatch(argv)
Raw escape hatch for any command. Same in-process PyO3 path; you build the argv yourself.
command_spec()
Introspect the CLI surface as a nested dict — useful for building meta-tools, generating other typed bindings, or discovering commands and their flags programmatically.
Error handling
Errors split into two distinct classes:Return shapes
When you passformat="json", wrappers return parsed JSON. The shape mirrors what tk <command> --format json emits on the CLI:
tk <command> --format json once and inspect.
Examples
Find high-priority ready issues
Batch create issues
Export issues to JSON
Integration with pandas
Platform Support
Pre-built wheels are available for:If no pre-built wheel exists for your platform/Python version, installation will build from source (requires Rust toolchain).
Environment Variables
Troubleshooting
ImportError: No module named 'ticket_py'
ImportError: No module named 'ticket_py'
Make sure you’ve activated the virtual environment:Or reinstall:
ImportError: cannot import name 'Ticket' / 'list_issues' / ...
ImportError: cannot import name 'Ticket' / 'list_issues' / ...
In recent releases, the hand-written See the API Reference above; or
Ticket pyclass and the
nine hand-written wrapper functions (list_issues, ready_issues,
show_issue, create_issue, update_issue, search_issues,
find_similar_issues, version) were replaced with a typed_api
generated from the CLI’s clap surface.ticket_py.dispatch(["list", "-f", "json"]) for the raw escape hatch.Build fails during pip install
Build fails during pip install
The package contains native Rust code. If no pre-built wheel exists for your platform, you’ll need:
- Rust toolchain:
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh - Python development headers
Wrong Python version
Wrong Python version
The installer auto-detects your Python version. To use a specific version:
Next Steps
MCP Server
Use ticket-mcp for AI agent integration.
CLI Reference
Full command documentation.