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.0.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.0-py3-none-any.whl (9.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: py_for_ai-0.1.0.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.0.tar.gz
Algorithm Hash digest
SHA256 62c155961dec0c6e4e60b3b35d74adc5dad9767f38f017a5db7e79be0f992a01
MD5 f0177c318cbec372b428949ee7d4d3f0
BLAKE2b-256 26b96dca44f53f87fead57396cf0e20f840bebc4c0809593329bf2477d02a925

See more details on using hashes here.

File details

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

File metadata

  • Download URL: py_for_ai-0.1.0-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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 aaefd41e15438ea0bb4e493b78b31fbc8a24849a87acdd0fd2e72c1c6c21a2e5
MD5 e19aad64eb19fdd9a94300f28b8aea09
BLAKE2b-256 0ed636a3084b7d1e911f72b7e788f1abd7e60142756ea51485cc6f26e2b4db12

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