Declarative validation for files, directories, and system expectations
Project description
expectfs
Declarative validation for things that are not data models.
expectfs lets you define clear, readable expectations about files, directories,
and system state — without schemas, test frameworks, or boilerplate.
This is for validating the world, not validating Python objects.
Installation
pip install expectfs
Quick Example
from expect import expect, validate
expect.file("metrics.json") \
.is_json() \
.size_gt(100)
result = validate()
result.print()
If any expectation fails, a clear, actionable error message will be displayed after running validation.
Why expect?
Most validation tools focus on:
- JSON schemas
- Data models
- API payloads
- Function inputs
But engineers constantly need to validate things like:
- “Does this file exist?”
- “Is this directory populated?”
- “Is this JSON valid?”
- “Did my pipeline actually produce output?”
expect exists for that gap.
Key Features
- Declarative, chainable expectations
- Automatic dependency resolution (rules run in the correct order)
- Rule caching (each rule runs at most once)
- Clear failure messages
How it Works (Conceptually)
expect.file("output.json").is_json().size_gt(1024)
is_jsonautomatically ensures the file existssize_gtreuses prior results instead of re-running checks- Dependencies are resolved recursively
Users don’t need to think about ordering.
Supported Targets
Currently supported:
- Files
- Directories
Planned:
- Globs
- Environment variables
- Command outputs
Status
This project is in alpha.
- APIs may evolve
- Backwards compatibility is not yet guaranteed
- Feedback and contributions are welcome
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file expectfs-0.1.2.tar.gz.
File metadata
- Download URL: expectfs-0.1.2.tar.gz
- Upload date:
- Size: 6.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.5.22
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6d61cb05668b397dd417d95d415a74b4e8ea2fe255ee4df2e4643faa22a27f85
|
|
| MD5 |
0da03917e119f71d432b15a6e1cc0b8e
|
|
| BLAKE2b-256 |
00c80672dff23845e39b5ecd7764c7bc52c7bb4eec49b15419414d3d9ed4477c
|
File details
Details for the file expectfs-0.1.2-py3-none-any.whl.
File metadata
- Download URL: expectfs-0.1.2-py3-none-any.whl
- Upload date:
- Size: 7.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.5.22
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
29f63628378dd9fea5eaee69f6580238948de4569b997fe69a626e195836ddfa
|
|
| MD5 |
263a162f3795a147221a99a423fa4c9f
|
|
| BLAKE2b-256 |
7c41756396576e9c4b638e7f39b141c75ce3f90ceb4af982b2e7573930b646af
|