Skip to main content

A command-line utility to pack Python codebases into a single text file for AI context, with clipboard support.

Project description

py-ai 🚀

PyPI version License: MIT Python Support

py-ai is a lightweight, zero-configuration command-line interface (CLI) tool designed for developers. It recursively scans your local Python codebase, filters out unnecessary files, and compiles your entire project—complete with a beautiful ASCII directory tree—into a single, organized text file while automatically copying it to your clipboard.

Perfect for instantly feeding your codebase context into Large Language Models (LLMs) like ChatGPT, Claude, and Gemini.


✨ Features

  • Smart Filtering: Automatically ignores VCS folders (.git), virtual environments (.venv, venv), IDE settings (.vscode, .idea), build artifacts (dist, build), and binary files (images, archives, databases).
  • ASCII Directory Tree: Generates a clean, sorted representation of your project layout at the top of the output.
  • Normalized File Markers: Wraps each file's code in distinct delimiters (--- START OF FILE: ... ---) using normalized cross-platform POSIX paths (/).
  • Clipboard Integration: Automatically copies the packed content. Gracefully falls back with a warning in headless/SSH environments rather than crashing.
  • PyPI & Hatchling Ready: Out-of-the-box support for modern PEP 621 packaging.

📂 Project Layout

py_ai_project/
├── pyproject.toml
├── README.md
└── src/
    └── py_ai/
        ├── __init__.py
        ├── __main__.py
        ├── core.py
        └── cli.py

🚀 Quick Start

Installation

Install the utility directly from PyPI:

pip install py-ai

(Or install it locally for development):

git clone https://github.com/Maksum867/py-ai.git
cd py_ai_project
pip install -e .

Usage

Run the utility from any terminal session:

# 1. Pack current directory and copy to clipboard:
pyai

# 2. Pack a specific directory:
pyai /path/to/your/project

# 3. Save the results to a custom file:
pyai . -o custom_output.txt

# 4. Run without clipboard copy (ideal for remote servers or CI/CD):
pyai --no-clipboard

📄 Output Format Example

================================================================================
PROJECT CONTEXT PACK: my_project
Generated on: 2026-07-31 12:00:00
Total files packed: 2
================================================================================

================================================================================
DIRECTORY TREE
================================================================================
my_project/
├── src/
│   └── main.py
└── pyproject.toml

================================================================================
FILES CONTENT
================================================================================

--- START OF FILE: pyproject.toml ---
[project]
name = "my_project"
version = "0.1.0"
--- END OF FILE: pyproject.toml ---

--- START OF FILE: src/main.py ---
def main():
    print("Hello, AI!")
--- END OF FILE: src/main.py ---

🛠️ Requirements & Dependencies

  • Python 3.8 or higher.
  • pyperclip (for clipboard operations).

Project details


Download files

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

Source Distribution

py_for_ai-0.1.1.tar.gz (7.3 kB view details)

Uploaded Source

Built Distribution

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

py_for_ai-0.1.1-py3-none-any.whl (9.1 kB view details)

Uploaded Python 3

File details

Details for the file py_for_ai-0.1.1.tar.gz.

File metadata

  • Download URL: py_for_ai-0.1.1.tar.gz
  • Upload date:
  • Size: 7.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.14.6

File hashes

Hashes for py_for_ai-0.1.1.tar.gz
Algorithm Hash digest
SHA256 f8070db9179e8c77d8961a15bce200111372d43382aba08d5407479fb1df52ad
MD5 ecd95c37fbf64506dca553f43ea233a4
BLAKE2b-256 b65d1dd12a00ddc0c339c9735dffa8c097c4f6136340aedf29e351d1bec62f52

See more details on using hashes here.

File details

Details for the file py_for_ai-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: py_for_ai-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 9.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.14.6

File hashes

Hashes for py_for_ai-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 dcc594bb77e0106e1492194369f588f0b6fe7169d5abd499916dc67402e47c13
MD5 420b07400796ce1edc54ae13e56aa1c7
BLAKE2b-256 743ad3f446ab3ec46db7ce502014cdc25ce44c558585814b1999c2964fe754af

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