optype 0.16.0
Building Blocks for Precise & Flexible Type Hints
Requires Python: >=3.11
Keywords: annotations, basedpyright, checker, checking, hinting, hints, mypy, numpy, numpy-typing-compat, pyright, protocols, stubs, type, typechecking, typehinting, typehints, typing

<h1 align="center">optype</h1>

<p align="center"><strong>Building blocks for precise type hints</strong></p>

<p align="center">
<a href="https://github.com/jorenham/optype"><img alt="GitHub License" src="https://img.shields.io/github/license/jorenham/optype?style=flat-square&color=121d2f&labelColor=3d444d"></a>
<a href="https://pypi.org/project/optype"><img alt="PyPI Version" src="https://img.shields.io/pypi/v/optype?style=flat-square&color=121d2f&labelColor=3d444d"></a>
<a href="https://anaconda.org/conda-forge/optype"><img alt="Conda Version" src="https://img.shields.io/conda/vn/conda-forge/optype?style=flat-square&color=121d2f&labelColor=3d444d"></a>
<a href="https://github.com/jorenham/optype"><img alt="Python Versions" src="https://img.shields.io/pypi/pyversions/optype?style=flat-square&color=121d2f&labelColor=3d444d"></a>
<a href="https://pypi.org/project/optype"><img alt="PyPI Downloads" src="https://img.shields.io/pypi/dm/optype?style=flat-square&color=121d2f&labelColor=3d444d&cacheSeconds=86400"></a>
</p>

<p align="center">
<a href="https://github.com/numpy/numpy"><img alt="ruff" src="https://img.shields.io/badge/numpy-262c36?style=flat-square&logo=numpy"></a>
<a href="https://detachhead.github.io/basedpyright"><img alt="basedpyright" src="https://img.shields.io/endpoint?url=https://docs.basedpyright.com/latest/badge.json&style=flat-square&color=262c36&labelColor=262c36"></a>
<a href="https://github.com/python/mypy"><img alt="mypy" src="https://img.shields.io/badge/mypy-262c36?style=flat-square&logo=python"></a>
<a href="https://github.com/facebook/pyrefly"><img alt="pyrefly" src="https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/facebook/pyrefly/refs/heads/main/website/static/badge.json&style=flat-square&color=262c36&labelColor=262c36"></a>
<a href="https://github.com/astral-sh/ty"><img alt="ruff" src="https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ty/main/assets/badge/v0.json&style=flat-square&color=262c36&labelColor=262c36"></a>
<a href="https://github.com/astral-sh/ruff"><img alt="ruff" src="https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json&style=flat-square&color=262c36&labelColor=262c36"></a>
</p>

<p align="center">
  <a href="https://github.com/jorenham/optype"><strong>GitHub</strong></a>
  &middot;
  <a href="https://jorenham.github.io/optype/installation/"><strong>Installation</strong></a>
  &middot;
  <a href="https://jorenham.github.io/optype/getting-started/"><strong>Getting Started</strong></a>
  &middot;
  <a href="https://jorenham.github.io/optype/reference/"><strong>API Reference</strong></a>
  &middot;
  <a href="https://github.com/jorenham/optype/releases"><strong>Changelog</strong></a>
</p>

<p align="center">
  Stop fighting your type checker &mdash; work <em>with</em> it.<br>
  <code>optype</code> gives you single-method protocols for every dunder,
  exact types that reject sneaky subtypes, and typed operators that actually
  make sense &mdash; so you can express what your code <em>really</em> accepts.<br>
</p>
<p align="center">
  Zero dependencies. Works with every modern type checker. Optional NumPy support included. Battle tested.
</p>

<p align="center">
  <em>
    Visit the documentation at
    <a href="https://jorenham.github.io/optype/">jorenham.github.io/optype</a>.
  </em>
</p>