Optype

Latest version: v0.8.0

Safety actively analyzes 693883 Python packages for vulnerabilities to keep your Python projects secure.

Scan your dependencies

Page 1 of 3

0.8.0

<!-- Release notes generated using configuration in .github/release.yml at v0.8.0 -->

What's Changed
`optype.numpy`
* accept more valid numpy array-likes in `optype.numpy.To*{1,2,3,N}` by jorenham in https://github.com/jorenham/optype/pull/214
* `onp.Any[U]Int{DType,Array}` for `np.int_` by jorenham in https://github.com/jorenham/optype/pull/224
* include `opt.Just[{int,float,complex}]` in `onp.Any{Int,Float,Complex}{Array,DType}` by jorenham in https://github.com/jorenham/optype/pull/225
* new `onp.compat` module, and `Any` as shape-type default on `numpy<2.1` by jorenham in https://github.com/jorenham/optype/pull/226
* new `onp.Matrix` and `onp.MArray[{0,1,2,3}D]` aliases by jorenham in https://github.com/jorenham/optype/pull/228
* `onp.AnyBytes8DType` for `np.dtype("c")` by jorenham in https://github.com/jorenham/optype/pull/230
* new `onp.ToJust{Bool,Float,Complex}` aliases by jorenham in https://github.com/jorenham/optype/pull/231
* new `onp.To[Just]{Float64,Complex128}*` aliases by jorenham in https://github.com/jorenham/optype/pull/232
`optype.pickle`
* Added missed optype documentation by kam193 in https://github.com/jorenham/optype/pull/212
`optype.typing`
* add `JustFloat` and `JustComplex` to `optype.typing` by jorenham in https://github.com/jorenham/optype/pull/215
Dependencies
* migrate from `codespell` to `typos` by jorenham in https://github.com/jorenham/optype/pull/213
* bump `basedmypy` to `2.8.0` and `basedpyright` to `1.22.1` by jorenham in https://github.com/jorenham/optype/pull/218
* update development dependencies by jorenham in https://github.com/jorenham/optype/pull/223
Continuous integration
* test & typecheck all of the supported numpy versions by jorenham in https://github.com/jorenham/optype/pull/227
* PyPI trusted publishing by jorenham in https://github.com/jorenham/optype/pull/234
Other Changes
* update the security policy by jorenham in https://github.com/jorenham/optype/pull/216
* automatically generated release notes configuration by jorenham in https://github.com/jorenham/optype/pull/233

New Contributors
* kam193 made their first contribution in https://github.com/jorenham/optype/pull/212

**Full Changelog**: https://github.com/jorenham/optype/compare/v0.7.3...v0.8.0

0.7.3

Highlights

