Registry / testing / filecheck

filecheck

JSON →
library1.0.3pypypi✓ verified 84d ago

FileCheck is a Python-native clone of LLVM's FileCheck tool, designed for flexible and powerful pattern matching in text. It allows developers to define a sequence of regular expression-based checks against a source buffer, enabling robust testing of compiler outputs, log files, or any structured text. The current version is 1.0.3, and it maintains an active release cadence with regular bug fixes and new features.

pip install filecheck
INSTALL
IMPORT
SIG · FILECHECK
F
filecheck
testingpythonv1.0.3
Install
1.9s avg
Import
Disk
16MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v1.0.3 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.920 runs
installs and imports cleanly · install 0.0s · import 0.000s · 18MB
glibc
py 3.103.920 runs
installs and imports cleanly · install 1.9s · import 0.000s · 18MB
16MB installed
● package 16MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

FileCheck
import filecheck
from filecheck import FileCheck

This quickstart demonstrates how to use the `filecheck` library to validate text against a series of `CHECK` directives. It covers basic `CHECK`, `CHECK-NEXT`, `CHECK-NOT`, and `CHECK-LABEL` directives, error handling, and using custom `check_prefixes`.

import filecheck from filecheck import FileCheck, FileCheckException # 1. Define the buffer (the text to be checked) my_buffer = """ Hello, World! This is line 2. Another line. Final line. """ # 2. Define the FileCheck directives (the checks to run) my_checks = """ CHECK: Hello, World! CHECK-NEXT: This is line 2. CHECK-NOT: hidden_text CHECK: Another line. CHECK-LABEL: Final line. """ # 3. Instantiate and run FileCheck try: checker = FileCheck(buffer=my_buffer, checks=my_checks) checker.run() print("FileCheck passed successfully!") except FileCheckException as e: print(f"FileCheck failed: {e}") except Exception as e: print(f"An unexpected error occurred: {e}") # Example with specific prefixes my_checks_with_prefix = """ MYPREFIX: Hello, World! MYPREFIX-NEXT: This is line 2. """ try: checker_prefix = FileCheck(buffer=my_buffer, checks=my_checks_with_prefix, check_prefixes=["MYPREFIX"]) checker_prefix.run() print("FileCheck with custom prefix passed successfully!") except FileCheckException as e: print(f"FileCheck with custom prefix failed: {e}")
filecheck --version
Debug
Known issues
breakingIn version 1.0.0, the behavior for empty captures changed from throwing an error to emitting a warning. If your code previously relied on an error being raised for empty captures, it will now only receive a warning.
fix
Review existing FileCheck directives and update your test logic if you relied on errors for empty captures. Consider adding explicit checks for captured values if their emptiness is critical.
affects: >=1.0.0
gotchaVersion 1.0.2 fixed an issue where non-strict whitespace matching sometimes incorrectly handled newlines. Older versions might have had unintended matches due to this looser interpretation.
fix
Upgrade to version 1.0.2 or newer to ensure correct and strict whitespace matching behavior. Review any existing checks that might have subtly relied on the previous, less strict behavior.
affects: <1.0.2
gotchaThe `--match-full-lines` flag was broken in versions prior to 1.0.2. Using this flag might not have produced the expected results for full-line matching.
fix
Upgrade to version 1.0.2 or newer to ensure the `--match-full-lines` flag (or its programmatic equivalent `match_full_lines=True`) functions as intended.
affects: <1.0.2
gotchaThe project re-licensed to Apache 2.0 in version 1.0.1. While not a code-breaking change, it's a significant licensing update for users embedding `filecheck` in their projects.
fix
Review your project's licensing compatibility if you are using versions older than 1.0.1 and plan to upgrade, or if your project has specific licensing requirements.
affects: <1.0.1
Upgrade
Version history
1.0.3latest on PyPI · released Aug 19, 2025
Audit
Dependencies

No dependency data recorded yet.

Agent activity
21 hits · last 30 days
node
18
Amazon
1
Resources
filecheck — pip install filecheck · libregistry