Skip to content

Commit

Permalink
Merge pull request #189 from asmeurer/release
Browse files Browse the repository at this point in the history
1.9 release
  • Loading branch information
asmeurer authored Sep 23, 2024
2 parents 85a1588 + 40ab5f9 commit aa1f53a
Show file tree
Hide file tree
Showing 10 changed files with 84 additions and 15 deletions.
21 changes: 18 additions & 3 deletions .github/workflows/publish-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,9 @@ jobs:
- name: List contents of sdist
run: python -m tarfile --list dist/ndindex-*.tar.gz

- name: Get sdist filename
run: echo "SDIST_FILE=$(ls dist/*.tar.gz)" >> $GITHUB_ENV

- name: Upload distribution artifact
uses: actions/upload-artifact@v4
with:
Expand All @@ -67,6 +70,7 @@ jobs:
build_wheels:
name: Build wheels on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
needs: [build_sdist]
strategy:
matrix:
# macos-13 is an intel runner, macos-14 is apple silicon
Expand All @@ -75,17 +79,28 @@ jobs:
steps:
- uses: actions/checkout@v4

- name: Download distribution artifact
uses: actions/download-artifact@v4
with:
name: dist-artifact
path: dist

- name: Get sdist filename
run: echo "SDIST_FILE=$(ls dist/*.tar.gz)" >> $GITHUB_ENV

- name: Build wheels
uses: pypa/cibuildwheel@v2.21.0
with:
package-dir: ${{ env.SDIST_FILE }}
output-dir: dist/
env:
CIBW_TEST_COMMAND: 'python -c "import ndindex"'
CIBW_TEST_COMMAND: >
python -c "import ndindex; assert '1.' in ndindex.__version__"
- uses: actions/upload-artifact@v4
with:
name: cibw-wheels-${{ matrix.os }}-${{ strategy.job-index }}
path: ./wheelhouse/*.whl
path: ./dist/*.whl

publish:
name: Publish Python distribution to (Test)PyPI
Expand All @@ -105,8 +120,8 @@ jobs:
- name: Download distribution artifact
uses: actions/download-artifact@v4
with:
name: dist-artifact
path: dist
merge-multiple: true

- name: List all files
run: ls -lh dist
Expand Down
42 changes: 42 additions & 0 deletions docs/changelog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,47 @@
# ndindex Changelog

## Version 1.9.1 (2024-09-23)

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

## Version 1.9 (2024-09-23)

### 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.

## Version 1.8 (2024-02-15)

### Major Changes
Expand Down
9 changes: 5 additions & 4 deletions ndindex/booleanarray.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,11 @@ class BooleanArray(ArrayIndex):
integer array index in a tuple index, it is treated like
`np.nonzero(idx)`.
A list of booleans may also be used in place of a boolean array. Note
that NumPy treats a direct list of integers as a tuple index, but this
behavior is deprecated and will be replaced with integer array indexing in
the future. ndindex always treats lists as arrays.
See :doc:`../indexing-guide/multidimensional-indices/boolean-arrays` for a
more complete description of the semantics of boolean array indices.
A list (or list of lists) of booleans may also be used in place of an
array.
>>> from ndindex import BooleanArray
>>> import numpy as np
Expand Down
3 changes: 3 additions & 0 deletions ndindex/ellipsis.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ class ellipsis(NDIndex):
after the ellipsis indexes the last axes of the array. A tuple index can
have at most one ellipsis.
See :doc:`../indexing-guide/multidimensional-indices/ellipses` for more
details on the semantics of ellipsis indices.
For example `a[(0, ..., -2)]` would index the first element on the first
axis, the second-to-last element in the last axis, and include all the
axes in between.
Expand Down
3 changes: 3 additions & 0 deletions ndindex/integer.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ class Integer(NDIndex):
index directly. However, it is still recommended to use `raw` for
consistency, as this only works for `Integer`.
See :doc:`../indexing-guide/integer-indices` for a description of the
semantics of integers as indices.
.. note::
`Integer` does *not* represent an integer, but rather an
Expand Down
9 changes: 5 additions & 4 deletions ndindex/integerarray.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,11 @@ class IntegerArray(ArrayIndex):
also broadcast. In general, an :any:`Integer` index semantically behaves
the same as a scalar (`shape=()`) `IntegerArray`.
A list of integers may also be used in place of an integer array. Note
that NumPy treats a direct list of integers as a tuple index, but this
behavior is deprecated and will be replaced with integer array indexing in
the future. ndindex always treats lists as arrays.
A list (or list of lists) of integers may also be used in place of an
array.
See :doc:`../indexing-guide/multidimensional-indices/integer-arrays` for a
description of the semantics of integer array indices.
>>> from ndindex import IntegerArray
>>> import numpy as np
Expand Down
3 changes: 3 additions & 0 deletions ndindex/newaxis.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ class Newaxis(NDIndex):
Using `Newaxis().raw` as an index is equivalent to using `numpy.newaxis`.
See :doc:`../indexing-guide/multidimensional-indices/newaxis` for a
description of the semantics of newaxis.
.. note::
Unlike the NumPy `newaxis`, `Newaxis` is the type, not the object (the
Expand Down
4 changes: 2 additions & 2 deletions ndindex/slice.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ class Slice(_Slice, NDIndexCommon):
because Python itself does not make the distinction between `x:y` and
`x:y:` syntactically.
See :doc:`../indexing-guide/slices` for a description of the semantic
meaning of slices on arrays.
See :doc:`../indexing-guide/slices` for a complete description of the
semantics of slices.
Slice has attributes `start`, `stop`, and `step` to access the
corresponding attributes.
Expand Down
2 changes: 1 addition & 1 deletion ndindex/tests/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ def tuples(elements, *, min_size=0, max_size=None, unique_by=None, unique=False)
# See https://github.com/numpy/numpy/issues/15753
lambda shape: prod([i for i in shape if i]) < MAX_ARRAY_SIZE)

_short_shapes = lambda n: tuples(integers(0, 10), min_size=n).filter(
_short_shapes = lambda n: tuples(integers(0, 10), min_size=n, max_size=32).filter(
# numpy gives errors with empty arrays with large shapes.
# See https://github.com/numpy/numpy/issues/15753
lambda shape: prod([i for i in shape if i]) < SHORT_MAX_ARRAY_SIZE)
Expand Down
3 changes: 2 additions & 1 deletion ndindex/tuple.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ class Tuple(_Tuple, NDIndexCommon):
- :class:`IntegerArray`
- :class:`BooleanArray`
(some of the above are not yet implemented)
See :doc:`../indexing-guide/multidimensional-indices/tuples` for a
description of the semantics of tuple indices.
`Tuple(x1, x2, …, xn)` represents the index `a[x1, x2, …, xn]` or,
equivalently, `a[(x1, x2, …, xn)]`. `Tuple()` with no arguments is the
Expand Down

0 comments on commit aa1f53a

Please sign in to comment.