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.3.tar.gz (18.8 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.3-py3-none-any.whl (10.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: typal-0.1.3.tar.gz
  • Upload date:
  • Size: 18.8 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.3.tar.gz
Algorithm Hash digest
SHA256 40b710e36166ec3b7506f4ec065af6a2deb61166f453e6852f851e77dd9c82cf
MD5 aade7b1075bd1c0751e7b4367ce7b0c9
BLAKE2b-256 f19e402bb2131cb53905da97fb50e80014f859e3f90b20a7b42a9a108085dc89

See more details on using hashes here.

Provenance

The following attestation bundles were made for typal-0.1.3.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.3-py3-none-any.whl.

File metadata

  • Download URL: typal-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 10.9 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.3-py3-none-any.whl
Algorithm Hash digest
SHA256 7b23e5ee32c9d09a7ce2d42660c2d87ea0a35f1cb758b04b5821a06a9495ceac
MD5 24dfcd20af436f3478f1aa1a0de91c9b
BLAKE2b-256 1dc1a577d410ee3c814a2ef09387c1d26ee3709427efe52c0f9ab8ceda21bbe2

See more details on using hashes here.

Provenance

The following attestation bundles were made for typal-0.1.3-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