Skip to main content

Package your entire codebase into a single text file for AI consumption

Project description

Blobify Blobify

Package your entire codebase into a single text file for AI consumption

PyPI version Python version License Tests Code style: black

Feed your project to Claude, ChatGPT, or other AI assistants for code analysis, debugging, refactoring, documentation, or feature development.

Quick Start

Install:

pip install git+https://github.com/AlexanderParker/blobify.git

Basic usage:

# Package current directory to clipboard
bfy . --copy-to-clipboard=true

# Or run without directory if .blobify exists
bfy --copy-to-clipboard=true

Command Line Options

bfy [directory] [options]
  • directory - Directory to scan (optional, defaults to current directory if .blobify file exists)
  • --output-filename <file> - Output file path (optional, defaults to stdout)
  • -x, --context [name] - Use specific context from .blobify file, or list available contexts if no name provided
  • -f, --filter <"name","regex","filepattern"> - Content filter: extract only lines matching regex pattern, optionally restricted to files matching filepattern (can be used multiple times)
  • --debug=true|false - Enable debug output for gitignore and .blobify processing (default: false)
  • --enable-scrubbing=true|false - Enable scrubadub processing of sensitive data (default: true)
  • --output-line-numbers=true|false - Include line numbers in file content output (default: true)
  • --output-index=true|false - Include file index section at start of output (default: true)
  • --output-content=true|false - Include file contents in output (default: true)
  • --output-metadata=true|false - Include file metadata (size, timestamps, status) in output (default: true)
  • --show-excluded=true|false - Show excluded files in file contents section (default: true)
  • --copy-to-clipboard=true|false - Copy output to clipboard (default: false)
  • --list-patterns=none|ignored|contexts - List patterns and exit: 'ignored' shows built-in patterns, 'contexts' shows available contexts (default: none)

Key features: Respects .gitignore, automatic sensitive data scrubbing, includes line numbers, supports custom filtering via .blobify configuration, content filters for extracting specific patterns with file targeting, context listing for easy discovery, cross-platform clipboard support, context inheritance for reusable configurations.

Important Notice: The scrubbing feature is not guaranteed to work; it may not detect some sensitive data. Consider it a best-effort helper only. Always review output before sharing.

Content Filters

You can add multiple filters to extract specific patterns from files.

The filter syntax is: "name","regex","filepattern" where:

  • name - Filter identifier (for display)
  • regex - Regular expression to match content lines
  • filepattern - Optional file glob pattern (defaults to * for all files if omitted)

If you provide only two values like "name","regex", the filter applies to all matched files. Single values like "regex" use the regex as both name and pattern.

Basic Filters

# Function and class definitions
bfy . --filter '"signatures","^(def|class)\s+"' --copy-to-clipboard=true

# Multiple filters (OR logic)
bfy . --filter '"funcs","^def"' --filter '"imports","^import"' --copy-to-clipboard=true

File-Targeted Filters

Target specific file types with the file pattern syntax:

# Python functions only
bfy . --filter '"py-functions","^def","*.py"' --copy-to-clipboard=true

# Backend API analysis: routes from Python + SQL from migrations
bfy . --filter '"api-routes","@app\.","*.py"' --filter '"queries","^(SELECT|INSERT)","*.sql"' --copy-to-clipboard=true

.blobify Configuration

Create a .blobify file in your project directory for custom configurations. When a .blobify file exists in your current directory, you can run bfy without specifying a directory argument.

Basic Configuration

  • @option=value - Set default configuration option (@debug=true, @copy-to-clipboard=true, @output-content=false, etc.)
  • @filter="name","regex","filepattern" - Set default content filter with CSV format for file targeting
  • +pattern - Include files (overrides gitignore)
  • -pattern - Exclude files
  • [context-name] - Define named contexts
  • [context-name:parent] - Define context with single inheritance
  • [context-name:parent1,parent2] - Define context with multiple inheritance
  • Supports * and ** wildcards
# Default configuration options
@copy-to-clipboard=true
@show-excluded=false

# Content filters with file targeting (CSV format)
@filter="signatures","^(def|class)\s+","*.py"
@filter="imports","^(import|from)","*.py"
@filter="routes","@app\.(get|post)","app.py"

