Skip to main content

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?”

expectfs 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_json automatically ensures the file exists
  • size_gt reuses 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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

expectfs-0.1.3.tar.gz (6.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

expectfs-0.1.3-py3-none-any.whl (7.1 kB view details)

Uploaded Python 3

File details

Details for the file expectfs-0.1.3.tar.gz.

File metadata

  • Download URL: expectfs-0.1.3.tar.gz
  • Upload date:
  • Size: 6.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.5.22

File hashes

Hashes for expectfs-0.1.3.tar.gz
Algorithm Hash digest
SHA256 61aee22ee67ac2b0b2b1f1e36f8883dab03d6b938e6b19e3b195cb71fc15d648
MD5 1e7c2fec122001756f2200c2456f9e62
BLAKE2b-256 c4885d38a9b3c0e141ca377d4a52f3bb4232bd995b5803330d6b71d9422ff882

See more details on using hashes here.

File details

Details for the file expectfs-0.1.3-py3-none-any.whl.

File metadata

  • Download URL: expectfs-0.1.3-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

Hashes for expectfs-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 2c562cd4b6ce914a2c1980e2eb3f649434565d3da67d7969c3985254464531e4
MD5 70755b103f43a9656d6aef2e4bf3c6c9
BLAKE2b-256 3bcf969701c3466eb92d65689a470b28229c5f80765925305bbb3cf3c9614500

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page