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

TST: enable CPython free-threading support #468

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

andfoy
Copy link

@andfoy andfoy commented Feb 18, 2025

This PR enables free-threading builds of bottleneck, available from Python 3.13 onwards, this new distribution allows Python packages to leverage true parallel support, as the GIL is now optional.

In particular, this PR performs the following checks:

  • Test the package using pytest-run-parallel, which allows pytest suites to be run concurrently (per test). This analysis didn't throw any major concurrency-related issues, the only tests that were marked as thread-unsafe were related to memory usage checking and concurrent file overwriting.
  • Add a CI to run tests in parallel, as well to build and release free-threaded wheels
  • Check package compliance using Thread Sanitizer (TSAN)
  • Marking each C module as free-threaded compatible

@andfoy andfoy changed the title TST: test bottleneck against pytest-run-parallel TST: enable CPython free-threading support Mar 19, 2025
Copy link
Collaborator

@rgommers rgommers left a comment

Choose a reason for hiding this comment

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

Thanks for working on this @andfoy. Mostly looks good, a few comments.

- name: Install
run: |
pip install .

- name: Test with pytest
run: |
pip install pytest
pytest --pyargs bottleneck
pytest --parallel-threads=$PARALLEL_THREADS --pyargs bottleneck
Copy link
Collaborator

Choose a reason for hiding this comment

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

This doesn't look correct, since pytest-run-parallel is only installed for cp313t. On other Python versions, this should result in:

pytest: error: unrecognized arguments: --parallel-threads=

It's annoying that CI doesn't run on this PR, but can you try running the CI job on your own fork to make sure it passes? (same for wheel builds)

@rdbisme
Copy link
Collaborator

rdbisme commented Mar 29, 2025

I have approved the workflows, so now the CI will run here!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants