Ndindex

Latest version: v1.9.2

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

Scan your dependencies

Page 1 of 3

1.9.2

Minor Changes

- Fixes an issue with pickle and deepcopy serialization introduced in ndindex
1.9.

1.9.1

This version is identical to 1.9, but includes some fixes to the release
scripts to ensure that wheels are properly uploaded to PyPI.

1.9

Major Changes

- ndindex now uses a C extension (using Cython). Currently the constructors
for {class}`~.Slice` and {class}`~.Tuple` have been Cythonized, meaning
constructing and using those classes is now much faster. In the future,
additional parts of ndindex will be Cythonized as performance needs dictate.
This does not have any user-facing changes to functionality.

- Python 3.8 is no longer supported.

- The documentation now includes a [documentation guide for all NumPy index
types](indexing-guide/index), extending the previous [guide for
slices](indexing-guide/slices). The slices guide has also been improved and
now has diagrams built using HTML/CSS instead of MathJAX.

Minor Changes

- Some fixes to incorrect usage of `__slots__`.

- Raise an exception earlier for invalid index in
{any}`ChunkSize.num_subchunks()`.

- The `CYTHONIZE_NDINDEX` environment variable for building has been removed,
as Cython support is now required.

- Fix a compatibility issue with NumPy 2.0.

- {func}`~.normalize_skip_axes` will now raise `AxisError` before `ValueError`
for non-unique axes.

- Keep track of when a `Slice` has been reduced (with no shape) to avoid
recomputing it.

- Various improvements in the tests.

1.8

Major Changes

- **Breaking** {func}`~.broadcast_shapes` no longer returns `None` in the
place of skipped axes. The result is now just the non-skipped axes
broadcasted together.

- The `skip_axes` flag to {func}`~.iter_indices` and
{func}`~.broadcast_shapes` can now be a list of tuples, of skipped axes,
which apply to each respective shape independently.

- Mixing negative and nonnegative `skip_axes` in {func}`~.iter_indices` and
{func}`~.broadcast_shapes` is now supported. The only restriction is that
skip axes must refer to unique dimensions for each shape.

- New index method [`selected_indices()`](Tuple.selected_indices), which
iterates indices corresponding to each element selected by the given index
on an array of a given `shape`.

- ndindex indices can now be constructed by slicing the {func}`~.ndindex`
constructor function, like `ndindex[0:10]`. This is generally preferred for
indices with explicit slices, as this allows using the usual `:` slice
syntax instead of requiring slices to be spelled out with the `slice`
function.

- Add a `negative_int` flag to [`reduce`](Integer.reduce), which makes it
normalize integer indices to negative integers when a shape is provided.

- {class}`~.Slice` objects now hash to the same hash value as their
corresponding raw `slice` in Python 3.12, which now allows [native `slice`
objects to be
hashed](https://docs.python.org/3/whatsnew/3.12.html#other-language-changes).

- Fix an incorrect result from {any}`ChunkSize.as_subchunks()` and
{any}`ChunkSize.num_subchunks()` when using multiple array indices or a
boolean array index with multiple dimensions.

Minor Changes

- Drop support for Python 3.7.

- Fully support the upcoming NumPy 2.0 release. This mostly only relevant for
the ndindex test suite, although it does also mean that one ndindex error
message has been updated to match updated wording from NumPy.

- Specify Cython language_level, which leads to shorter code and gets rid of a
bunch of warnings. (keszybz)

- Rename the default git branch from `master` to `main`.

1.7

Major Changes

- **Breaking:** the `skip_axes` argument {func}`~.iter_indices` function now
applies the skipped axes *before* broadcasting, not after. This behavior is
more generally useful and matches how functions with stacking work (e.g.,
`np.cross` or `np.matmul`). The best way to get the old behavior is to
broadcast the arrays/shapes together first. The `skip_axes` in
`iter_indices` must be either all negative or all nonnegative to avoid
ambiguity. A future version may add support for specifying different skip
axes for each shape.

- {func}`~.iter_indices` no longer requires the skipped axes specified by
`skip_axes` to be broadcast compatible.

- New method {meth}`~ndindex.ndindex.NDIndex.isvalid` to check if an index is valid on
a given shape.

- New function {func}`~.broadcast_shapes` which is the same as
`np.broadcast_shapes()` except it also allows specifying a set of
`skip_axes` which will be ignored when broadcasting.

- New exceptions {class}`~.BroadcastError` and {class}`~.AxisError` which are
used by {func}`~.iter_indices` and {func}`~.broadcast_shapes`.

Minor Changes

- The documentation theme has been changed to
[Furo](https://pradyunsg.me/furo/), which has a more clean color scheme
based on the ndindex logo, better navigation and layout, mobile support, and
dark mode support.

- Fix some test failures with the latest version of NumPy.

- Fix some tests that didn't work properly when run against the sdist.

- The sdist now includes relevant testing files.

- Automatically deploy docs from CI again.

- Add a documentation preview CI job.

- Test Python 3.11 in CI.

- Minor improvements to some documentation.

- Fix a typo in the [type confusion](type-confusion.md) docs. (ruancomelli)

1.6

Major Changes

- SymPy is no longer a dependency of ndindex.

- NumPy is now an optional dependency of ndindex. It is only required when
constructing array indices {class}`~.BooleanArray` or
{class}`~.IntegerArray`. This does not change the semantics of ndindex.
ndindex objects still match NumPy indexing semantics everywhere. Note that
NumPy is still a hard requirement for all tests in the ndindex test suite.

- Added a new function {func}`~.iter_indices` which is a generalization of the
`np.ndindex()` function (which is otherwise unrelated) to allow multiple
broadcast compatible shapes, and to allow skipping axes.

- Added a new method {any}`ChunkSize.containing_block`, which computes the
smallest continuous block of chunks containing a given index.

- ndindex can now be installed with optional Cythonization support. This is
still experimental and is only enabled when installing ndindex from source
when Cython is installed (see [the installation
instructions](installation)). This improves the general performance of
ndindex.

Minor Changes

- Fix an issue with the {class}`~.Tuple` constructor with broadcast incompatible
arrays with the latest version of NumPy.

- Small performance improvement to {any}`Tuple.reduce`.

- Add better support for boolean scalar indices in various
{class}`~.ChunkSize` methods.

- Better `NotImplementedError` messages from {class}`~.ChunkSize` methods.

- Switch from Travis CI to GitHub Actions.

- Update CI to test Python 3.10.

- Remove Codecov from CI.

- The docs now have a cleaner sidebar which always stays fixed on screen.

Page 1 of 3

© 2024 Safety CLI Cybersecurity Inc. All Rights Reserved.