Skip to content

Commit

Permalink
Merge pull request #100 from asmeurer/release
Browse files Browse the repository at this point in the history
1.5 release
  • Loading branch information
asmeurer authored Mar 8, 2024
2 parents 2ec2dce + 6222279 commit d10bf57
Show file tree
Hide file tree
Showing 6 changed files with 85 additions and 23 deletions.
84 changes: 65 additions & 19 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,52 @@
# 1.4.1 (2024-01-18)
# Array API Compat Changelog

## Minor Changes
## 1.5 (2024-03-07)

### Major Changes

- Add support for Dask ([@lithomas1](https://github.com/lithomas1)).

- Add support for JAX. Note that unlike other array libraries,
array-api-compat does not contain any wrappers for JAX functions. All JAX
array API support is in JAX itself. Thus, there is no `array_api_compat.jax`
submodule, and `array_namespace(<JAX array>)` returns the
`jax.experimental.array_api` module.

- The functions `is_numpy_array(x)`, `is_cupy_array(x)`, `is_torch_array(x)`,
`is_dask_array(x)`, `is_jax_array(x)` are now part of the public
`array_api_compat` API.

- Add wrappers for the `fft` extension module for NumPy, CuPy, and PyTorch.

### Minor Changes

- Allow `'2022.12'` as the `api_version` in `array_namespace()`. `'2021.12'`
is also supported but will issue a warning since the returned namespace will
still be a 2022.12 compliant one.

- Add wrapper for numpy.linalg.solve, which broadcasts the inputs according to
the standard.

- Add wrappers for various PyTorch linalg functions.

- Fix a bug with `numpy.linalg.vector_norm(keepdims=True)`.

- BREAKING: Update `vecdot` wrappers to apply `axes` before broadcasting, not
after. This matches the updated 2023.12 standard wording, and also the
behavior of the new `numpy.vecdot` gufunc in NumPy 2.0.

- Fix some linalg functions which were supposed to be in both the main
namespace and the linalg extension namespace.

- Add Ruff to CI. ([@adonath](https://github.com/adonath))

- Test that internal definitions of `__all__` are self-consistent, which
should help to avoid issues where wrappers are accidentally not exported to
the compat namespaces properly.

## 1.4.1 (2024-01-18)

### Minor Changes

- Add support for the upcoming NumPy 2.0 release.

Expand All @@ -17,14 +63,14 @@
- Fix linalg.cholesky returning the conjugate of the expected upper
decomposition for numpy and cupy.

# 1.4 (2023-09-13)
## 1.4 (2023-09-13)

## Major Changes
### Major Changes

- Releases are now made with GitHub Actions (thanks
[@matthewfeickert](https://github.com/matthewfeickert)).

## Minor Changes
### Minor Changes

- Fix `torch.result_type()` cross-kind promotion
([@lucascolley](https://github.com/lucascolley)).
Expand All @@ -34,42 +80,42 @@
- Add requires-python metadata to the package
([@matthewfeickert](https://github.com/matthewfeickert)).

# 1.3 (2023-06-20)
## 1.3 (2023-06-20)

## Major Changes
### Major Changes

- Add [2022.12](https://data-apis.org/array-api/2022.12/) standard support.
This includes things like adding complex dtype support, adding the new
`take` function, and various minor changes in the specification.

## Minor Changes
### Minor Changes

- Support `"cpu"` in CuPy `to_device()`.

- Return a new array in NumPy/CuPy `reshape(copy=False)`.

- Fix signatures for PyTorch `broadcast_to` and `permute_dims`.

# 1.2 (2023-04-03)
## 1.2 (2023-04-03)

## Major Changes
### Major Changes

- Support the linalg extension in the `array_api_compat.torch` namespace.

- Add `isdtype()`.

## Minor Changes
### Minor Changes

- Fix the `k` keyword argument to `tril` and `triu` in `torch`.

# 1.1.1 (2023-03-10)
## 1.1.1 (2023-03-10)

## Major Changes
### Major Changes

- Rename `get_namespace()` to `array_namespace()` (`get_namespace()` is
maintained as a backwards compatible alias).

## Minor Changes
### Minor Changes

- The minimum supported NumPy version is now 1.21. Fixed a few issues with
NumPy 1.21 (with `unique_*` and `asarray`), although there are also a few
Expand All @@ -91,9 +137,9 @@
- Add `torch` wrappers for `ones`, `empty`, and `zeros` so that `shape` can be
passed as a keyword argument.

# 1.1 (2023-02-24)
## 1.1 (2023-02-24)

## Major Changes
### Major Changes

- Added support for PyTorch.

Expand All @@ -104,14 +150,14 @@
- All wrapper functions that wrap existing library functions now pass through
arbitrary `**kwargs`.

## Minor Changes
### Minor Changes

- Added CI to run against the [array API testsuite](https://github.com/data-apis/array-api-tests).

- Fix `sort(stable=False)` and `argsort(stable=False)` with CuPy.

# 1.0 (2022-12-05)
## 1.0 (2022-12-05)

## Major Changes
### Major Changes

- Initial release. Includes support for NumPy and CuPy.
2 changes: 1 addition & 1 deletion array_api_compat/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,6 @@
this implementation for the default when working with NumPy arrays.
"""
__version__ = '1.4.1'
__version__ = '1.5'

from .common import * # noqa: F401, F403
2 changes: 1 addition & 1 deletion array_api_compat/common/_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -325,4 +325,4 @@ def size(x):
"to_device",
]

_all_ignore = ['sys', 'math', 'inspect']
_all_ignore = ['sys', 'math', 'inspect', 'warnings']
3 changes: 3 additions & 0 deletions cupy-xfails.txt
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@ array_api_tests/test_searching_functions.py::test_argmin
array_api_tests/test_statistical_functions.py::test_min
array_api_tests/test_statistical_functions.py::test_max

# prod() sometimes doesn't give nan for 0*overflow
array_api_tests/test_statistical_functions.py::test_prod

# testsuite incorrectly thinks meshgrid doesn't have indexing argument
# (https://github.com/data-apis/array-api-tests/issues/171)
array_api_tests/test_signatures.py::test_func_signature[meshgrid]
Expand Down
1 change: 1 addition & 0 deletions numpy-1-21-xfails.txt
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ array_api_tests/test_operators_and_elementwise_functions.py::test_divide[__trued
array_api_tests/test_operators_and_elementwise_functions.py::test_divide[__truediv__(x1, x2)]
array_api_tests/test_operators_and_elementwise_functions.py::test_divide[divide(x1, x2)]
array_api_tests/test_operators_and_elementwise_functions.py::test_equal[equal(x1, x2)]
array_api_tests/test_operators_and_elementwise_functions.py::test_equal[__eq__(x1, x2)]
array_api_tests/test_operators_and_elementwise_functions.py::test_floor_divide[__floordiv__(x, s)]
array_api_tests/test_operators_and_elementwise_functions.py::test_floor_divide[__floordiv__(x1, x2)]
array_api_tests/test_operators_and_elementwise_functions.py::test_floor_divide[__ifloordiv__(x, s)]
Expand Down
16 changes: 14 additions & 2 deletions tests/test_array_namespace.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import subprocess
import sys
import warnings

import numpy as np
import pytest
Expand Down Expand Up @@ -57,13 +58,24 @@ def test_array_namespace_errors():
pytest.raises(TypeError, lambda: array_namespace((x, x)))
pytest.raises(TypeError, lambda: array_namespace(x, (x, x)))


def test_array_namespace_errors_torch():
y = torch.asarray([1, 2])
x = np.asarray([1, 2])
pytest.raises(TypeError, lambda: array_namespace(x, y))
pytest.raises(ValueError, lambda: array_namespace(x, api_version="2022.12"))

def test_api_version():
x = np.asarray([1, 2])
np_ = import_("numpy", wrapper=True)
assert array_namespace(x, api_version="2022.12") == np_
assert array_namespace(x, api_version=None) == np_
assert array_namespace(x) == np_
# Should issue a warning
with warnings.catch_warnings(record=True) as w:
assert array_namespace(x, api_version="2021.12") == np_
assert len(w) == 1
assert "2021.12" in str(w[0].message)

pytest.raises(ValueError, lambda: array_namespace(x, api_version="2020.12"))

def test_get_namespace():
# Backwards compatible wrapper
Expand Down

0 comments on commit d10bf57

Please sign in to comment.