$npx skillfedfor your agent

optype

Building Blocks for Precise & Flexible Type Hints

Worth itPyPI Software DevelopmentReleased Jun 20263.9M downloads / moBSD-3-ClausePure Python

Decision gist · record as of 2026-08-14

pure-Python wheel — optype-0.18.0-py3-none-any.whl
v0.18.0 · released 2026-06-07 · Python >=3.12 · 1 runtime deps: typing-extensions

Yes. optype is actively maintained, has zero external dependencies beyond typing-extensions, carries no known vulnerabilities, and is BSD-3-Clause licensed. It solves a real problem—expressing exact operator requirements in type hints—that most projects encounter when writing generic or mathematical code. Install it if you write code that needs to accept objects based on what operations they support rather than their concrete type.AI-flagged interpretation of the facts on this page — verify before relying

Before you install

  • Requires Python 3.12 or later
  • Low install friction; pure Python wheel with only typing-extensions as a runtime dependency.
  • Actively maintained with recent releases and a live repository.

License · maintenance · safety

BSD-3-Clause (permissive) — BSD-3-Clause is permissive; you can use, modify, and distribute optype freely in commercial and open-source projects with minimal restrictions.

last release 2026-06-07 (68 days) · last repo commit 2026-08-13 · 94 stars

0 known vulnerabilities (OSV.dev, 2026-08-14) · 3,867,980 downloads/mo, #2,472 on PyPI

Verify before relying

pip install optype

from optype import SupportsAdd

def add_numbers(x: SupportsAdd, y: SupportsAdd) -> SupportsAdd:
    return x + y
  • Whether optional NumPy support requires additional setup or is automatically available
  • Specific type checker versions known to work best with optype
Same gist for agents: .md · .json

What it is and what it does

optype is a library for building precise type hints using single-method protocols and exact operator types. It lets you define what operations your code actually accepts—like SupportsAdd for anything that implements __add__—rather than forcing broad type categories. This bridges the gap between what your code needs and what type checkers can verify, working with mypy, pyright, and basedpyright.

The package is designed for developers who want type safety without fighting their type checker. It includes optional NumPy support and is built on typing-extensions, so it works across modern Python versions. The library is actively maintained, battle-tested, and carries no external dependencies beyond typing-extensions.

Use it for

  • Define generic numeric operations that accept anything supporting __add__, __mul__, etc., without forcing a specific numeric type
  • Write library code that accepts operator-compatible objects while rejecting incompatible subtypes
  • Build precise function signatures for scientific or mathematical code that needs exact protocol matching
  • Create type stubs or annotations for NumPy-adjacent code with proper operator typing
  • Improve type checker cooperation in codebases using mypy or pyright by expressing protocol requirements explicitly

Worth the install?

AI-flagged interpretation of the facts on this page. Verify before relying on it.

Worth it

Yes.

optype is actively maintained, has zero external dependencies beyond typing-extensions, carries no known vulnerabilities, and is BSD-3-Clause licensed. It solves a real problem—expressing exact operator requirements in type hints—that most projects encounter when writing generic or mathematical code. Install it if you write code that needs to accept objects based on what operations they support rather than their concrete type.

Install

optype on PyPI

Before you install

Low install friction; pure Python wheel with only typing-extensions as a runtime dependency. Actively maintained with recent releases and a live repository.

Requires Python 3.12 or later

License in practice

BSD-3-Clause is permissive; you can use, modify, and distribute optype freely in commercial and open-source projects with minimal restrictions.

Quickstart

pip install optype

from optype import SupportsAdd

def add_numbers(x: SupportsAdd, y: SupportsAdd) -> SupportsAdd:
    return x + y

Verify before relying

  • Whether optional NumPy support requires additional setup or is automatically available
  • Specific type checker versions known to work best with optype

Package facts

LicenseBSD-3-Clause permissive
Python supportSupports the current Python release >=3.12
Install frictionLow. Pure-Python wheel
Runtime dependencies
1 package
typing-extensions
MaintenanceActively maintained 68 days since the last release
Last repo commit
First released
Downloads3,867,980 / month, #2,472 on PyPI 30-day window, as of 2026-08-14
Known vulnerabilitiesNone known OSV.dev, checked 2026-08-14
Classifiers
Development Status :: 4 - BetaIntended Audience :: DevelopersIntended Audience :: Science/ResearchOperating System :: OS IndependentProgramming Language :: Python :: 3Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14Programming Language :: Python :: 3.15Topic :: Scientific/EngineeringTopic :: Software DevelopmentTyping :: Typed

Evidence: optype-0.18.0-py3-none-any.whl

Tags

Capabilities
type hints protocolsprecise type checkingdunder method protocolstyped operatorsmypy pyright supporttype annotation building blocksflexible type hints
Topics
type-hintsprotocolstype-checking
PyPI keywords
annotationsbasedpyrightcheckercheckinghintinghintsmypynumpynumpy-typing-compatpyrightprotocolsstubstypetypecheckingtypehintingtypehintstyping

Let your AI agent find packages like this

Example. Real query, live index.

You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.

wish › “type hints protocols”

  • optypeoptype provides single-method protocols and typed operators for…
  • useful-typesProvides reusable type protocols and aliases for Python projects to…
  • numeraryProvides runtime-checkable protocols and type hints for working with…

Give your agent the search over MCP, or paste the wish link into any chat.

More Software Development packages

typing-extensions Worth it
PyPI · Software Development · released Jul 2026

Provides backported and experimental type hints for Python 3.9+, allowing use of newer typing features on older Python versions and enabling early experimentation with type system PEPs before they enter the standard library.

PSF-2.0pure Python · 3.9+
1.9Bdownloads / mo
numpy Worth it
PyPI · Software Development · released Aug 2026

NumPy provides an N-dimensional array object and a comprehensive suite of mathematical, linear algebra, Fourier transform, and random number functions for scientific computing in Python.

BSD-3-Clause AND 0BSD AND MIT AND Zlib AND CC0-1.0compiled wheel · 3.12+
1.1Bdownloads / mo
fastapi Worth it
PyPI · Software Development · released Jul 2026

FastAPI is a Python web framework for building REST APIs using type hints, with automatic request validation, serialization, and interactive API documentation.

MITpure Python · 3.10+
568.6Mdownloads / mo
annotated-doc With conditions
PyPI · Software Development · released Jul 2026

Provides a way to document function parameters, class attributes, return types, and variables inline using Python's `Annotated` type hint syntax instead of traditional docstrings.

MITpure Python · 3.9+
456.2Mdownloads / mo
typer Worth it
PyPI · Software Development · released Aug 2026

Typer builds command-line applications from Python functions using type hints, automatically generating help text, argument parsing, and shell completion.

Install it if you are building CLIs in Python.

MITpure Python · 3.10+
369.3Mdownloads / mo
distlib With conditions
PyPI · Software Development · released Jun 2026

Distlib provides low-level packaging utilities for building, distributing, and managing Python software—including metadata handling, version specifiers, wheel support, script installation, and dependency resolution.

permissive licensepure Python
323.3Mdownloads / mo

See also types-docker · types-grpcio-reflection · types-paramiko · types-braintree · types-psycopg2 · types-assertpy · numerary · numpy-typing-compat · basedpyright