Skip to main content

A lightweight collection of typing helpers, aliases, protocols, and foundational type utilities for modern Python applications.

Project description

typal

A lightweight collection of reusable typing utilities for modern Python.

Overview

typal provides small, composable building blocks for Python type annotations.

It avoids type explosion and focuses on clarity, reuse, and native typing features.


Features

  • Optional type helpers (Opt[T])
  • Functional type aliases (Mapper, Predicate, Action)
  • Collection shortcuts (Seq[T], List[T])
  • Common type unions (StrOrInt, PathOrStr, etc.)
  • Enum-aware type utilities
  • Clean separation of typing concerns

Installation

Using uv:

uv add typal

Or pip:

pip install typal

Usage

Optionals

from typal.optionals import Opt

value: Opt[int] = None

Collections

from typal.collections import Seq

def process(items: Seq[str]) -> None:
    ...

Functional types

from typal.functional import Mapper, Predicate, Action

def transform(x: int) -> str:
    return str(x)

m: Mapper[int, str] = transform

Unions

from typal.unions import StrOrInt, PathOrStr

def load(path: PathOrStr) -> StrOrInt:
    ...

Tuples

from typal.tuples import Pair, Triple

Point = Pair[float]
RGB = Triple[int]

Design Philosophy

typal follows these principles:

  • Prefer native Python typing (|, list[T], dict[K, V])
  • Avoid combinatorial type explosion
  • Provide reusable abstractions, not exhaustive aliases
  • Keep the API small, predictable, and composable

Non-goals

typal does NOT aim to:

  • Replace Python's built-in typing system
  • Provide exhaustive pre-generated type variants
  • Introduce framework-specific abstractions
  • Replace domain models

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

typal-0.1.2.tar.gz (18.5 kB view details)

Uploaded Source

Built Distribution

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

typal-0.1.2-py3-none-any.whl (10.5 kB view details)

Uploaded Python 3

File details

Details for the file typal-0.1.2.tar.gz.

File metadata

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

File hashes

Hashes for typal-0.1.2.tar.gz
Algorithm Hash digest
SHA256 9f62fa1f659aff1f39b4a0d4b84457af8b5cc58b53e5f866dd8236023ff41ca7
MD5 fec1c89db6edf1a41697b2cae86e4fee
BLAKE2b-256 ccc96cf60f5dfc9d2b488d1f6fb5f725219de8ae580a64a87af152fa45a79611

See more details on using hashes here.

Provenance

The following attestation bundles were made for typal-0.1.2.tar.gz:

Publisher: python-publish.yml on agrahub/typal-py

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

File details

Details for the file typal-0.1.2-py3-none-any.whl.

File metadata

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

File hashes

Hashes for typal-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 11351d1a7a73ead8785f687b1ea128ac4948fd07646682a37cbbef26582d85c8
MD5 760148e19ae36d0a8ab85a0ba86778d1
BLAKE2b-256 39b74b8e6c53fc7df283662f4d7ea3499679346abbb8498204fc53a4f4cef388

See more details on using hashes here.

Provenance

The following attestation bundles were made for typal-0.1.2-py3-none-any.whl:

Publisher: python-publish.yml on agrahub/typal-py

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