Documents schema and data validation
Project description
Dictify
Lightweight validation for Python mappings and JSON-like documents.
Dictify provides standalone field validation and annotation-first Model classes for dict-shaped data. It keeps mapping access and attribute access together, validates assignments, supports strict or permissive unknown-key handling, and converts models back to plain Python data.
- Python
3.12+ Field(...)for defaults, required fields, and validatorsModelfor mapping-shaped schemasdict(model)for shallow conversion,model.dict()for recursive conversion- Inspectable model signatures for CLI/data-binding tools such as Cyclopts
Install
pip install dictify
Example
from datetime import UTC, datetime
from typing import Annotated
from dictify import Field, Model
class Note(Model):
title: Annotated[
str,
Field(required=True).verify(
lambda value: len(value) <= 300,
"Title must be 300 characters or fewer",
),
]
content: Annotated[str, Field()]
timestamp: Annotated[datetime, Field(default=lambda: datetime.now(UTC))]
note = Note(title="Dictify", content="dictify is easy")
note.content = "Updated content"
note["content"] = "Updated again"
assert note["content"] == "Updated again"
assert isinstance(note.dict()["timestamp"], datetime)
Model is strict by default. Pass _strict=False to keep undeclared keys as extra model data:
note = Note({"title": "Dictify"}, _strict=False)
note.category = "docs"
assert note["category"] == "docs"
Standalone fields work without a model:
email = Field(required=True).instance(str).match(r".+@.+")
email.value = "user@example.com"
AI Skill
Dictify ships with an optional packaged AI skill installer:
dictify ai-skill-install
Development
Repository-local maintenance commands live under dev/cli:
uv run python -m dev.cli --help
uv run python -m dev.cli release-check
See dev/README.md for the command summary and release workflow.
Documentation
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 dictify-5.0.0.tar.gz.
File metadata
- Download URL: dictify-5.0.0.tar.gz
- Upload date:
- Size: 17.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.11.6 {"installer":{"name":"uv","version":"0.11.6","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Fedora Linux","version":"43","id":"","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7fa42bb0733045d94404bd1ec5cdf5c19ce5879e37337fed088ded82383c2dbf
|
|
| MD5 |
712d6a2409831d90e353136985b175d3
|
|
| BLAKE2b-256 |
80b3039a42f55374f1aee113f1ec57b579e89b0b8304421d38c8fddf81b7fffc
|
File details
Details for the file dictify-5.0.0-py3-none-any.whl.
File metadata
- Download URL: dictify-5.0.0-py3-none-any.whl
- Upload date:
- Size: 28.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.11.6 {"installer":{"name":"uv","version":"0.11.6","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Fedora Linux","version":"43","id":"","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
afaf2799c84d3dd267e648ed156c7094360153baf555f41e9c98a5983ed1cc95
|
|
| MD5 |
595b3848005dac9bfe618f8131eca3df
|
|
| BLAKE2b-256 |
10f6eeb67cc5ddd2788d20370a3b6b6c0902f1667cb9e3cc7ef34b2a57678db9
|