Welcome to shai_py Documentation
In the AI-driven development era, tools must be designed for machine consumption first. shai-py (Sanhe AI Python tools) embraces this philosophy by packaging Python development utilities as a CLI-first library, making it effortless for AI agents like Claude Code to invoke sophisticated workflows. Instead of writing one-off scripts scattered across agent skills, we consolidate battle-tested logic into a versioned Python package that AI can invoke with a single uvx command—no installation, no environment pollution, just instant execution.
This approach solves the fundamental challenge of AI tool integration: how to provide powerful, testable, and maintainable utilities without cluttering agent contexts with implementation details. By exposing functionality through clean CLI interfaces (uvx shai-py project-info, uvx shai-py test-path), AI agents can focus on orchestration while developers maintain business logic in a single, version-controlled codebase. The result is elegant, reproducible, and scales beautifully from simple project introspection to complex development automation.
Architecture: Subcommand Design Pattern
This project uses a Subcommand Delegation Pattern that cleanly separates business logic from CLI interface, enabling independent testing and maintainability.
Key Components:
Subcommand Modules (shai_py/subcmd/<subcommand>.py): Each module implements a single CLI subcommand. The module must define a main() function containing all business logic. The module-level __doc__ string serves as CLI help text.
CLI Aggregator (shai_py/cli.py): The Cli class exposes each subcommand as a method that delegates to the corresponding module’s main() function. Method docstrings are inherited from the subcommand module’s __doc__.
Test Files (tests/subcmd/test_subcmd_<subcommand>.py): Tests import and invoke the main() function directly, enabling unit testing without CLI overhead.
Pattern Benefits:
Business logic is testable without CLI framework involvement
Documentation lives with implementation (single source of truth)
Adding new subcommands requires only: create module with main(), add method to Cli class
Reference Implementation:
Subcommand: shai_py/subcmd/detect_python_project_metadata.py (see main() function)
CLI integration: shai_py/cli.py (see Cli.project_info() method)
Test example: tests/subcmd/test_subcmd_detect_python_project_metadata.py
Install
shai_py is released on PyPI, so all you need is to:
$ pip install shai-py
To upgrade to latest version:
$ pip install --upgrade shai-py
Metadata
Release files for shai-py 0.1.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 | |
|---|---|---|---|
| shai_py-0.1.1.tar.gz | 11.4 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| shai_py-0.1.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 23.5 kB
Release files / shai_py-0.1.1.tar.gz
| Download URL | shai_py-0.1.1.tar.gz |
|---|---|
| Size | 11.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a9d9f39b7895e3f303f1b4bf544f668f6b0ffd7d5573b251adf266b7a10d95be
|
|
BLAKE2b-256 checksum How to use checksums |
da54d36d6ae7fb84e4ba45f545b906b968b02de0fa2e700587683138ac54af52
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.11.8
|
Release files / shai_py-0.1.1-py3-none-any.whl
| Download URL | shai_py-0.1.1-py3-none-any.whl |
|---|---|
| Size | 12.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
5481c0aa306d90cd0e901aac03e9a444fcce161f960087a148af4c23839991e5
|
|
BLAKE2b-256 checksum How to use checksums |
67930d02bb6c22dbe64f8c863f934d2e802e8b42b8a93730a50ab92a8e243202
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.11.8
|