Skip to content

ENH: Free-threading support #330

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

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open

Conversation

crusaderky
Copy link
Contributor

@crusaderky crusaderky commented Jun 10, 2025

Matching scipy PR:

Demo

tests/test_testing.py::test_lazy_xp_function[array_api_strict] PARALLEL PASSED                                                                                       [ 99%]
tests/test_testing.py::test_lazy_xp_function[array_api_strictest] PARALLEL PASSED                                                                                    [ 99%]
tests/test_testing.py::test_lazy_xp_function[numpy] PARALLEL PASSED                                                                                                  [ 99%]
tests/test_testing.py::test_lazy_xp_function[numpy:readonly] PARALLEL PASSED                                                                                         [ 99%]
tests/test_testing.py::test_lazy_xp_function[cupy] SKIPPED (could not import 'cupy': No module named 'cupy')                                                         [ 99%]
tests/test_testing.py::test_lazy_xp_function[torch] SKIPPED (could not import 'torch': No module named 'torch')                                                      [ 99%]
tests/test_testing.py::test_lazy_xp_function[torch:gpu] SKIPPED (could not import 'torch': No module named 'torch')                                                  [ 99%]
tests/test_testing.py::test_lazy_xp_function[dask] PASSED [thread-unsafe]: uses thread_unsafe marker                                                                 [ 99%]
tests/test_testing.py::test_lazy_xp_function[sparse] SKIPPED (could not import 'sparse': No module named 'sparse')                                                   [ 99%]
tests/test_testing.py::test_lazy_xp_function[jax] SKIPPED (could not import 'jax.numpy': No module named 'jax')                                                      [ 99%]
tests/test_testing.py::test_lazy_xp_function[jax:gpu] SKIPPED (could not import 'jax.numpy': No module named 'jax')                                                  [ 99%]

@@ -44,3 +44,29 @@ def modname(self) -> str: # numpydoc ignore=RT01
def like(self, *others: Backend) -> bool: # numpydoc ignore=PR01,RT01
"""Check if this backend uses the same module as others."""
return any(self.modname == other.modname for other in others)

def pytest_param(self) -> Any: # type: ignore[explicit-any]
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pytest.mark.ParameterSet is not exported

@crusaderky crusaderky force-pushed the nogil branch 4 times, most recently from efde2aa to bf5b21c Compare June 10, 2025 11:37
@crusaderky crusaderky changed the title TST: Free-threaded tests TST: Free-threading support Jun 10, 2025
@crusaderky crusaderky changed the title TST: Free-threading support ENH: Free-threading support Jun 10, 2025
@@ -23,6 +23,7 @@ classifiers = [
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Programming Language :: Python :: Free Threading :: 3 - Stable",
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The whole library has 1 stateful class, at, which has trivial state. So no point adding tests beyond those of pytest-run-parallel.
Where we are thread-unsafe, in lazy_xp_function, it is clearly documented, so I believe this should qualify for the Stable badge?

@lucascolley lucascolley added the enhancement New feature or request label Jun 11, 2025
@lucascolley lucascolley added this to the 0.8.1 milestone Jun 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

BUG: lazy_xp_function is incompatible with pytest-run-parallel
2 participants