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.11+ 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
Metadata
Release files for dictify 5.0.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| dictify-5.0.2.tar.gz | 17.4 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| dictify-5.0.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 45.9 kB
Release files / dictify-5.0.2.tar.gz
| Download URL | dictify-5.0.2.tar.gz |
|---|---|
| Size | 17.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
29a41c4eb06a3c08ff71795405b926494261f61646452739e597d781652ee718
|
|
BLAKE2b-256 checksum How to use checksums |
7de8d753b6e8297dbe9523852e6e871c23c310bbd31b7378597d56229a0b3c79
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.11.14 {"installer":{"name":"uv","version":"0.11.14","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Fedora Linux","version":"44","id":"","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Release files / dictify-5.0.2-py3-none-any.whl
| Download URL | dictify-5.0.2-py3-none-any.whl |
|---|---|
| Size | 28.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
215c57a98cb2e0ddd6966ed8e2a8f035abcbd2f359aed723cda5e7e3b11686a3
|
|
BLAKE2b-256 checksum How to use checksums |
df6f6c41a8dc761df3104370508d5c8e1f5eaf42b35568a66ac66b5bb087135b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.11.14 {"installer":{"name":"uv","version":"0.11.14","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Fedora Linux","version":"44","id":"","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|