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.1.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.1-py3-none-any.whl (2.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: typal-0.1.1.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.1.tar.gz
Algorithm Hash digest
SHA256 77224588898297363a73cbd6214f461032bdc16e8d7c973c7f9a61f926c4fcdf
MD5 6f2286277043b311c2dcd06942096d13
BLAKE2b-256 5c9be2149ed2baa5f84dacb15d657f37a812cd3f33220e6ae05a2a5b271686ab

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: typal-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 2.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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 adbdee318c8d76ab4d16ab99ebba78eb0363fcb808283046b0a56462b5c9178d
MD5 5c9b4324ec7eb98696d4e0697c51821f
BLAKE2b-256 2fca0a002bf6374dc81db45f8180234b90519a345e81732eccc54de5f17e7b61

See more details on using hashes here.

Provenance

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