findfmt-Dokumentation

findfmt-Logo

PyPI Version Python Versions PyPI Wheel PyPI Status PyPI Downloads GitHub Release GHCR Container Platforms Hatch

CI Status Dependency Matrix Docs Build Vale Prose Lint pre-commit.ci status Last Commit

Coverage uv Ruff ty Docstring Coverage: 100% Tested with Hypothesis PEP 561 Typed Deptry Vulture Xenon Codespell PyMarkdown

CodeQL zizmor ClusterFuzzLite GitGuardian Dependabot OpenSSF Scorecard OpenSSF Best Practices SLSA Provenance Security Policy

Documentation i18n Languages License: MIT Semantic Versioning Conventional Commits Keep a Changelog Accessibility WCAG 2.1 AA Pull Requests Welcome GitHub Issues GitHub Stars

findfmt ist ein leistungsstarkes, .gitignore-bewusstes Werkzeug zur Dateierkennung und -klassifizierung. Es findet Dateien anhand von Inhaltsformat, Shebang und MIME-Tag, anstatt sich ausschließlich auf Dateiendungen zu verlassen.

1. Core Capabilities

  • Intelligente Klassifizierung: Nutzt die identify-Engine und Inhaltsheuristiken, um Dateitypen (z. B. Python, Shell, YAML, JSON, Ausführbar) selbst dann zu erkennen, wenn Dateinamen keine Endung besitzen.

  • Git-bewusster Verzeichnisdurchlauf: Schließt Verzeichnisse und Dateien, die durch .gitignore- und .git/info/exclude-Regeln erfasst werden, bereits frühzeitig beim Durchlauf aus.

  • Deterministische Ausgabe: Erzeugt stets saubere, relative und alphabetisch sortierte Dateipfade für Unix-Pipelines und xargs.

  • Hybrid Python-Rust Architecture: Built with a strict uv-first methodology, PyO3 abi3-py311 native extension support (findfmt._rust_ext), guaranteed pure-Python fallback (FINDFMT_NO_EXTENSIONS=1), 100% test coverage, and strict static type checking.

2. Quickstart

2.1. Direkte Ausführung und Installation

Sofortige Ausführung mit uvx ohne expliziten Installationsschritt:

uvx findfmt --help
uvx findfmt -t python

Installation als isoliertes Benutzerwerkzeug oder Projektabhängigkeit:

# Global tool installation via uv
uv tool install findfmt

# Add to managed Python project
uv add findfmt

# Standard pip installation
pip install findfmt

2.2. Zentrale Such-Workflows

# Locate all Python files
findfmt -t python

# Locate files matching either Python or Shell scripts
findfmt -t python,shell

# Discover executable scripts by shebang pattern
findfmt --shebang bash

# Filter by glob pattern while honoring .gitignore
findfmt -P "*.py|*.md"

# Safe piping with NUL delimiters for xargs
findfmt -t python -0 | xargs -0 ruff format

2.3. Programmatische Nutzung als Python-Bibliothek

findfmt direkt in Python-Skripte und automatisierte Pipelines einbinden:

from findfmt import FileInfo, TraversalConfig, find_files, get_formatter

# Configure traversal scope and format filtering
config = TraversalConfig(include_tags={"python"}, root_paths=["src"])

# Iterate through discovered FileInfo objects
for file_info in find_files(config):
    print(f"{file_info.path} ({file_info.size_bytes} bytes)")

# Format output using any built-in serializer (e.g. table, json, tree)
formatter = get_formatter("table")
print(formatter.format(find_files(config)))

Benutzerhandbuch

API-Dokumentation

Community und Governance


3. Community & Feedback