Runtime type validation for Python
Project description
TypeWall is a lightweight, schema-first runtime validation library for Python 3.9 through 3.14. It provides strict parsing, deterministic structured errors, immutable schemas, composition, custom processing, type-derived schemas, boundary adapters, and optional FastAPI integration.
Installation
pip install typewall
pip install "typewall[fastapi]" # optional FastAPI integration
Quick Start
from typewall import w
User = w.object({
"name": w.str().min(2),
"age": w.int().min(0).optional(),
"tags": w.list(w.str()).default([]),
})
user = User.parse({"name": "Ada"})
assert user == {"name": "Ada", "tags": []}
TypeWall is strict: it does not coerce "42" into 42. Use explicit boundary adapters such as parse_env() when text conversion is required.
Error Inspection
result = User.safe_parse({"name": 42})
if not result.ok:
for issue in result.errors:
print(issue.path, issue.code, issue.message)
parse() raises one ValidationError containing every independently reachable issue. safe_parse() returns the same ordered issues without raising.
Integrations
- JSON Schema 2020-12:
to_json_schema(schema) - OpenAPI 3.1 schema objects:
to_openapi_schema(schema) - Environment mappings:
ObjectSchema.parse_env() - CLI:
typewall validate module:attribute [path|-] - FastAPI:
typewall.integrations.fastapi.request_body()
See the documentation, guides, and runnable examples. The documentation site is a self-contained Mintlify project under docs/; preview it locally with cd docs && npm install && npm run dev. Development and benchmark commands are documented in the contributing guide.
Development
uv sync --all-groups --all-extras --python 3.14
uv run pytest
uv run ruff format --check .
uv run ruff check .
uv run mypy
uv run pyright
uv run pytest benchmarks --benchmark-only
Contributing
Contributions go through a fork-based pull request workflow:
- Fork
MyGenX/TypeWallto your account. - Work on a feature branch in your fork, running the local checks above.
- Open a PR from your branch against
MyGenX/TypeWall:main. - Address review feedback and get it merged.
See CONTRIBUTING.md and the contributing guide for the full workflow and required checks.
TypeWall is distributed under the MIT license.
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
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 typewall-0.2.1.tar.gz.
File metadata
- Download URL: typewall-0.2.1.tar.gz
- Upload date:
- Size: 154.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5e71ab37b52dde34f2efa989a612380cd2120d004d9671cfe8b6b225a4660ef5
|
|
| MD5 |
1bdfb1db802f8c17387469e5d8c4b553
|
|
| BLAKE2b-256 |
9bcffdf44a33ab32d880ab8273600cd97de61e7fd9066591bdb106ec14f6e58f
|
Provenance
The following attestation bundles were made for typewall-0.2.1.tar.gz:
Publisher:
pypi-release.yml on MyGenX/TypeWall
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
typewall-0.2.1.tar.gz -
Subject digest:
5e71ab37b52dde34f2efa989a612380cd2120d004d9671cfe8b6b225a4660ef5 - Sigstore transparency entry: 1790797108
- Sigstore integration time:
-
Permalink:
MyGenX/TypeWall@627b9a0d791ac51be98cf4224353dfc82a1b2cec -
Branch / Tag:
refs/tags/v0.2.1 - Owner: https://github.com/MyGenX
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
pypi-release.yml@627b9a0d791ac51be98cf4224353dfc82a1b2cec -
Trigger Event:
release
-
Statement type:
File details
Details for the file typewall-0.2.1-py3-none-any.whl.
File metadata
- Download URL: typewall-0.2.1-py3-none-any.whl
- Upload date:
- Size: 25.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
859898ce375a2161e4d35c4ee7fe789f1efbf9302d48cd9444e5d4568ed4e8af
|
|
| MD5 |
c07759d4974b08e1190cddb9a829b546
|
|
| BLAKE2b-256 |
30340b1af56f0aea51e36db0357510dc9a99397cd55b0e2e63e2aff410d6cb21
|
Provenance
The following attestation bundles were made for typewall-0.2.1-py3-none-any.whl:
Publisher:
pypi-release.yml on MyGenX/TypeWall
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
typewall-0.2.1-py3-none-any.whl -
Subject digest:
859898ce375a2161e4d35c4ee7fe789f1efbf9302d48cd9444e5d4568ed4e8af - Sigstore transparency entry: 1790797260
- Sigstore integration time:
-
Permalink:
MyGenX/TypeWall@627b9a0d791ac51be98cf4224353dfc82a1b2cec -
Branch / Tag:
refs/tags/v0.2.1 - Owner: https://github.com/MyGenX
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
pypi-release.yml@627b9a0d791ac51be98cf4224353dfc82a1b2cec -
Trigger Event:
release
-
Statement type: