Skip to main content

findfmt Logo

CI Status CodeQL Analysis Documentation Status pre-commit.ci status Coverage OpenSSF Best Practices

PyPI Version Python Versions PyPI Wheel GHCR Container License: MIT

uv Ruff Type-checked: ty Docstring Coverage: 100% Conventional Commits Accessibility WCAG 2.1 AA


A .gitignore-aware file discovery and classification suite that locates files by content format, shebang, and MIME tag for automated linting, formatting, and CI pipelines.

1. Why findfmt?

Unlike traditional find or globbing tools that rely strictly on file extensions, findfmt:

  • Understands file content: Identifies format by content, shebang (#!/usr/bin/env python3), and MIME types using the identify engine.
  • Respects Git: Traverses trees hierarchically while pruning .gitignore and .git/info/exclude paths early before descending into large directories (e.g. node_modules/, .venv/).
  • Deterministic: Always returns clean, relative, deterministically sorted paths optimized for subshells, xargs, and automation.

2. Installation

Run directly with uvx:

uvx findfmt --help

Install globally:

uv tool install findfmt

Or add to your project:

uv add findfmt

2.2. With pip

pip install findfmt

2.3. With Docker / Container

docker pull ghcr.io/bdperkin/findfmt:latest
docker run --rm -v "$(pwd)":/workspace -w /workspace ghcr.io/bdperkin/findfmt:latest -t python

3. Usage

3.1. Locate Files by Tag / Format

# Locate all Python files
findfmt -t python

# Locate all YAML and JSON files
findfmt -t yaml,json

# Locate shell scripts
findfmt -t shell

3.2. Shebang Filtering

# Locate files with bash shebang
findfmt --shebang bash

# Locate scripts executing with python
findfmt --shebang python

3.3. Pipe Safely to Linters and Tools

Use -0 for NUL-delimited output with xargs -0:

# Format discovered Python files
findfmt -t python -0 | xargs -0 ruff format

# Lint shell scripts with shellcheck
findfmt -t shell -0 | xargs -r -0 shellcheck

3.4. Inspect Tags & Summaries

# Print matched files and their classification tags
findfmt -l -t python

# Print summary statistics to stderr
findfmt -s

3.5. Structured Data Serialization

Export discovery results to machine-readable formats for pipelines, analysis, and notebooks:

# Export JSON array of file metadata and filter with jq
findfmt -t python --format json | jq '.[] | .path'

# Stream NDJSON (one JSON record per line)
findfmt -f jsonl

# Generate clean YAML document
findfmt -t yaml -f yaml

# Generate Jupyter Notebook with pandas DataFrame ingestion
findfmt -f ipynb > discovery.ipynb

# Export CSV with header row and process with csvkit
findfmt -f csv | csvcut -c path,tags,size_bytes

# Render aligned CSV table in terminal
findfmt -f csv-table --table-style rounded

# Generate Markdown table
findfmt -t python -f markdown

3.6. Command Aliases & Entry Points

findfmt installs dedicated executable wrappers for frequent operations:

Command Equivalent To Description
findfiles [PATHS...] findfmt --hidden Traverse all files including hidden files
findfilemime [PATHS...] findfmt --hidden --list-tags List files with MIME & format tags
findfilefmt [TAG] [PATHS...] findfmt --hidden --tag [TAG] Filter files by format tag
findshebang [INTERPRETER] [PATHS...] findfmt --hidden --shebang [INTERPRETER] Filter scripts by shebang pattern
findfmt0 [PATHS...] findfmt --hidden --print0 NUL-delimited output for xargs -0
findsummary [PATHS...] findfmt --hidden --summary Output summary statistics to stderr

4. CLI Options

Flag Description
-t, --tag, --type TAG Match files containing specified tag(s)
-e, --exclude, --exclude-tag TAG Exclude files containing specified tag(s)
--all-tags / --no-all-tags Require match against all include tags (AND logic)
--shebang INTERPRETER Match shebang interpreter name or pattern
--no-ignore / --ignore Toggle respecting .gitignore files
--hidden / --no-hidden Toggle inspecting hidden files and directories
-d, --dirs-only List directories only, suppressing regular file entries
-l, --follow-links / --no-follow-links Follow directory symlinks with loop detection
-x, --one-file-system Confine traversal to starting directory's filesystem device
-L, --max-depth LEVEL Restrict directory traversal descent to maximum depth level
--filelimit LIMIT Skip directories exceeding child entry count threshold
--prune Omit empty directories and directories with zero matching files
-P, --pattern PATTERN Match files against wildcard or glob pattern (supports multiple -P and |)
-I, --exclude-pattern PATTERN Exclude files against wildcard or glob pattern (supports multiple -I and |)
--ignore-case / --no-ignore-case Apply case-insensitive pattern matching across -P and -I
--match-dirs / --no-match-dirs Match directories against patterns; matched directories inherit to child files
-f, --format FORMAT Output format (text, json, jsonl, yaml, ipynb, csv, csv-table, tsv, markdown, rst, table, tree)
--tree / --no-tree Toggle hierarchical directory tree view (equivalent to --format tree)
--table-style STYLE Border style (rounded, simple, minimal, double, heavy, markdown, ascii, cp437, square, grid)
--pager / --no-pager Toggle interactive paging (auto-pages on TTY when lines exceed terminal height)
-i, --no-indent / --indent Omit branch indentation in tree view and strip extraneous whitespace in structured formats
-A, --ansi-lines / --no-ansi-lines Use ANSI/VT100 line drawing escapes for tree indentation lines
-S, --cp437 / --no-cp437 Use CP437 console graphics line drawing characters for tree indentation lines
-C, --color / -n, --no-color Force enable or disable ANSI color output across all output channels
--absolute, --full-path / --no-absolute Toggle absolute vs relative output paths
--relative, --relative-path / --no-relative Prepend input search path prefix to relative output paths
--known-tags List all supported classification tags and exit
-v, -V, --version Display version (--verbose adds runtime diagnostics)
--diagnostics Display runtime environment diagnostics and exit
--help-all Display comprehensive manual, env vars, and exit codes
-- [PATHS...] POSIX terminator: treat following tokens strictly as paths

5. Development & Testing

This project enforces 100% test coverage and strict type checking:

# Clone the repository
git clone https://github.com/bdperkin/findfmt.git
cd findfmt

# Install dependencies with uv
uv sync --all-groups

# Run tests and verify 100% coverage
uv run pytest

# Run linting and typing
uv run ruff check
uv run ty check

# Run full verification suite
uv run python tools/verify_quality.py

6. Governance & Community

7. License

MIT License © 2026 Brandon Perkins.

Metadata

Release files for findfmt 0.4.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for findfmt 0.4.0
File Size Uploaded
findfmt-0.4.0.tar.gz 125.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for findfmt 0.4.0
File Interpreter ABI Platform
findfmt-0.4.0-py3-none-any.whl Python 3 none any Details

Total release size: 178.5 kB

Release files / findfmt-0.4.0.tar.gz

Download URL findfmt-0.4.0.tar.gz
Size 125.3 kB
Tags Source
SHA-256 checksum
How to use checksums
1cd33c5460691d073f35640962b3c4a11ea350ae9242ad2adbb5082e8fceecba
BLAKE2b-256 checksum
How to use checksums
99bc8a9e289894a30f45f0fc23f638ef75a92412a2c2f143feaf51f6a2b06447
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Oct 13, 2026.

Transparency log

Release files / findfmt-0.4.0-py3-none-any.whl

Download URL findfmt-0.4.0-py3-none-any.whl
Size 53.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a0c2fc3fb9f0f87d96ca4a71ed131cbbb2e52d98c917fbf3632a6afc9e693981
BLAKE2b-256 checksum
How to use checksums
951f887d3a0fe194ae81dfa3475f79516d12588d1fc5a25b56c32af6ed7bf98e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Oct 13, 2026.

Transparency log

Release history Release notifications | RSS feed

0.9.0

2 release files

0.8.0

2 release files

0.7.0

2 release files

0.6.0

2 release files

0.5.1

2 release files

0.5.0

2 release files

0.4.1

2 release files

This release

0.4.0 This release

2 release files

0.3.0

2 release files

0.2.0

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page