CodeCapsule 🚀📦
Overview
CodeCapsule is a powerful Python utility that transforms entire project directories into a single, portable JSON file. Perfect for sharing code with AI models, archiving projects, or creating compact code representations.
Features
- 🌐 Convert entire project structures to JSON
- 🧩 Supports multiple programming languages
- 🔍 Configurable file inclusion/exclusion
- 💡 Ideal for LLM code analysis and sharing
Installation
Install CodeCapsule using pip:
pip install codecapsule
Quick Start
Basic Usage
# Convert current project to JSON
codecapsule
# Convert a specific project directory
codecapsule /path/to/your/project
# Save to a specific output file
codecapsule /path/to/project -o project_capsule.json
Filtering and Handling
CodeCapsule provides robust file processing with the following features:
-
🚫 Automatically excludes:
- Binary files
- Large executables (
.exe,.dll,.so) - Compiled Python files (
.pyc) - Version control directories (
.git) - Virtual environments (
.venv) - Development databases
-
🔍 File Content Detection
- Uses UTF-8 encoding
- Skips files that cannot be decoded
- Detects binary files using null-byte heuristic
Example Output
[
{
"path": "src/main.py",
"content": "# Full contents of the Python file"
},
{
"path": "README.md",
"content": "# Project documentation"
}
]
Limitations
- Large files may impact performance
- Only text-based files are processed
- Some binary or complex file types are automatically excluded
Use Cases
- 📤 Sharing entire project contexts with AI models
- 🗄️ Lightweight project archiving
- 🔬 Code analysis and exploration
License
BSD-3 License - See LICENSE file for details.
Requirements
- Python 3.8+
- No external dependencies
Disclaimer
CodeCapsule is designed for code sharing and analysis. Always review JSON contents before sharing sensitive code.
Metadata
Release files for codecapsule 1.0.5
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| codecapsule-1.0.5.tar.gz | 8.8 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| codecapsule-1.0.5-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 16.7 kB
Release files / codecapsule-1.0.5.tar.gz
| Download URL | codecapsule-1.0.5.tar.gz |
|---|---|
| Size | 8.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
7caa7d4f1e8a1a88a8166a8a066954af7e7481c97dee0e25077c55158ae9aaff
|
|
BLAKE2b-256 checksum How to use checksums |
12726d2ba4f69b01bb26e71f51af1ee27fdd585ef990abf7a39e554b5e0989e2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.0.1 CPython/3.12.8
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jan 14, 2025.
Transparency logRelease files / codecapsule-1.0.5-py3-none-any.whl
| Download URL | codecapsule-1.0.5-py3-none-any.whl |
|---|---|
| Size | 8.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
a0581f9e3a22487df2cfa7c93ba09dcc0a7ce1af6f0f63c092422d9951fdad17
|
|
BLAKE2b-256 checksum How to use checksums |
8015a929f2c06027d690d92b9520521e891d463b3d136cee7b3119cd5043c468
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.0.1 CPython/3.12.8
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jan 14, 2025.
Transparency log