NobleBlocks

Research index

Type Enforced: A Python type enforcer for type annotations

Makowski, Guter, Russell

Zenodo (CERN European Organization for Nuclear Research)23 Sep 2025Open access

NobleIDark:/48914/w1/20260525/9E9D121BDOI10.5281/zenodo.17178137

Free to read at the publisher

You can read the abstract here, or the full text at the publisher.

Read at the publisher

Abstract

`type_enforced` is a pure Python package designed to enforce type annotations at runtime without the need for a special compiler. It provides an intuitive decorator-based interface that allows developers to enforce explicit typing constraints on function and method inputs, return types, dataclasses, and class instances. The package supports a comprehensive set of Python's built-in types, typing module constructs (such as `List`, `Dict`, `Union`, `Optional`, and `Literal`), nested data structures, and custom constraints. By offering runtime validation of type annotations and constraints, `type_enforced` enhances code reliability, readability, and maintainability.

Topics

More

Suggest a correction or report