{"categories":[{"label":"Software Development","url":"https://skillfed.io/packages/category/software-development/3"},{"label":"Scientific/Engineering","url":"https://skillfed.io/packages/category/scientific-engineering/2"}],"enrichment":{"capability":"optype provides single-method protocols and typed operators for precise type hints, letting you express exact types that reject sneaky subtypes and work cooperatively with type checkers like mypy and pyright.","skillfed_tags":["type-hints","protocols","type-checking"],"use_cases":["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"],"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\u2014like SupportsAdd for anything that implements __add__\u2014rather 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.\n\nThe 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.","worth_installing":"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\u2014expressing exact operator requirements in type hints\u2014that 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."},"id":"optype","links":{"html":"https://skillfed.io/packages/optype","md":"https://skillfed.io/packages/optype.md","pypi":"https://pypi.org/project/optype/"},"maintenance":{"status":"active"},"meta":{"latest_release":"2026-06-07","license_spdx":"BSD-3-Clause","license_treatment":"permissive","name":"optype","python_support":"supports_current","summary":"Building Blocks for Precise & Flexible Type Hints"},"popularity":{"monthly_downloads":3867980,"position":2472,"tier":"top_5000"},"security":{"n_vulnerabilities":0},"version":"0.18.0"}
