--- id: filecheck version: "1.0.3" license: Apache-2.0 license_treatment: permissive maintenance: aging --- # filecheck — A Python-native clone of LLVMs FileCheck tool License: permissive · Maintenance: aging · Downloads: 395.0K/mo ## What it is and what it does filecheck is a Python port of LLVM's FileCheck pattern-matching tool for validating text output in tests. It reads check directives (CHECK, CHECK-NEXT, CHECK-NOT, CHECK-LABEL, CHECK-DAG, etc.) from test files or comments and matches them against input text, reporting pass/fail with detailed diagnostics. The package passes 95.8% of LLVM's MLIR filecheck test suite and supports most core features including regex patterns, variable captures, and numeric captures, though numeric substitution (arithmetic on captured values) is not yet implemented. The tool is fully type-checked with pyright and formatted with black, making it suitable for integration into compiler testing pipelines, MLIR/xDSL projects, and any workflow that needs pattern-based output validation. It requires Python 3.10 or later and has no external runtime dependencies, keeping installation and deployment simple. Use it for: - Validate compiler or interpreter output in test suites by embedding CHECK directives in expected-output files - Test MLIR or LLVM IR generation by matching patterns against generated code - Verify code generation correctness in language implementation projects using pattern matching and variable capture - Check diagnostic or error message output from tools by matching against known patterns - Automate regression testing for xDSL or similar domain-specific languages ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. filecheck is a Python implementation of LLVM's FileCheck tool, used to validate text output against patterns defined in check directives embedded in test files or comments. Yes, if you need LLVM FileCheck semantics in Python for compiler or code-generation testing. The package is stable, dependency-free, and covers 95.8% of LLVM's test suite. Install with caution if your tests rely on numeric substitution (arithmetic on captures), which is not yet supported; otherwise, it's a straightforward drop-in replacement for the C++ FileCheck tool. ## Install pip install filecheck uv add filecheck poetry add filecheck ## Installing filecheck Before you install: Low friction: pure Python wheel with no runtime dependencies. Maintenance is aging—last release 360 days ago, but the repository remains active with a recent commit on 2025-08-19 and full type checking via pyright. License in practice: Apache-2.0 permissive license allows use in most projects without restriction, including proprietary software. Quickstart: pip install filecheck # In a test file or comment: # CHECK: expected pattern # CHECK-NEXT: next line pattern # CHECK-NOT: should not appear from filecheck import FileCheck fc = FileCheck() fc.run_filecheck('input.txt', 'test_file.py') Requires Python 3.10 or later (3.10, 3.11, 3.12, or 3.13). Verify before relying: - Whether numeric substitution (arithmetic on captured values) is a blocker for your test suite, given it covers only 2 out of 1645 MLIR tests - Whether the 69 known test failures (4.2% of MLIR filecheck tests) affect your specific use case ## Package facts - License: Apache-2.0 (permissive) - Python support: supports_current - Install friction: low - Maintenance: aging - Downloads: 395.0K/month (top 15,000 on PyPI) - Known vulnerabilities: none known ## Tags llvm filecheck python, text output pattern matching tests, filecheck clone, validate compiler output, check directives testing, compiler-testing, pattern-matching, llvm [View on SkillFed](https://skillfed.io/packages/filecheck) · [View on PyPI](https://pypi.org/project/filecheck/)