Skip to main content

Runtime type validation for Python

Project description

TypeWall

Runtime type validation for Python with a small, schema-first API.

from typewall import w

User = w.object({
    "name": w.str(),
    "age": w.int().optional(),
    "tags": w.list(w.str()).default([]),
})

user = User.parse({"name": "Ada"})
assert user == {"name": "Ada", "tags": []}

Use safe_parse() when validation failures should be returned instead of raised:

result = User.safe_parse({"name": 42})

if not result.ok:
    print(result.to_dict())

The MVP supports strict string, integer, float, boolean, object, and list schemas; required, optional, and defaulted fields; and structured validation errors. It does not coerce values. Constraints, advanced composition, transforms, type-derived schemas, schema export, environment parsing, CLI tools, and framework integrations are intentionally deferred to later phases.

MVP Public API

  • Builders: w, tw, and SchemaBuilder
  • Schemas: Schema, StringSchema, IntegerSchema, FloatSchema, BooleanSchema, ObjectSchema, and ListSchema
  • Parsing: Schema.parse() and Schema.safe_parse()
  • Field configuration: Schema.optional() and Schema.default()
  • Results and errors: ParseResult, ValidationIssue, and ValidationError

MVP object schemas reject unknown keys, omit absent optional fields, defensively copy defaults, and aggregate independently reachable issues in deterministic order. The error dictionary uses $ for root failures and dot-delimited paths for nested fields and list indexes.

Development

TypeWall uses uv and supports CPython 3.9 through 3.14.

UV_CACHE_DIR=.uv-cache uv sync --python 3.14
UV_CACHE_DIR=.uv-cache uv run pytest
UV_CACHE_DIR=.uv-cache uv run ruff check .
UV_CACHE_DIR=.uv-cache uv run mypy

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

typewall-0.0.1.tar.gz (6.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

typewall-0.0.1-py3-none-any.whl (8.0 kB view details)

Uploaded Python 3

File details

Details for the file typewall-0.0.1.tar.gz.

File metadata

  • Download URL: typewall-0.0.1.tar.gz
  • Upload date:
  • Size: 6.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for typewall-0.0.1.tar.gz
Algorithm Hash digest
SHA256 a870bcdd4c6a6741f6f3009aa7e01c7afa5037dbabcdca9321a804842e259afd
MD5 434e3a45accbae1bc503dbb743e62dfe
BLAKE2b-256 7a7bb7a48af0d67b2368b41fc23220c2da8062d65025a4d62292df2380be5d3f

See more details on using hashes here.

Provenance

The following attestation bundles were made for typewall-0.0.1.tar.gz:

Publisher: pypi-release.yml on MyGenX/TypeWall

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file typewall-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: typewall-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 8.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for typewall-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 5c1a1d1744f8c4536184cff2226d65c9b4adf7e073c8e06e6862855e9922948b
MD5 460ae726545989942222c43f406aecd5
BLAKE2b-256 e59f2f8abb13caa1720a50dee126c1f67cb24778172590acea431a39c9c3b89f

See more details on using hashes here.

Provenance

The following attestation bundles were made for typewall-0.0.1-py3-none-any.whl:

Publisher: pypi-release.yml on MyGenX/TypeWall

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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