Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ENH: array API "namespace" #65

Open
tylerjereddy opened this issue Aug 26, 2022 · 2 comments
Open

ENH: array API "namespace" #65

tylerjereddy opened this issue Aug 26, 2022 · 2 comments

Comments

@tylerjereddy
Copy link
Contributor

When running the array API testsuite with pykokkos, one can see this warning: hypothesis/extra/array_api.py:789: HypothesisWarning: Could not determine whether module pykokkos is an Array API library.

If you look at the related code block in hypothesis testing library proper:

    try:
        array = xp.zeros(1)
        array.__array_namespace__()
    except Exception:
        warn(
            f"Could not determine whether module {xp.__name__} is an Array API library",
            HypothesisWarning,
        )   

For details on the requirements for this __array_namespace__() method see:

@tylerjereddy
Copy link
Contributor Author

With the latest version of hypothesis this now causes real testing failure:

ImportError while loading conftest '/home/tyler/github_projects/array-api-tests/conftest.py'.
conftest.py:7: in <module>
    from array_api_tests import _array_module as xp
array_api_tests/__init__.py:44: in <module>
    xps = array_api.make_strategies_namespace(_xp)
../../python_310_pykokkos_work/lib/python3.10/site-packages/hypothesis/extra/array_api.py:895: in make_strategies_namespace
    check_argument(
../../python_310_pykokkos_work/lib/python3.10/site-packages/hypothesis/extra/_array_helpers.py:52: in check_argument
    raise InvalidArgument(fail_message.format(*f_args, **f_kwargs))
E   hypothesis.errors.InvalidArgument: Array module pykokkos has no attribute __array_api_version__, which is required when inferring api_version. If you believe pykokkos is indeed an Array API module, try explicitly passing an api_version.

We may need to pin hypothesis for a little bit until we sort this out..

@tylerjereddy
Copy link
Contributor Author

Example of failure in CI is here: #98

tylerjereddy added a commit to tylerjereddy/pykokkos that referenced this issue Sep 29, 2022
* pin `hypothesis` to temporarily avoid
kokkos#65 (comment)

until we have a proper implementation of that
tylerjereddy added a commit to tylerjereddy/pykokkos that referenced this issue Sep 30, 2022
* pin `hypothesis` to temporarily avoid
kokkos#65 (comment)

until we have a proper implementation of that
tylerjereddy added a commit to tylerjereddy/pykokkos that referenced this issue Oct 4, 2022
* this is in part a copy of the NumPy patch applied at:
numpy/numpy#22365
and is related to this failure we were seeing with
`hypothesis`: kokkos#65 (comment)

* the standard section related to this is:
https://data-apis.org/array-api/latest/future_API_evolution.html#versioning

* unpin `hypothesis` in our CI as a result; to be fair,
this is the solution @ShahzadUmair wanted from the start
I think

* the updated testing behavior required me to cherry-pick
some data type info improvements from kokkosgh-97
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant