NewYour coding agent can read the release notes before it upgrades.Set up the MCP server →
PyPI
PyPI, #2089 most downloaded on PyPI
Building Blocks for Precise & Flexible Type Hints
Latest stable
0.19.0
Last release 1 months ago
02 Oct 2026
Release timing varies
gaps range from 9 days to 4 months
Nearly every release is documented
notes for 33 of 34 stable releases
3 versions withdrawn
withdrawn after publishing
3 years old
37 releases · first in 2024
Drag across the ruler to compare, or tap a release to open it.
…method descriptors, template strings, @deprecated, NumPy, and the Python 3.15 sentinel and frozendict
optype infer grew from a prototype into a much more complete type inference tool (docs):
--format compat output (backend="compat" in Python) that emits a type-checkable .pyi stub$ optype infer --format compat "def f(x, y=1): return x + y"
from typing import Literal, overload
from optype import CanAdd, CanRAdd
@overload
def f[R, T = Literal[1]](x: CanAdd[T, R], y: T = 1) -> R: ...
@overload
def f[T, R](x: T, y: CanRAdd[T, R] = 1) -> R: ...
*args and **kwargs, async functions, generators, context managers, overloads, class attributes, method descriptors, template strings, @deprecated, NumPy, and the Python 3.15 sentinel and frozendictstrict=True option that raises an InferError instead of emitting an InferWarning when the signature is incompleteoptype protocols: CanInstancecheck, CanSubclasscheck, CanRPow3, Can{Lt,Le,Gt,Ge}Same, and HasObjclass (docs)optype.numpy types: Array4D, MArray4D, CanArray4D, ToArray4D, and ToArrayStrict4D (docs)<!-- Release notes generated using configuration in .github/release.yml at v0.19.0 -->
optypeHasObjclass protocol by @jorenham in https://github.com/jorenham/optype/pull/661CanInstancecheck and CanSubclasscheck by @jorenham in https://github.com/jorenham/optype/pull/662CanRPow3 by @jorenham in https://github.com/jorenham/optype/pull/757optype.Has* attribute protocols by @jorenham in https://github.com/jorenham/optype/pull/807Can{Lt,Le,Gt,Ge}Same by @jorenham in https://github.com/jorenham/optype/pull/810optype.numpyoptype infer: numpy support by @jorenham in https://github.com/jorenham/optype/pull/621numpy>=2.5 by @jorenham in https://github.com/jorenham/optype/pull/799optype.numpy.ctypeslib reference page by @Aniketsy in https://github.com/jorenham/optype/pull/581numpy: add Array4D and its 4-d siblings by @jorenham in https://github.com/jorenham/optype/pull/905optype.inferoptype infer: async support by @jorenham in https://github.com/jorenham/optype/pull/622optype infer: support for direct def (...): ... eval by @jorenham in https://github.com/jorenham/optype/pull/623optype infer: generators, and some code cleanup by @jorenham in https://github.com/jorenham/optype/pull/628optype infer: empty containers by @jorenham in https://github.com/jorenham/optype/pull/630optype infer: code cleanup and minor improvements by @jorenham in https://github.com/jorenham/optype/pull/631optype infer: simplify unions of subtypes by @jorenham in https://github.com/jorenham/optype/pull/632optype infer: support for *args and **kwargs by @jorenham in https://github.com/jorenham/optype/pull/633optype infer: parameter defaults by @jorenham in https://github.com/jorenham/optype/pull/634optype infer: avoid redundant & CanLen by @jorenham in https://github.com/jorenham/optype/pull/635optype infer: restructure modules by @jorenham in https://github.com/jorenham/optype/pull/636optype infer: method descriptors by @jorenham in https://github.com/jorenham/optype/pull/647infer: improved docs by @jorenham in https://github.com/jorenham/optype/pull/648infer: higher order function types by @jorenham in https://github.com/jorenham/optype/pull/652infer: CanWith and CanAsyncWith by @jorenham in https://github.com/jorenham/optype/pull/653infer: CanSequence by @jorenham in https://github.com/jorenham/optype/pull/654infer: Python 3.15 sentinel and frozendict support by @jorenham in https://github.com/jorenham/optype/pull/655infer: hide pos-only param names by @jorenham in https://github.com/jorenham/optype/pull/656infer: non-optypean protocols by @jorenham in https://github.com/jorenham/optype/pull/658infer: release changelog section for optype.infer by @jorenham in https://github.com/jorenham/optype/pull/659infer: class attributes by @jorenham in https://github.com/jorenham/optype/pull/660infer: Can{Instance,Subclass}check support and code cleanup by @jorenham in https://github.com/jorenham/optype/pull/664infer: KeyError on weakref.proxy by @jorenham in https://github.com/jorenham/optype/pull/673infer: invalid parameter names from docstring examples by @jorenham in https://github.com/jorenham/optype/pull/674infer: target exceptions escape instead of InferError by @jorenham in https://github.com/jorenham/optype/pull/676infer: recursive container types by @jorenham in https://github.com/jorenham/optype/pull/675infer: deterministic __len__, __int__, and __index__ branching by @jorenham in https://github.com/jorenham/optype/pull/681infer: non-deterministic literal rendering of concrete returns by @jorenham in https://github.com/jorenham/optype/pull/679infer: collapse repeated subexpressions by @jorenham in https://github.com/jorenham/optype/pull/680infer: variadic unpacking by @jorenham in https://github.com/jorenham/optype/pull/691infer: non-greedy overloaded signature exploration by @jorenham in https://github.com/jorenham/optype/pull/692infer: stable __bool__ and related branching truthiness dunders by @jorenham in https://github.com/jorenham/optype/pull/693infer: yield 2 items by default by @jorenham in https://github.com/jorenham/optype/pull/694infer: variadic callable parameter unpacking by @jorenham in https://github.com/jorenham/optype/pull/697infer: fix zip return type by @jorenham in https://github.com/jorenham/optype/pull/698infer: refactor by @jorenham in https://github.com/jorenham/optype/pull/699infer: EllipsisType by @jorenham in https://github.com/jorenham/optype/pull/702infer: unwrap GenericAlias and TypeForm support by @jorenham in https://github.com/jorenham/optype/pull/703infer: support all types types by @jorenham in https://github.com/jorenham/optype/pull/706infer: reraise exceptions by @jorenham in https://github.com/jorenham/optype/pull/707infer: @deprecated by @jorenham in https://github.com/jorenham/optype/pull/709infer: fix overly-narrow format string literals by @jorenham in https://github.com/jorenham/optype/pull/711infer: dedicated optype infer CLI docs by @jorenham in https://github.com/jorenham/optype/pull/712infer: strict mode by @jorenham in https://github.com/jorenham/optype/pull/713infer: presence-dispatch overloads by @jorenham in https://github.com/jorenham/optype/pull/714infer: code cleanup by @jorenham in https://github.com/jorenham/optype/pull/715infer: signature probing by @jorenham in https://github.com/jorenham/optype/pull/717infer: some refactoring by @jorenham in https://github.com/jorenham/optype/pull/718infer: stop using unions in isinstance by @jorenham in https://github.com/jorenham/optype/pull/719infer: fix second next and anext overloads by @jorenham in https://github.com/jorenham/optype/pull/720infer: 3-arg range inference by @jorenham in https://github.com/jorenham/optype/pull/725infer: generic slice builtin by @jorenham in https://github.com/jorenham/optype/pull/726infer: generic itertools types by @jorenham in https://github.com/jorenham/optype/pull/729infer: generic functools types by @jorenham in https://github.com/jorenham/optype/pull/730infer: better isinstance/issubclass inference by @jorenham in https://github.com/jorenham/optype/pull/732infer: catch KeyErrors by @jorenham in https://github.com/jorenham/optype/pull/740infer: fix non-termination by @jorenham in https://github.com/jorenham/optype/pull/743infer: unwrap TypeAliasType by @jorenham in https://github.com/jorenham/optype/pull/745infer: absorb empty container types by @jorenham in https://github.com/jorenham/optype/pull/746ignore: handle SystemExit by @jorenham in https://github.com/jorenham/optype/pull/747infer: fix __buffer__ GC issues by @jorenham in https://github.com/jorenham/optype/pull/748infer: render backend interface by @jorenham in https://github.com/jorenham/optype/pull/749infer: new .pyi-compatible rendering backend by @jorenham in https://github.com/jorenham/optype/pull/750infer: syntax highlighting for --format=compat by @jorenham in https://github.com/jorenham/optype/pull/752infer: template strings by @jorenham in https://github.com/jorenham/optype/pull/753infer: subprocess isolation by @jorenham in https://github.com/jorenham/optype/pull/754infer: fix outdated function -> FunctionType references by @jorenham in https://github.com/jorenham/optype/pull/755infer: signature simplification by @jorenham in https://github.com/jorenham/optype/pull/756infer: >2x faster inference by @jorenham in https://github.com/jorenham/optype/pull/758infer: refactor some by @jorenham in https://github.com/jorenham/optype/pull/759infer: improved performance (~2x faster) by @jorenham in https://github.com/jorenham/optype/pull/760infer: legacy CPython __text_signature__ support by @jorenham in https://github.com/jorenham/optype/pull/780infer: fix enum and *args rendering by @jorenham in https://github.com/jorenham/optype/pull/781infer: fix missing module prefixes and imports by @jorenham in https://github.com/jorenham/optype/pull/783infer: fix collections.Counter arity by @jorenham in https://github.com/jorenham/optype/pull/797infer: isolate all funciton calls and avoid phantom calls to spy __repr__ by @jorenham in https://github.com/jorenham/optype/pull/798infer: improved process isolation by @jorenham in https://github.com/jorenham/optype/pull/801infer: fix TypeError when inferring asyncio.run by @jorenham in https://github.com/jorenham/optype/pull/802infer: fix NameError when inspecting PEP 649 signatures by @jorenham in https://github.com/jorenham/optype/pull/803infer: fix internal _Spy signature render leaks by @jorenham in https://github.com/jorenham/optype/pull/805infer: code cleanup by @jorenham in https://github.com/jorenham/optype/pull/808infer: more code cleanup by @jorenham in https://github.com/jorenham/optype/pull/809infer: dealing with functions that block >1 minute by @jorenham in https://github.com/jorenham/optype/pull/814infer: refactor infer._gc as a singleton class by @jorenham in https://github.com/jorenham/optype/pull/815infer: less crappy docs by @jorenham in https://github.com/jorenham/optype/pull/816infer: improve code quality by @jorenham in https://github.com/jorenham/optype/pull/817infer: remove typing.cast calls by @jorenham in https://github.com/jorenham/optype/pull/818infer: code cleanup by @jorenham in https://github.com/jorenham/optype/pull/838infer: keep @deprecated on dispatch fallbacks and generators by @jorenham in https://github.com/jorenham/optype/pull/839infer: simplify renderer classes by @jorenham in https://github.com/jorenham/optype/pull/840infer: fix generic protocol bounds in compat by @jorenham in https://github.com/jorenham/optype/pull/842infer: elide non-finite float defaults by @jorenham in https://github.com/jorenham/optype/pull/852infer: keep a shared dependency out of the loop fold by @jorenham in https://github.com/jorenham/optype/pull/853infer: dedupe type nodes by equality by @jorenham in https://github.com/jorenham/optype/pull/847infer: fix attribute lowering in compat by @jorenham in https://github.com/jorenham/optype/pull/843infer: substitute eliminated binders in compat by @jorenham in https://github.com/jorenham/optype/pull/845infer: print positional-only __call__ defaults in compat by @jorenham in https://github.com/jorenham/optype/pull/846infer: order a typevar tuple behind defaulted type parameters in compat by @jorenham in https://github.com/jorenham/optype/pull/851infer: respect declared variance for all-Never arguments by @jorenham in https://github.com/jorenham/optype/pull/848infer: rename only type parameters in alpha_equal by @jorenham in https://github.com/jorenham/optype/pull/856infer: compare callable keywords and defaults in subtype by @jorenham in https://github.com/jorenham/optype/pull/850infer: join repeated protocol bases in compat by @jorenham in https://github.com/jorenham/optype/pull/854infer: name the arity forms of round and pow in compat by @jorenham in https://github.com/jorenham/optype/pull/861infer: decide typevar defaults up to typevar naming by @jorenham in https://github.com/jorenham/optype/pull/859infer: alias an import that a property name shadows in compat by @jorenham in https://github.com/jorenham/optype/pull/863infer: join protocol requirements before lowering them in compat by @jorenham in https://github.com/jorenham/optype/pull/862infer: overload __pow__ for two exponents in compat by @jorenham in https://github.com/jorenham/optype/pull/865infer: report a target-raised KeyboardInterrupt as an InferError by @jorenham in https://github.com/jorenham/optype/pull/867infer: detach the isolated child from the host's stdio by @jorenham in https://github.com/jorenham/optype/pull/868infer: treat a mapping that raises when read as a leaf by @jorenham in https://github.com/jorenham/optype/pull/870infer: name the type in an empty InferError message, cut a long one by @jorenham in https://github.com/jorenham/optype/pull/871infer: split the stdio detachment out of the isolate child by @jorenham in https://github.com/jorenham/optype/pull/876infer: fall back to the text signature when inspect cannot evaluate a default by @jorenham in https://github.com/jorenham/optype/pull/874infer: restore the trace and profile hooks after each explored call by @jorenham in https://github.com/jorenham/optype/pull/872infer: clean up dead code and duplicated helpers by @jorenham in https://github.com/jorenham/optype/pull/877infer: split the non-corpus tests out of test_infer.py by @jorenham in https://github.com/jorenham/optype/pull/878infer: align the internal names with the typing jargon by @jorenham in https://github.com/jorenham/optype/pull/880infer: remove redundant dispatch, flags, and fields by @jorenham in https://github.com/jorenham/optype/pull/881infer: drop a callback, a field, and an unreachable branch by @jorenham in https://github.com/jorenham/optype/pull/882infer: accept an unhashable callable by @jorenham in https://github.com/jorenham/optype/pull/883infer: remove issue numbers and separators from comments by @jorenham in https://github.com/jorenham/optype/pull/885infer: drop the backend classes, a wrapper, and five constants by @jorenham in https://github.com/jorenham/optype/pull/886infer: stop compat from repeating a union member by @jorenham in https://github.com/jorenham/optype/pull/887infer: let resolve_defaults return the signatures by @jorenham in https://github.com/jorenham/optype/pull/888infer: stop rebuilding mapping results with their class by @jorenham in https://github.com/jorenham/optype/pull/889infer: remove numpy special-casing by @jorenham in https://github.com/jorenham/optype/pull/895infer: improve test runs (skip wasted gc sweeps in fork children) by @jorenham in https://github.com/jorenham/optype/pull/901infer: key representatives on the owner's representative, not its nested shape by @jorenham in https://github.com/jorenham/optype/pull/903infer: render the omitted-defaults exploration once by @jorenham in https://github.com/jorenham/optype/pull/904optype.inspectinfer: generic type[T] by @jorenham in https://github.com/jorenham/optype/pull/649infer: fix functools.reduce by @jorenham in https://github.com/jorenham/optype/pull/731infer: unit test Signature by @jorenham in https://github.com/jorenham/optype/pull/841infer: simplify compat backend by @jorenham in https://github.com/jorenham/optype/pull/898infer: some more simplifications (behavior preserving) by @jorenham in https://github.com/jorenham/optype/pull/900zensical to 0.0.50 by @jorenham in https://github.com/jorenham/optype/pull/788ty to 0.0.59 by @jorenham in https://github.com/jorenham/optype/pull/793pytest to 9.1.1 by @jorenham in https://github.com/jorenham/optype/pull/794pyrefly to 1.2.0-dev.2 by @jorenham in https://github.com/jorenham/optype/pull/795typing_extensions py315 workaround by @jorenham in https://github.com/jorenham/optype/pull/827pyrefly coverage instead of basedpyright --verifytypes by @samwgoldman in https://github.com/jorenham/optype/pull/890pytest-xdist by @jorenham in https://github.com/jorenham/optype/pull/902python==3.14 + numpy==2.2 CI job (no wheels) by @jorenham in https://github.com/jorenham/optype/pull/804Full Changelog: https://github.com/jorenham/optype/compare/v0.18.0...v0.19.0
Your coding agent can read these notes before it upgrades. Set up the MCP server →
Removed the deprecated optype.typing.Just* re-exports in favor of optype.Just*.
optype infer command for structural runtime type inference (docs)$ optype infer "import math; math.sqrt"
(x: CanFloat | CanIndex) -> float
$ optype infer "lambda x: x * 2"
[R](x: CanMul[Literal[2], R]) -> R
$ optype infer "lambda x: -x + x"
[T: CanNeg[CanAdd[T, R]], R](x: T) -> R
[T, R](x: CanNeg[T] & CanRAdd[T, R]) -> R
optype.numpy.To* array-like types with beartype.optype.typing.Just* re-exports in favor of optype.Just*.<!-- Release notes generated using configuration in .github/release.yml at v0.18.0 -->
optype.inferoptype infer 🧙 by @jorenham in https://github.com/jorenham/optype/pull/620optype.numpynumpy-typing-compat to v20260602 by @jorenham in https://github.com/jorenham/optype/pull/610numpy.To*: artisanal beartype support by @jorenham in https://github.com/jorenham/optype/pull/604optype.typingoptype.typing.Just* re-exports by @jorenham in https://github.com/jorenham/optype/pull/601lefthook.yml -> .lefthook.yml by @jorenham in https://github.com/jorenham/optype/pull/615Full Changelog: https://github.com/jorenham/optype/compare/v0.17.1...v0.18.0
This release addresses an issue in the CanRound and CanRound2 protocols.
This release addresses an issue in the CanRound and CanRound2 protocols.
<!-- Release notes generated using configuration in .github/release.yml at v0.17.1 -->
optypefloat <: CanRound2[int, float] by @jorenham in https://github.com/jorenham/optype/pull/597do_round: (float, int) -> float by @jorenham in https://github.com/jorenham/optype/pull/598optype.numpy.ToJustInt64* by @jorenham in https://github.com/jorenham/optype/pull/580zensical --strict and fix errors by @jorenham in https://github.com/jorenham/optype/pull/589mypy_primer to avoid breaking downstream libraries by @Aniketsy in https://github.com/jorenham/optype/pull/583Full Changelog: https://github.com/jorenham/optype/compare/v0.17.0...v0.17.1
<!-- Release notes generated using configuration in .github/release.yml at v0.17.0 -->
<!-- Release notes generated using configuration in .github/release.yml at v0.17.0 -->
optype.JustAny type that only accepts Any (docs)optype.dataclasses.HasDataclassFields, and turn __dataclass_fields__ into a ClassVar. This fixes an assignability issue with dataclass instances.optypeoptype.JustAny by @jorenham in https://github.com/jorenham/optype/pull/545optype.dataclassesdataclasses: remove HasDataclassFields type parameter, use ClassVar by @nstarman in https://github.com/jorenham/optype/pull/548<details> <summary>4 pull requests</summary>
</details>
Full Changelog: https://github.com/jorenham/optype/compare/v0.16.0...v0.17.0
documentation: https://jorenham.github.io/optype/
<!-- Release notes generated using configuration in .github/release.yml at v0.16.0 -->
<!-- Release notes generated using configuration in .github/release.yml at v0.16.0 -->
optype.test module (docs)optype.dataclasses.HasDataclassFields (docs) can now be used in issubclassImportError in optype.typing (docs) on Python 3.13+ when typing_extensions is not installedoptype.numpyoptype.dataclassesoptype.testoptype.test module by @jorenham in https://github.com/jorenham/optype/pull/544optype.typingoptype.typing: fix ImportError without typing_extensions on python>=3.13 by @jorenham in https://github.com/jorenham/optype/pull/526ty 0.0.6 and basedpyright 1.36.2 by @jorenham in https://github.com/jorenham/optype/pull/498uv_build to 0.10 by @jorenham in https://github.com/jorenham/optype/pull/523dprint config update workflow by @jorenham in https://github.com/jorenham/optype/pull/536.gitattributes for better handling of lockfile merge conflicts by @jorenham in https://github.com/jorenham/optype/pull/517typos==1.43.0 by @jorenham in https://github.com/jorenham/optype/pull/521Full Changelog: https://github.com/jorenham/optype/compare/v0.15.0...v0.16.0
BREAKING: Certain optype.Can* generic type-parameters intended for literal types have been removed. This affects the following protocols:
BREAKING: Certain optype.Can* generic type-parameters intended for literal types have been removed. This affects the following protocols:
CanBytesCanStrCanIndexCanReprCanFormatCanDelattrCanLenCanLengthHintCanBufferCanGetattrCanSetattrCanSetNameCanContainsCanSequenceSee https://github.com/jorenham/optype/pull/487 for more information.
Preliminary support for the ty type-checker (currently in alpha) in https://github.com/jorenham/optype/pull/489.
Preliminary support for the upcoming NumPy 2.4 release.
uv_build to 0.9 by @jorenham in https://github.com/jorenham/optype/pull/469Full Changelog: https://github.com/jorenham/optype/compare/v0.14.0...v0.15.0
<!-- Release notes generated using configuration in .github/release.yml at v0.14.0 -->
<!-- Release notes generated using configuration in .github/release.yml at v0.14.0 -->
optype.copy.CanReplace protocoloptype.numpy.CanArray0 protocol that accepts both scalars and 0-d arraysoptype.numpy.ctypeslib improvementsoptype.numpyoptype.numpy.To* to use TypeAliasType by @jorenham in https://github.com/jorenham/optype/pull/444optype.numpy.ctypes: simplify Object and always use TypeAliasType by @jorenham in https://github.com/jorenham/optype/pull/446optype.numpy.ctypes: no complex C-types on windows by @jorenham in https://github.com/jorenham/optype/pull/447optype.numpy.ctypes tests by @jorenham in https://github.com/jorenham/optype/pull/449optype.numpy.ctypes: simplified abstract numeric aliases by @jorenham in https://github.com/jorenham/optype/pull/450optype.numpy.CanArray0 by @jorenham in https://github.com/jorenham/optype/pull/454optype.copycopy.CanReplace type parameter by @jorenham in https://github.com/jorenham/optype/pull/439copy.CanReplace docs by @jorenham in https://github.com/jorenham/optype/pull/441pyrefly to 0.35.0 by @jorenham in https://github.com/jorenham/optype/pull/453Full Changelog: https://github.com/jorenham/optype/compare/v0.13.4...v0.14.0
<!-- Release notes generated using configuration in .github/release.yml at v0.13.4 -->
<!-- Release notes generated using configuration in .github/release.yml at v0.13.4 -->
optype.numpynumpy-typing-compat to v20250818 in the numpy extra by @jorenham in https://github.com/jorenham/optype/pull/421optype-numpy package by @jorenham in https://github.com/jorenham/optype/pull/422Full Changelog: https://github.com/jorenham/optype/compare/v0.13.3...v0.13.4
This patch release adds an upper version bound for numpy-typing-compat to prevent potential compatibility issues with future releases.
This patch release adds an upper version bound for numpy-typing-compat to prevent potential compatibility issues with future releases.
<!-- Release notes generated using configuration in .github/release.yml at v0.13.3 -->
optype.numpynumpy-typing-compat by @jorenham in https://github.com/jorenham/optype/pull/414numpy-typing-compat versioning by @jorenham in https://github.com/jorenham/optype/pull/418Full Changelog: https://github.com/jorenham/optype/compare/v0.13.2...v0.13.3
This is a bugfix release that addresses a permission issue in the built wheels that was caused by https://github.com/astral-sh/uv/issues/14920.
This is a bugfix release that addresses a permission issue in the built wheels that was caused by https://github.com/astral-sh/uv/issues/14920.
<!-- Release notes generated using configuration in .github/release.yml at v0.13.2 -->
astral-sh/setup-uv to 6.5.0 by @jorenham in https://github.com/jorenham/optype/pull/413Full Changelog: https://github.com/jorenham/optype/compare/v0.13.1...v0.13.2
<!-- Release notes generated using configuration in .github/release.yml at v0.13.1 -->
<!-- Release notes generated using configuration in .github/release.yml at v0.13.1 -->
optype.numpyCanArrayStrict{1,2,3}D by @jorenham in https://github.com/jorenham/optype/pull/407Full Changelog: https://github.com/jorenham/optype/compare/v0.13.0...v0.13.1
<!-- Release notes generated using configuration in .github/release.yml at v0.13.0 -->
<!-- Release notes generated using configuration in .github/release.yml at v0.13.0 -->
[!IMPORTANT] To ensure static typing compatibility with the SPEC 0 NumPy versions,
optype.numpynow requiresnumpy-typing-compat. It will automatically be installed with theoptype[numpy]extra.
optype.numpynumpy-typing-compat by @jorenham in https://github.com/jorenham/optype/pull/394AnyLongDouble* compatible with numpy<2.2 by @jorenham in https://github.com/jorenham/optype/pull/395Any[U]IntPDType compatible with numpy<2.2 by @jorenham in https://github.com/jorenham/optype/pull/396numpy-typing-compat by @jorenham in https://github.com/jorenham/optype/pull/399numpy==2.0.* in the testing matrix by @jorenham in https://github.com/jorenham/optype/pull/401np.ndarray instead of CanArray in To*Strict{1,2,3}D on numpy<2.1 by @jorenham in https://github.com/jorenham/optype/pull/400numpy-typing-compat / numpy version mismatch by @jorenham in https://github.com/jorenham/optype/pull/403numpy-typing-compat to v20250730 by @jorenham in https://github.com/jorenham/optype/pull/404numpy-typing-compat by @jorenham in https://github.com/jorenham/optype/pull/405Full Changelog: https://github.com/jorenham/optype/compare/v0.12.2...v0.13.0
<!-- Release notes generated using configuration in .github/release.yml at v0.12.2 -->
<!-- Release notes generated using configuration in .github/release.yml at v0.12.2 -->
Full Changelog: https://github.com/jorenham/optype/compare/v0.12.1...v0.12.2
<!-- Release notes generated using configuration in .github/release.yml at v0.12.1 -->
<!-- Release notes generated using configuration in .github/release.yml at v0.12.1 -->
optype.Can*Can*Same[-T?, +R?] with -> Self | R by @jorenham in https://github.com/jorenham/optype/pull/379CanI*Same inplace operator protocols by @jorenham in https://github.com/jorenham/optype/pull/381Can*Self arithmetic unary operator protocols by @jorenham in https://github.com/jorenham/optype/pull/382Can* tests to a more appropriate testing module @jorenham in https://github.com/jorenham/optype/pull/384dprint by @jorenham in https://github.com/jorenham/optype/pull/374tox-uv & more tox envs by @jorenham in https://github.com/jorenham/optype/pull/375lefthook as git hooks manager by @jorenham in https://github.com/jorenham/optype/pull/377ruff to 0.12.4 by @jorenham in https://github.com/jorenham/optype/pull/370_core/_do.py to tests/do.py by @jorenham in https://github.com/jorenham/optype/pull/378uv build backend by @jorenham in https://github.com/jorenham/optype/pull/387Full Changelog: https://github.com/jorenham/optype/compare/v0.12.0...v0.12.1
<!-- Release notes generated using configuration in .github/release.yml at v0.12.0 -->
<!-- Release notes generated using configuration in .github/release.yml at v0.12.0 -->
optypeCan*Self binop protocols by @jorenham in https://github.com/jorenham/optype/pull/348Can binop return type param defaults to input param by @jorenham in https://github.com/jorenham/optype/pull/356Just type-checker compatibility notice by @jorenham in https://github.com/jorenham/optype/pull/357TypeVar naming scheme for the Can* protocols by @jorenham in https://github.com/jorenham/optype/pull/358CanGetSelf[-T, +V] alias for CanGet[T, V, Self] by @jorenham in https://github.com/jorenham/optype/pull/359Can*Same binop protocols by @jorenham in https://github.com/jorenham/optype/pull/362optype.numpyoptype.numpy.Array* type alias docstring fixes by @jorenham in https://github.com/jorenham/optype/pull/353optype.numpy.CanArrayND: remove scalar type parameter default by @jorenham in https://github.com/jorenham/optype/pull/354optype.numpy.compat extended precision inexact types by @jorenham in https://github.com/jorenham/optype/pull/363optype.numpy.To* array-like alias simplifications by @jorenham in https://github.com/jorenham/optype/pull/364optype.numpy array-like types for float16, float32, and complex64 by @jorenham in https://github.com/jorenham/optype/pull/365optype.numpy.ToJust[C]LongDouble* array-like type aliases by @jorenham in https://github.com/jorenham/optype/pull/366mypy to 1.17.0 by @jorenham in https://github.com/jorenham/optype/pull/350basedpyright to 1.30.1 by @jorenham in https://github.com/jorenham/optype/pull/351ruff to 1.12.3 by @jorenham in https://github.com/jorenham/optype/pull/352basedpyright to 1.31.0 by @jorenham in https://github.com/jorenham/optype/pull/367Full Changelog: https://github.com/jorenham/optype/compare/v0.11.0...v0.12.0
<!-- Release notes generated using configuration in .github/release.yml at v0.11.0 -->
<!-- Release notes generated using configuration in .github/release.yml at v0.11.0 -->
optype.numpyoptype.numpy fixes on older numpy versions by @jorenham in https://github.com/jorenham/optype/pull/336optype.numpy.AnyFloat64DType without None by @jorenham in https://github.com/jorenham/optype/pull/346ruff to 0.12.2 by @jorenham in https://github.com/jorenham/optype/pull/341mypy to 1.16.1 by @jorenham in https://github.com/jorenham/optype/pull/342basedpyright to 1.30.0 (pyright 1.1.403) by @jorenham in https://github.com/jorenham/optype/pull/343tox to 4.27.0 by @jorenham in https://github.com/jorenham/optype/pull/344pytest to 8.4.1 by @jorenham in https://github.com/jorenham/optype/pull/345github.ref instead of github.sha in the concurrency.group of CI by @jorenham in https://github.com/jorenham/optype/pull/337Full Changelog: https://github.com/jorenham/optype/compare/v0.10.0...v0.11.0
<!-- Release notes generated using configuration in .github/release.yml at v0.10.0 -->
<!-- Release notes generated using configuration in .github/release.yml at v0.10.0 -->
optype.numpynumpy shape axes by @jorenham in https://github.com/jorenham/optype/pull/317numpy >= 1.25 by @jorenham in https://github.com/jorenham/optype/pull/320NBitBase in optype.numpy.compat by @jorenham in https://github.com/jorenham/optype/pull/326ToJustInt64 numpy array-like aliases for int64 by @jorenham in https://github.com/jorenham/optype/pull/328numpy.CanArrayFunction contravariance assignability fix by @jorenham in https://github.com/jorenham/optype/pull/331optype.numpy.SequenceND compatibility with numpy by @jorenham in https://github.com/jorenham/optype/pull/332ruff to 0.11.4 by @jorenham in https://github.com/jorenham/optype/pull/310python >= 3.11 by @jorenham in https://github.com/jorenham/optype/pull/322ruff to 0.11.11 by @jorenham in https://github.com/jorenham/optype/pull/327scientific-python/repo-review to v0.12.2 by @jorenham in https://github.com/jorenham/optype/pull/324astral-sh/setup-uv to v6 by @jorenham in https://github.com/jorenham/optype/pull/311Full Changelog: https://github.com/jorenham/optype/compare/v0.9.3...v0.10.0
<!-- Release notes generated using configuration in .github/release.yml at v0.9.3 -->
<!-- Release notes generated using configuration in .github/release.yml at v0.9.3 -->
This bugfix release addresses an issue where the 2- and 3-d optype.numpy array-like type aliases were not assignable to their *ND variants, e.g.:
import numpy as np
import optype.numpy as onp
def fn(x: onp.ToFloatND) -> int:
return np.asarray(x).size
def f2(x: onp.ToFloat2D) -> int:
return fn(x) # will no longer be rejected
This additionally works around an issue in typing_extensions==4.13.0 that results in a TypeError being raised when taking the union of typing.TypeAliasType and typing_extension.TypeAliasType on (at least) Python 3.12.
optype.numpyTo{}(2|3)D not being assignable to To{}ND by @jorenham in https://github.com/jorenham/optype/pull/308ruff to 0.11.0 by @jorenham in https://github.com/jorenham/optype/pull/305Full Changelog: https://github.com/jorenham/optype/compare/v0.9.2...v0.9.3
<!-- Release notes generated using configuration in .github/release.yml at v0.9.2 -->
<!-- Release notes generated using configuration in .github/release.yml at v0.9.2 -->
optypeoptype.Just* as @final and simplify metaclasses by @jorenham in https://github.com/jorenham/optype/pull/299optype.JustDate by @jorenham in https://github.com/jorenham/optype/pull/300optype.numpynumpy>=2.2 fixes for array- and dtype-likes by @jorenham in https://github.com/jorenham/optype/pull/301optype.numpy.random submodule by @jorenham in https://github.com/jorenham/optype/pull/302numpy to 2.2.3 by @jorenham in https://github.com/jorenham/optype/pull/292basedmypy to 2.10.0 by @jorenham in https://github.com/jorenham/optype/pull/298v0.9.2 by @jorenham in https://github.com/jorenham/optype/pull/289Full Changelog: https://github.com/jorenham/optype/compare/v0.9.1...v0.9.2
<!-- Release notes generated using configuration in .github/release.yml at v0.9.1 -->
<!-- Release notes generated using configuration in .github/release.yml at v0.9.1 -->
optype.numpyfloat80 and complex160 from [c]longdouble by @jorenham in https://github.com/jorenham/optype/pull/285onp.NDim0, which, unlike NDim, excludes 0 by @jorenham in https://github.com/jorenham/optype/pull/286onp.To[Just]{False,True} aliases by @jorenham in https://github.com/jorenham/optype/pull/287onp.ToArrayStrict{1,2,3}D by @jorenham in https://github.com/jorenham/optype/pull/288ruff to 0.9.4 by @jorenham in https://github.com/jorenham/optype/pull/284v0.9.1 by @jorenham in https://github.com/jorenham/optype/pull/277Full Changelog: https://github.com/jorenham/optype/compare/v0.9.0...v0.9.1
The op.typing.Just* types are deprecated in favor of op.Just*.
<!-- Release notes generated using configuration in .github/release.yml at v0.9.0 -->
import optype as op by deferring submodule imports (https://github.com/jorenham/optype/pull/251)op.io submodule (docs) (https://github.com/jorenham/optype/pull/253)op.Just types (docs):
Just[T] - Accepts _: T iff. type(_) is T.JustInt - Accepts _: int and literal ints, rejects e.g. _: boolJustFloat - Accepts _: float, rejects e.g. _: int and _: numpy.float64JustComplex - Accepts _: complex, rejects _: float and _: numpy.complex128JustBytes - Accepts _: bytes and bytes-literals, rejects _: bytearray, _: memoryview, and _: numpy.bytes_JustObject - Accepts _: object, rejects everything else. Useful for annotating sentinels like DEFAULT = object().op.numpy.is_array_{0,1,2,3,n}d typeguards (docs) (https://github.com/jorenham/optype/pull/270)op.typing.Just* types are deprecated in favor of op.Just*.optypeoptype.HasClass: suprisingly useful! by @jorenham in https://github.com/jorenham/optype/pull/257Just* from optype.typing to optype and deprecate by @jorenham in https://github.com/jorenham/optype/pull/258Just* types by @jorenham in https://github.com/jorenham/optype/pull/260Just without redundant typing hacks by @jorenham in https://github.com/jorenham/optype/pull/261JustObject by @jorenham in https://github.com/jorenham/optype/pull/264JustBytes by @jorenham in https://github.com/jorenham/optype/pull/265HasFunc and HasWrapped generic type params by @jorenham in https://github.com/jorenham/optype/pull/267HasTypeParams type params by @jorenham in https://github.com/jorenham/optype/pull/268optype.numpyJust{Float,Complex} over Just[{float,complex}] in optype.numpy by @jorenham in https://github.com/jorenham/optype/pull/240Just types to onp.Any*DType by @jorenham in https://github.com/jorenham/optype/pull/243optype.numpy.is_ typeguard by @jorenham in https://github.com/jorenham/optype/pull/270op.numpy._any_dtype module into two by @jorenham in https://github.com/jorenham/optype/pull/275optype.numpy.ToDType alias by @jorenham in https://github.com/jorenham/optype/pull/276basedpyright to 1.24.0 by @jorenham in https://github.com/jorenham/optype/pull/255ruff to 0.9.2 by @jorenham in https://github.com/jorenham/optype/pull/259numpy to 2.2.2 (dev-only) by @jorenham in https://github.com/jorenham/optype/pull/263pre-commit to 4.1.0 by @jorenham in https://github.com/jorenham/optype/pull/271CODEOWNERS by @jorenham in https://github.com/jorenham/optype/pull/248optype.io by @jorenham in https://github.com/jorenham/optype/pull/253__future__.annotations and typing.TYPE_CHECKING by @jorenham in https://github.com/jorenham/optype/pull/256ruff.lint.isort config by @jorenham in https://github.com/jorenham/optype/pull/262pyproject.toml by @jorenham in https://github.com/jorenham/optype/pull/269Full Changelog: https://github.com/jorenham/optype/compare/v0.8.0...v0.9.0
<!-- Release notes generated using configuration in .github/release.yml at v0.8.0 -->
<!-- Release notes generated using configuration in .github/release.yml at v0.8.0 -->
optype.numpyoptype.numpy.To*{1,2,3,N} by @jorenham in https://github.com/jorenham/optype/pull/214onp.Any[U]Int{DType,Array} for np.int_ by @jorenham in https://github.com/jorenham/optype/pull/224opt.Just[{int,float,complex}] in onp.Any{Int,Float,Complex}{Array,DType} by @jorenham in https://github.com/jorenham/optype/pull/225onp.compat module, and Any as shape-type default on numpy<2.1 by @jorenham in https://github.com/jorenham/optype/pull/226onp.Matrix and onp.MArray[{0,1,2,3}D] aliases by @jorenham in https://github.com/jorenham/optype/pull/228onp.AnyBytes8DType for np.dtype("c") by @jorenham in https://github.com/jorenham/optype/pull/230onp.ToJust{Bool,Float,Complex} aliases by @jorenham in https://github.com/jorenham/optype/pull/231onp.To[Just]{Float64,Complex128}* aliases by @jorenham in https://github.com/jorenham/optype/pull/232optype.pickleoptype.typingJustFloat and JustComplex to optype.typing by @jorenham in https://github.com/jorenham/optype/pull/215codespell to typos by @jorenham in https://github.com/jorenham/optype/pull/213basedmypy to 2.8.0 and basedpyright to 1.22.1 by @jorenham in https://github.com/jorenham/optype/pull/218Full Changelog: https://github.com/jorenham/optype/compare/v0.7.3...v0.8.0
optype is now on `conda-forge`, thanks to @lucascolley (docs)
optype is now on conda-forge, thanks to @lucascolley (docs)optype.numpy] The CanArrayND type now optionally accepts a second shape-type argument (docs)optype.numpy] New Array0D and CanArray0D aliases for 0-dimensional numpy arrays (not scalars) (docs)optype.numpy] New To*Strict{1,2,3}D array-like types with "strict" shape, useful for non-overlapping shape-type overloads (docs)ImportError on python >= 3.13 without typing_extensions installedruff to 0.8.1 by @jorenham in https://github.com/jorenham/optype/pull/203typing_extensions import on python>=3.13 by @jorenham in https://github.com/jorenham/optype/pull/205onp.CanArrayND shape-type param, improved shape-type compatibility by @jorenham in https://github.com/jorenham/optype/pull/206onp.To*Strict{1,2,3}D: array-like aliases with strict shape-type by @jorenham in https://github.com/jorenham/optype/pull/207typing_extensions imports on python>=3.13 by @jorenham in https://github.com/jorenham/optype/pull/208Full Changelog: https://github.com/jorenham/optype/compare/v0.7.2...v0.7.3
optype.numpy.To*3D - Array-like aliases for 3-D array-likes (docs)
optype.numpy.To*3D - Array-like aliases for 3-D array-likes (docs)optype.numpy.ToJustInt* - Scalar- and array-like aliases for just integer array-likes, i.e. bool and np.bool_ will be rejected (docs)ruff 0.8.0 and basedpyright 1.22.0 by @jorenham in https://github.com/jorenham/optype/pull/195SequenceND from optype.numpy by @jorenham in https://github.com/jorenham/optype/pull/197optype.numpy by @jorenham in https://github.com/jorenham/optype/pull/198ToJustInt scalar- and array-likes in optype.numpy by @jorenham in https://github.com/jorenham/optype/pull/199Full Changelog: https://github.com/jorenham/optype/compare/v0.7.1...v0.7.2
fix onp.ToArray{1,2}D names by @jorenham in https://github.com/jorenham/optype/pull/193
onp.ToArray{1,2}D names by @jorenham in https://github.com/jorenham/optype/pull/193Full Changelog: https://github.com/jorenham/optype/compare/v0.7.0...v0.7.1
optype.types.Deprecated by @jorenham in https://github.com/jorenham/optype/pull/179
optype.numpy.Any* aliases no longer accept bare scalars typesoptype.numpy.Array{1,2,3,N}D (docs)optype.dlpack module with DLPack types and enums (docs)optype.numpy typesJust and JustInt in optype.typing (docs)poetry to uv by @jorenham in https://github.com/jorenham/optype/pull/162ruff format by @jorenham in https://github.com/jorenham/optype/pull/164optype.dlpack: DLPack types and enums by @jorenham in https://github.com/jorenham/optype/pull/169optype.array_api - dtypes by @jorenham in https://github.com/jorenham/optype/pull/170optype.array_api - dtypes" by @jorenham in https://github.com/jorenham/optype/pull/176optype.numpy.CanArray by @jorenham in https://github.com/jorenham/optype/pull/178optype.types.Deprecated by @jorenham in https://github.com/jorenham/optype/pull/179optype.numpy dtypes by @jorenham in https://github.com/jorenham/optype/pull/182optype.numpy.Any* docs by @jorenham in https://github.com/jorenham/optype/pull/183optype.numpy type aliases and protocols by @jorenham in https://github.com/jorenham/optype/pull/184optype.numpy.Array{1,2,3,N}D aliases by @jorenham in https://github.com/jorenham/optype/pull/185typing_extensions.Protocol affecting CanSequence by @jorenham in https://github.com/jorenham/optype/pull/186basedpyright to 1.21.1 (pyright 1.1.389) by @jorenham in https://github.com/jorenham/optype/pull/188ruff to 0.7.4 by @jorenham in https://github.com/jorenham/optype/pull/189Just and JustInt types in optype.typing by @jorenham in https://github.com/jorenham/optype/pull/191optype.numpy.To* coercible scalar- and array-likes by @jorenham in https://github.com/jorenham/optype/pull/192Full Changelog: https://github.com/jorenham/optype/compare/v0.6.1...v0.7.0
This is a bugfix release with no breaking changes. However, because optype now uses less typing.Any, which could cause type-checkers to report errors…
This is a bugfix release with no breaking changes.
However, because optype now uses less typing.Any, which could cause type-checkers to report errors that were previously hidden.
typing.Any uses. See https://github.com/numpy/numpy/pull/27211 for why Any is evil.Full Changelog: https://github.com/jorenham/optype/compare/v0.6.0...v0.6.1
Improvements to `optype.numpy` (it's still optional)
optype.numpy (it's still optional)
numpy.dtypes.StringDType (numpy >= 2)Any*Array and Any*DTypetyping_extensions version from 4.7 to 4.8CanCopy, CanDeepcopy and CanReplace from optype._ to optype.copy._HasDataclassFields from optype._ to optype.dataclasses._CanGetnewargs[Ex], CanReduce[Ex], and Can{Get,Set}state from optype._ to optype.pickle._Any*Array and Any*DType for int_, float64 and complex128 don't include int, float, and complex anymore. See https://github.com/numpy/numpy/issues/27032#issuecomment-2249308801 for why this was done.Full Changelog: https://github.com/jorenham/optype/compare/v0.5.0...v0.6.0
optype.numpy: (optional) NumPy (1 & 2) typing protocols and aliases, see the docs the details
optype.numpy: (optional) NumPy (1 & 2) typing protocols and aliases, see the docs the details*Self aliases for the context manager Can* interfaces*Self aliases for the inplace operand CanI* interfacestyping_extensions is now required for all Python versions <3.13repo-review and tox by @jorenham in https://github.com/jorenham/optype/pull/53*Self aliases for the augmented binop CanI* interfaces by @jorenham in https://github.com/jorenham/optype/pull/82DoesI* inplace binary operator callable protocols by @jorenham in https://github.com/jorenham/optype/pull/83*Self aliases for the unary arithmetic operand interfaces by @jorenham in https://github.com/jorenham/optype/pull/85*Self aliases for context manager interfaces by @jorenham in https://github.com/jorenham/optype/pull/86typing_extensions imports for Protocol and runtime_checkable by @jorenham in https://github.com/jorenham/optype/pull/87optype.numpy: interfaces and type-aliases for numpy by @jorenham in https://github.com/jorenham/optype/pull/55optype.inspect module by @jorenham in https://github.com/jorenham/optype/pull/94Full Changelog: https://github.com/jorenham/optype/compare/v0.4.0...v0.5.0
The minimum required Python version has been lowered from 3.12 to 3.10.
The minimum required Python version has been lowered from 3.12 to 3.10.
basedpyright to 1.10.0 by @jorenham in https://github.com/jorenham/optype/pull/41CONTRIBUTING.md and CODE_OF_CONDUCT.md by @jorenham in https://github.com/jorenham/optype/pull/45Full Changelog: https://github.com/jorenham/optype/compare/v0.3.1...v0.4.0
Update pyright and pre-commit by @jorenham in https://github.com/jorenham/optype/pull/34
Full Changelog: https://github.com/jorenham/optype/compare/v0.3.0...v0.3.1
Fix CanAIterSelf not being an AsyncGenerator subtype by @jorenham in https://github.com/jorenham/optype/pull/17
CanAIterSelf not being an AsyncGenerator subtype by @jorenham in https://github.com/jorenham/optype/pull/17__reversed__ and __missing__ by @jorenham in https://github.com/jorenham/optype/pull/28
CanSequence[I: CanIndex, V] (combines CanLen and CanGetitem[I, V])do_reversed: DoesReversed (type-corrected alias for builtins.reversed)do_missing: DoesMissing (calls .__missing__())copy standard library by @jorenham in https://github.com/jorenham/optype/pull/29
CanCopy[T] and CanCopySelfCanDeepcopy[T] and CanDeepcopySelfCanReplace[T, V] and CanReplaceSelf[V]pickle standard library by @jorenham in https://github.com/jorenham/optype/pull/30
CanReduce[R: str | tuple]CanReduceEx[R: str | tuple]CanGetState[S]CanSetState[S]CanGetnewargs[*Args]CanGetnewargsEx[*Args, Kw]dataclasses standard library by @jorenham in https://github.com/jorenham/optype/pull/32
HasDataclassFieldsFull Changelog: https://github.com/jorenham/optype/compare/v0.2.2...v0.3.0
fix incorrect optype.do_ne annotation by @jorenham in https://github.com/jorenham/optype/pull/10
optype.do_ne annotation by @jorenham in https://github.com/jorenham/optype/pull/10optype.DoesIMod annotation by @jorenham in https://github.com/jorenham/optype/pull/11Can* types by @jorenham in https://github.com/jorenham/optype/pull/13CanIterSelf[+V] and CanAIterSelf[+V] by @jorenham in https://github.com/jorenham/optype/pull/14__len__ and __length_hint__ by @jorenham in https://github.com/jorenham/optype/pull/15Full Changelog: https://github.com/jorenham/optype/compare/v0.2.1...v0.2.2
Bump pytest from 8.0.2 to 8.1.1 by @dependabot in https://github.com/jorenham/optype/pull/5
do_bool: DoesBooldo_int: DoesIntdo_float: DoesFloatdo_complex: DoesComplexdo_bytes: DoesBytesdo_str: DoesStrexamples/ directoryFull Changelog: https://github.com/jorenham/optype/compare/v0.2.0...v0.2.1
add 72 operators as optype.do_*, so that optype > operator
optype.do_*, so that optype > operatoroptype.Does*CanA{name} types as CanA{Name}, improving readabilityFull Changelog: https://github.com/jorenham/optype/compare/v0.1.0...v0.2.0
The official first release of optype 🎉.
The official first release of optype 🎉.
Full Changelog: https://github.com/jorenham/optype/commits/v0.1.0
Nothing published for this version
One column per month.