* `optype` is now on [`conda-forge`](https://anaconda.org/conda-forge/optype), thanks to lucascolley ([docs](https://github.com/jorenham/optype/blob/v0.7.3/README.md#conda))
* [`optype.numpy`] The `CanArrayND` type now optionally accepts a second shape-type argument ([docs](https://github.com/jorenham/optype/blob/v0.7.3/README.md#shape-typing-with-array))
* [`optype.numpy`] New `Array0D` and `CanArray0D` aliases for 0-dimensional numpy arrays (not scalars) ([docs](https://github.com/jorenham/optype/blob/v0.7.3/README.md#shape-typing-with-array))
* [`optype.numpy`] New `To*Strict{1,2,3}D` array-like types with "strict" shape, useful for non-overlapping shape-type overloads ([docs](https://github.com/jorenham/optype/blob/v0.7.3/README.md#array-likes))

Fixes

* Fix `ImportError` on `python >= 3.13` without `typing_extensions` installed

What's Changed
* fix license metadata by jorenham in https://github.com/jorenham/optype/pull/202
* bump `ruff` to `0.8.1` by jorenham in https://github.com/jorenham/optype/pull/203
* Conda installation instructions by jorenham in https://github.com/jorenham/optype/pull/204
* fix `typing_extensions` import on `python>=3.13` by jorenham in https://github.com/jorenham/optype/pull/205
* optional `onp.CanArrayND` shape-type param, improved shape-type compatibility by jorenham in https://github.com/jorenham/optype/pull/206
* `onp.To*Strict{1,2,3}D`: array-like aliases with strict shape-type by jorenham in https://github.com/jorenham/optype/pull/207
* fix (more) `typing_extensions` imports on `python>=3.13` by jorenham in https://github.com/jorenham/optype/pull/208
* 0-d numpy array aliases by jorenham in https://github.com/jorenham/optype/pull/209


**Full Changelog**: https://github.com/jorenham/optype/compare/v0.7.2...v0.7.3

0.7.2

Highlights

* `optype.numpy.To*3D` - Array-like aliases for 3-D array-likes ([docs](https://github.com/jorenham/optype?tab=readme-ov-file#array-likes))
* `optype.numpy.ToJustInt*` - Scalar- and array-like aliases for *just* integer array-likes, i.e. `bool` and `np.bool_` will be rejected ([docs](https://github.com/jorenham/optype?tab=readme-ov-file#array-likes))

Fixes

* 194 - workaround for a [mypy bug](https://github.com/python/mypy/issues/18184) with recursive sequences types

What's Changed
* `ruff 0.8.0` and `basedpyright 1.22.0` by jorenham in https://github.com/jorenham/optype/pull/195
* workaround for a mypy bug with recursive sequences types by jorenham in https://github.com/jorenham/optype/pull/196
* export `SequenceND` from `optype.numpy` by jorenham in https://github.com/jorenham/optype/pull/197
* 3-d aliases for arrays and array-likes in `optype.numpy` by jorenham in https://github.com/jorenham/optype/pull/198
* `ToJustInt` scalar- and array-likes in `optype.numpy` by jorenham in https://github.com/jorenham/optype/pull/199


**Full Changelog**: https://github.com/jorenham/optype/compare/v0.7.1...v0.7.2

0.7.1

What's Changed
* fix `onp.ToArray{1,2}D` names by jorenham in https://github.com/jorenham/optype/pull/193


**Full Changelog**: https://github.com/jorenham/optype/compare/v0.7.0...v0.7.1

0.7.0

Highlights

* [BREAKING] The `optype.numpy.Any*` aliases no longer accept bare scalars types
* Coercible scalar- and array-like type aliases `optype.numpy.Array{1,2,3,N}D` ([docs](https://github.com/jorenham/optype?tab=readme-ov-file#array-likes))
* The new `optype.dlpack` module with DLPack types and enums ([docs](https://github.com/jorenham/optype?tab=readme-ov-file#optypedlpack))
* Improved the readability of the `optype.numpy` types
* Experimental `Just` and `JustInt` in `optype.typing` ([docs](https://github.com/jorenham/optype?tab=readme-ov-file#just-types))

What's Changed
* development dependency updates by jorenham in https://github.com/jorenham/optype/pull/160
* native toml tox config by jorenham in https://github.com/jorenham/optype/pull/161
* switch from `poetry` to `uv` by jorenham in https://github.com/jorenham/optype/pull/162
* switch from single to double quotes for black compatibility by jorenham in https://github.com/jorenham/optype/pull/163
* enforce `ruff format` by jorenham in https://github.com/jorenham/optype/pull/164
* clean up the internal module structure by jorenham in https://github.com/jorenham/optype/pull/165
* update pre-commit hooks by pre-commit-ci in https://github.com/jorenham/optype/pull/166
* update development dependencies by jorenham in https://github.com/jorenham/optype/pull/168
* `optype.dlpack`: DLPack types and enums by jorenham in https://github.com/jorenham/optype/pull/169
* `optype.array_api` - dtypes by jorenham in https://github.com/jorenham/optype/pull/170
* Revert "`optype.array_api` - dtypes" by jorenham in https://github.com/jorenham/optype/pull/176
* PEP 735 dependency groups, and fixed mypy config by jorenham in https://github.com/jorenham/optype/pull/177
* fix `optype.numpy.CanArray` by jorenham in https://github.com/jorenham/optype/pull/178
* `optype.types.Deprecated` by jorenham in https://github.com/jorenham/optype/pull/179
* simplified `optype.numpy` dtypes by jorenham in https://github.com/jorenham/optype/pull/182
* fix and improve the `optype.numpy.Any*` docs by jorenham in https://github.com/jorenham/optype/pull/183
* improve readability of `optype.numpy` type aliases and protocols by jorenham in https://github.com/jorenham/optype/pull/184
* `optype.numpy.Array{1,2,3,N}D` aliases by jorenham in https://github.com/jorenham/optype/pull/185
* workaround a PEP 696 bug in `typing_extensions.Protocol` affecting `CanSequence` by jorenham in https://github.com/jorenham/optype/pull/186
* add SPEC 0 badge by jorenham in https://github.com/jorenham/optype/pull/187
* bump `basedpyright` to `1.21.1` (`pyright 1.1.389`) by jorenham in https://github.com/jorenham/optype/pull/188
* bump `ruff` to `0.7.4` by jorenham in https://github.com/jorenham/optype/pull/189
* experimental `Just` and `JustInt` types in `optype.typing` by jorenham in https://github.com/jorenham/optype/pull/191
* `optype.numpy.To*` coercible scalar- and array-likes by jorenham in https://github.com/jorenham/optype/pull/192

New Contributors
* pre-commit-ci made their first contribution in https://github.com/jorenham/optype/pull/166

**Full Changelog**: https://github.com/jorenham/optype/compare/v0.6.1...v0.7.0

0.6.1

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.

Highlights

- Stricter type-checking with [basedmypy](https://github.com/KotlinIsland/basedmypy).
- Removed almost all `typing.Any` uses. See https://github.com/numpy/numpy/pull/27211 for why `Any` is evil.
- Fixed several typing errors with [numpy 2.1](https://github.com/numpy/numpy/releases/tag/v2.1.0).

What's Changed
* Farewell git-flow by jorenham in https://github.com/jorenham/optype/pull/151
* Add security policy by jorenham in https://github.com/jorenham/optype/pull/152
* Add a sponsor button by jorenham in https://github.com/jorenham/optype/pull/153
* basedmypy by jorenham in https://github.com/jorenham/optype/pull/154
* Bump NumPy to 2.1.0 by jorenham in https://github.com/jorenham/optype/pull/155
* basedmypy badge by jorenham in https://github.com/jorenham/optype/pull/156
* optype 0.6.1 by jorenham in https://github.com/jorenham/optype/pull/157


**Full Changelog**: https://github.com/jorenham/optype/compare/v0.6.0...v0.6.1

Page 1 of 3

© 2025 Safety CLI Cybersecurity Inc. All Rights Reserved.