Skip to content

1.4.0

Latest

Choose a tag to compare

@antonwolfy antonwolfy released this 04 May 22:43
· 9 commits to master since this release
ecc4e3c

Overview

This release introduces NumPy compatibility through a new patching system and dedicated interface module. mkl_random can now seamlessly replace NumPy's random number generation while maintaining full API compatibility. The release includes extensive test coverage from NumPy's test suite, numerous bug fixes, and improvements to align with modern NumPy behavior. Python 3.9 support has been dropped.

Highlights

🔄 NumPy Patching System

  • New context manager and explicit patch/restore functions to replace numpy.random with mkl_random implementations
  • Query patching status with is_patched() function
  • Seamless drop-in replacement for NumPy's random number generation

🎯 Strict NumPy API Interface

  • New mkl_random.interfaces.numpy_random module provides pure NumPy-compatible API
  • Aliases mkl_random functionality while dropping non-standard arguments and functions
  • Better alignment with NumPy's API contracts

Enhanced Test Coverage

  • Third-party tests from numpy.random integrated to validate compatibility
  • Additional vendored NumPy tests for comprehensive validation
  • Improved reliability and correctness

🐛 Bug Fixes & Improvements

  • Fixed hang in zipf when called with np.nan
  • Fixed size-1 1D arrays being incorrectly cast to scalars
  • Multiple implementation updates to align with newer NumPy versions

📦 Flexible Build Configuration

  • Conda recipe now supports configurable NumPy dependency via USE_NUMPY_BASE environment variable

⚠️ Breaking Changes

  • Python 3.9 support dropped - Minimum supported version is now Python 3.10+
  • mkl_random.RandomState deprecated - Use mkl_random.MKLRandomState instead. RandomState now delegates to the numpy_random interface for compatibility.

Python Version Support

  • ✅ Python 3.10, 3.11, 3.12, 3.13, 3.14
  • ❌ Python 3.9 and earlier

Detailed Changes

Added

  • Added mkl_random patching for NumPy, with mkl_random context manager, is_patched query, and patch_numpy_random and restore_numpy_random calls to replace numpy.random calls with calls from mkl_random.interfaces.numpy_random gh-90

  • Added mkl_random.interfaces with mkl_random.interfaces.numpy_random interface, which aliases mkl_random functionality to more strictly adhere to NumPy's API (i.e., drops arguments and functions which are not part of standard NumPy) gh-92

  • Added third-party tests from numpy.random which tests the mkl_random.interfaces.numpy_random interface gh-103

Changed

  • Updates to mkl_random implementations to better align with newer versions of numpy.random gh-103, gh-115
  • Made conda recipe dependency on numpy configurable through USE_NUMPY_BASE environment variable gh-105

Fixed

  • Various bugfixes including a hang in zipf when called with np.nan and size-1 1D arrays being cast to scalars gh-103, gh-115

Removed

  • Dropped support for Python 3.9 gh-81

Deprecated

  • Deprecated mkl_random.RandomState in favor of mkl_random.MKLRandomState, delegating mkl_random.RandomState to the mkl_random.interfaces.numpy_random interface gh-92

Contributors

New Contributors

Full Changelog: v1.3.1...v1.4.0