Skip to content

Releases: nesalia-inc/python-typemap

Version 0.2.0

05 Mar 13:04

Choose a tag to compare

What's New in v0.2.0

This release adds comprehensive type utilities for type manipulation.

New Type Utilities

  • KeyOf[T] - Returns all member names as a tuple of Literal types

    • Similar to TypeScript's keyof operator
    • Example: KeyOf[User] returns tuple[Literal["name"], Literal["age"]]
  • *Template[Parts] - Template literal string builder

    • Concatenates string literal types at runtime
    • Example: Template["api/v1/", Literal["users"]] returns Literal["api/v1/users"]
  • DeepPartial[T] - Make all fields recursively optional

    • Applies optional transformation to all nested types
    • Example: DeepPartial[User] makes all nested fields optional
  • Partial[T] - Make all fields optional (non-recursive)

    • Makes all top-level fields optional without recursion
    • Example: Partial[User] returns name: str | None, age: int | None
  • Required[T] - Remove Optional from all fields

    • Inverse operation of Partial
    • Example: Required[OptionalUser] removes | None from all fields
  • Pick[T, K] - Pick specific fields from a type

    • Creates a new type with only the specified fields
    • Example: Pick[User, tuple["name", "email"]]
  • Omit[T, K] - Omit specific fields from a type

    • Creates a new type excluding specified fields
    • Example: Omit[User, tuple["password"]]

Test Coverage

  • 155 tests passing
  • Full coverage for all new type utilities

Requirements

  • Python 3.14+
  • typing_extensions >= 4.0

Release 0.1.2

04 Mar 10:43

Choose a tag to compare

Include typemap_extensions in package build

Release 0.1.1

04 Mar 10:33

Choose a tag to compare

Fix: Export eval_typing from main package

Release 0.0.1

04 Mar 10:20

Choose a tag to compare

Initial release of typemap

  • PEP 827 type manipulation library
  • Includes eval_typing, Member, Attrs, Iter, Param, UpdateClass, NewProtocol, IsAssignable
  • Requires Python 3.14+