# Include/exclude patterns
+.github/**
+.pre-commit-config.yaml
-*.log
-temp/**

[docs-only]
# Documentation review context
-**
+*.md
+docs/**

[todos]
# Find all TODOs and FIXMEs
@filter="todos","(TODO|FIXME|XXX)"
@show-excluded=false
+**

Context Inheritance

  • Use [context:parent] for single inheritance
  • Use [context:parent1,parent2] for multiple inheritance
  • Contexts can only inherit from contexts defined earlier in the file
  • Child contexts inherit all patterns and options from parents, then add their own
  • Cannot redefine the default context - it's automatically created
  • Inheritance order is preserved: parent1 → parent2 → child
# Base configuration
@copy-to-clipboard=true
@debug=true
# Match nothing by default
-**

[backend:default]
# Inherits @copy-to-clipboard=true, @debug=true, +*.py, -*.pyc from default
+*.sql
+migrations/**
@filter="functions","^def","*.py"
@filter="models","^class.*Model","models/*.py"

[frontend:default]
# Also inherits from default
+*.js
+*.vue
+*.css
@filter="components","^(function|const)\s+[A-Z]","*.jsx"

[full:backend,frontend]
# Multiple inheritance - combines backend + frontend
+*.md
+docs/**
@show-excluded=false

Development

Setup

1 - Clone and enter directory:

git clone https://github.com/AlexanderParker/blobify.git
cd blobify

2 - Create and activate virtual environment:

python -m venv venv
source venv/bin/activate  # Linux/macOS
# or
venv\Scripts\activate     # Windows

3 - Install with dev dependencies:

pip install -e ".[dev]"
pre-commit install

Run Tests

invoke test        # Run tests
invoke coverage    # Run with coverage
invoke format      # Format code
invoke lint        # Check code quality
invoke all         # Check everything

For Maintainers

Publishing to PyPI:

This package is published to PyPI as blobify. Releases are managed using invoke tasks:

# On branch main - after any release-related PRs are merged in.

# Bump version (choose one):
invoke bump-patch     # 1.0.0 → 1.0.1
invoke bump-minor     # 1.0.0 → 1.1.0
invoke bump-major     # 1.0.0 → 2.0.0
# or set specific version:
invoke set-version 1.2.3

# Ensure all tests pass:
invoke all

# Clean any previous build artifacts:
invoke clean-dist

# Build the package:
invoke build

# Test upload to TestPyPI first (recommended):
invoke publish-test

# Upload to production PyPI (requires appropriate credentials):
invoke publish

# Finally tag the build with the new version number and push the tag to the remote:
invoke tag-release

TestPyPI Testing:

# Install from TestPyPI to verify the package:
invoke test-install

License

MIT License - see the project repository for details.

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

blobify-1.0.5.tar.gz (69.3 kB view details)

Uploaded Source

Built Distribution

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

blobify-1.0.5-py3-none-any.whl (78.3 kB view details)

Uploaded Python 3

File details

Details for the file blobify-1.0.5.tar.gz.

File metadata

  • Download URL: blobify-1.0.5.tar.gz
  • Upload date:
  • Size: 69.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.10

File hashes

Hashes for blobify-1.0.5.tar.gz
Algorithm Hash digest
SHA256 53f3b34e2f15f58f85c39212d596197f7ac7cbdb536e96bbb33558a3628c8c38
MD5 cddfcb8a88b95e8376aea57c72525a5c
BLAKE2b-256 ab61514d3e28f8e6d97ec1096f88f93a83b66b59d9cfe9f4c735e90253bc4455

See more details on using hashes here.

File details

Details for the file blobify-1.0.5-py3-none-any.whl.

File metadata

  • Download URL: blobify-1.0.5-py3-none-any.whl
  • Upload date:
  • Size: 78.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.10

File hashes

Hashes for blobify-1.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 dea0436218eeaa4d77e9b3c5fd0606f6e583b401ce7bdf6bd9631fc2215470e7
MD5 686744b43cb35307b73ea4c799e4c4ca
BLAKE2b-256 4bf12aea006a88d080bb7e80c16654357c95bd80ea6331bbae5828981868d9d4

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