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()

print(result)

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_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.1.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.1-py3-none-any.whl (7.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: expectfs-0.1.1.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.1.tar.gz
Algorithm Hash digest
SHA256 e7dba6d5cc18c4082627bc4c67d28a3c148ad23343a3e4e71e05c64953fbe7d3
MD5 c64e63b78c0782bf0cf1848c3cf4b988
BLAKE2b-256 664eef2f2038214610a5ecdaa412d1169a0a45f50e3acb5dfe77cee9dc1940a6

See more details on using hashes here.

File details

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

File metadata

  • Download URL: expectfs-0.1.1-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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 f2590f50f429dda9933bd5b9d940a7000b1b417451f98392c520b7bb02d6cfaf
MD5 90de81f96d34056bf3a8e8a711de20e1
BLAKE2b-256 98af71fd6272da5e31100b3911fadf7dac3be569e6070c31850bc7609744ea49

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