Skip to content

pdshiltsov/strong

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

26 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

⚡ Strongpy

A simple runtime type checker for Python functions.

Version License Downloads

It validates function arguments and return values using type annotations.


🚀 Features

  • Runtime type checking for function arguments
  • Return type validation
  • Supports modern Python typing:
    • list[T]
    • dict[K, V]
    • tuple
    • set, frozenset
    • Union (|)
    • Literal

📦 Installation

pip install strongpy

or (using uv)

uv add strongpy

🧪 Usage

>>> from strongpy import strong

>>> @strong
... def add(x: int, y: int) -> int:
...     return x + y

>>> add(1, 2)
3

>>> add("1", 2)
Traceback (most recent call last):
  File "example.py", line 10, in <module>
    add("1", 2)
TypeError: argument 'x' expected int, got str

🧠 Supported types

  • int, str, float, bool
  • list[T]
  • dict[K, V]
  • tuple[T, ...]
  • set[T]
  • frozenset[T]
  • Union (int | str)
  • Literal
  • Any
  • Never
  • NoReturn

⚙️ Philosophy

Strong is designed to be:

  • simple
  • explicit
  • predictable

No magic, no runtime inference — only annotations.


🐍 Requirements

  • Python ≥ 3.13

📌 License

MIT

About

Simple runtime type checker for Python functions using type annotations.

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Languages