{"id":20947,"library":"array-api-strict","title":"Array API Strict","description":"A strict, minimal implementation of the Python array API standard (version 2.5). Provides a reference implementation for the standard, enforcing the specification strictly. Has a maintenance release cadence with major updates approximately yearly.","status":"active","version":"2.5","language":"python","source_language":"en","source_url":"https://github.com/data-apis/array-api-strict","tags":["array-api","standard","compliance","strict","reference"],"install":[{"cmd":"pip install array-api-strict","lang":"bash","label":"default"}],"dependencies":[],"imports":[{"note":"Most users treat the package as a namespace (like numpy), not importing individual functions.","wrong":"import array_api_strict as xp; from array_api_strict import arange","symbol":"as_strict_package","correct":"import array_api_strict as xp"},{"note":"The 'array' function is not directly exported; use 'asarray' instead.","wrong":"from array_api_strict import array","symbol":"create_array","correct":"import array_api_strict as xp; a = xp.asarray([1,2,3])"},{"note":"Submodules like 'linalg' are not part of the top-level namespace; must be imported explicitly.","wrong":"from array_api_strict import linalg","symbol":"linalg","correct":"from array_api_strict.linalg import ..."}],"quickstart":{"code":"import array_api_strict as xp\n\ndef main():\n    a = xp.asarray([1, 2, 3])\n    b = xp.asarray([4, 5, 6])\n    c = xp.dot(a, b)\n    print(c)\n\nif __name__ == '__main__':\n    main()","lang":"python","description":"Create two 1-D arrays and compute their dot product using the array API standard functions."},"warnings":[{"fix":"Migrate to NumPy or another array library for non-standard functions.","message":"Version 2.0 removed many previously included functions that are not part of the official array API standard (e.g., trigonometric functions from the 'math' extension). Use a full array library like NumPy for those.","severity":"breaking","affected_versions":">=2.0"},{"fix":"Ensure inputs have the same dtype or convert explicitly using xp.asarray(..., dtype=xp.float64).","message":"array-api-strict enforces strict data type promotion rules. Mixed type operations (e.g., int32 + float64) may raise errors instead of promoting.","severity":"breaking","affected_versions":"all"},{"fix":"Use finfo_obj.eps instead of finfo_obj['eps'].","message":"The 'finfo' function returned 'numpy.finfo' objects in older versions; now returns array API 'finfo' objects. Access methods like 'eps' via attribute, not key.","severity":"deprecated","affected_versions":">=1.0"},{"fix":"Do not rely on views; assign modified copies back to the original array if needed.","message":"Indexing semantics differ from NumPy: array_api_strict does not support advanced indexing that results in a copy vs view ambiguity. All indexing returns a copy (no views).","severity":"gotcha","affected_versions":"all"}],"env_vars":null,"last_verified":"2026-04-27T00:00:00.000Z","next_check":"2026-07-26T00:00:00.000Z","problems":[{"fix":"Replace xp.array(...) with xp.asarray(...).","cause":"array_api_strict does not export a function called 'array'; use 'asarray' instead.","error":"AttributeError: module 'array_api_strict' has no attribute 'array'"},{"fix":"Explicitly convert inputs to the same dtype: xp.asarray(a, dtype=xp.float64) + b.","cause":"Mixed dtype operation that violates strict casting rules.","error":"ValueError: Data type casting violation"},{"fix":"Add 'from array_api_strict.linalg import ...' before using linalg functions.","cause":"Linear algebra submodule is not in top-level namespace; must be imported.","error":"AttributeError: module 'array_api_strict' has no attribute 'linalg'"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}