Skip to main content
iron-monk logo

iron-monk

A minimalist, strict validation library for Python dataclasses.

CI/CD PyPI version Python Versions License Coverage: 100% Zero Dependencies


📖 Read the official documentation here: benesgarage.github.io/iron-monk


Installation

Install via your preferred package manager:

# Using pip
pip install iron-monk

# Using uv
uv add iron-monk

# Using poetry
poetry add iron-monk

Quickstart

Define your models using the @monk decorator and wrap your types in Annotated constraints.

from typing import Annotated
from monk import monk, validate
from monk.constraints import Email, Interval
from monk.exceptions import ValidationError

@monk
class User:
    email: Annotated[str, Email]
    age: Annotated[int, Interval(ge=18)]

user = User(email="bad-email", age=12)

print(user.email) # Raises UnvalidatedAccessError

try:
    validate(user)
except ValidationError as e:
    print(e.errors) # [{'field': 'email', 'message': "..."}, {'field': 'age', 'message': "..."}]

user.email = "test@domain.com"
user.age = 25

validate(user)

print(user.email) # "test@domain.com"

Core Philosophy

The Python ecosystem is dominated by heavy validation frameworks. iron-monk is built for a completely different philosophy:

  • 🎯 Do one thing well: Unlike libraries that parse, coerce, and serialize, we focus strictly on validation.
  • 🪶 Zero Dependencies: Pure Python. No compiled binaries or bloated environments.
  • 🛡️ No Magic: We don't secretly coerce strings into integers. Strict types mean strict types.
  • ⏳ Deferred Validation: Capture bad data in a guarded state instead of crashing instantly.
  • 🧬 Zero Inheritance: No massive base classes polluting your namespace. Just a decorator.

Real-world examples

iron-monk is designed to drop into any modern Python project. Some notable projects include:

  • 🍓 Strawberry GraphQL: iron-monk helps validate input objects seamlessly.
  • ⚡ Starlette (ASGI): HTTP endpoints with simple request validation using iron-monk.
  • 🖥️ tyro (CLI tool): Generate command-line interfaces from dataclasses and validate with iron-monk.

👉 See iron-monk integrate with these projects, and more, in our Real-World Examples →

The Toolkit

Batteries included. iron-monk comes with a comprehensive suite of built-in constraints. From networking (Email, URL, IPAddress) to collections (Each, Unique) and logic (Not, Predicate), you will rarely need to write your own rules.

👉 Check out the Constraint ToolkitExplore the Constraint Toolkit →**

Advanced Usage

Need to validate multiple fields together, override error messages with string interpolation, or instantly crash on bad data? iron-monk supports complex business logic while maintaining zero magic.

👉 Read the Advanced Usage Guide →

License

MIT

Metadata

Release files for iron-monk 0.3.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for iron-monk 0.3.1
File Size Uploaded Provenance Actions
iron_monk-0.3.1.tar.gz 17.7 kB With provenance Details for iron_monk-0.3.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for iron-monk 0.3.1
File Interpreter ABI Platform Actions
iron_monk-0.3.1-py3-none-any.whl Python 3 none any Details for iron_monk-0.3.1-py3-none-any.whl

Total release size: 30.2 kB

Release files / iron_monk-0.3.1.tar.gz

Download URL iron_monk-0.3.1.tar.gz
Size 17.7 kB
Tags Source
SHA-256 checksum
How to use checksums
317a0d033238cc188eab827c1af69c4cde28e4f9ef751bda21f45885587739cb
BLAKE2b-256 checksum
How to use checksums
f2505f4d17702cd33e2a3325b0caef8f54eb9d50c0f77d0adcb84e1f7eba28b6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Mar 20, 2026.

Transparency log

Release files / iron_monk-0.3.1-py3-none-any.whl

Download URL iron_monk-0.3.1-py3-none-any.whl
Size 12.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a76c5eb1a52e55fe1de6117b35c2830358309aeaf868ae9295ba602ed4ae8d9e
BLAKE2b-256 checksum
How to use checksums
4cfe58361d088a504543fca2657ef4cca1fcf37c76a5c3be6e57031d27786136
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Mar 20, 2026.

Transparency log

Security for iron-monk 0.3.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for iron_monk-0.3.1.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Mar 20, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.3.1 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page