Skip to content

Commit

Permalink
Merge pull request #2004 from minrk/313t
Browse files Browse the repository at this point in the history
try testing with free-threading
  • Loading branch information
minrk authored Aug 2, 2024
2 parents 1ce5474 + 8e78ea9 commit 00bae19
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 5 deletions.
56 changes: 52 additions & 4 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ jobs:
zmq: bundled

- os: macos-14
python: "3.13-dev"
python: "3.13"
zmq: bundled

- os: macos-13
Expand Down Expand Up @@ -86,7 +86,11 @@ jobs:
python: "3.12"

- os: ubuntu-22.04
python: "3.13-dev"
python: "3.13"

- os: ubuntu-22.04
python: "3.13"
free_threading: free_threading

- os: windows-2022
python: "3.7"
Expand All @@ -97,21 +101,48 @@ jobs:
arch: x64

- os: windows-2022
python: "3.13-dev"
python: "3.13"
arch: x64

steps:
- uses: actions/checkout@v4

- name: setup python
uses: actions/setup-python@v5
if: ${{ !matrix.free_threading }}
with:
python-version: ${{ matrix.python }}
architecture: ${{ matrix.arch || 'x64' }}
# allows us to use '3.12' and get '-dev' while we wait
allow-prereleases: true
cache: pip

- name: setup python (free threading)
if: ${{ matrix.free_threading }}
uses: mamba-org/setup-micromamba@v1
with:
environment-name: nogil
condarc: |
channels:
- ad-testing/label/py313_nogil
- defaults
create-args: >-
python=${{ matrix.python-version }}
pip
- name: activate python (free threading)
if: ${{ matrix.free_threading }}
# light activate, just add env to path
# run this in micromamba-shell
# so we don't have to for the rest
run: |
echo $PATH
echo "PATH=$PATH" >> "$GITHUB_ENV"
echo "PYTHON_GIL=0" >> "$GITHUB_ENV"
shell: micromamba-shell {0}



- name: setup coverage
if: startsWith(matrix.python, 'pypy') || startsWith(matrix.python, '3.12')
run: |
Expand All @@ -127,6 +158,17 @@ jobs:
run: |
pip install --upgrade pip wheel
pip install -r test-requirements.txt
- name: install free-threading dependencies
if: ${{ matrix.free_threading }}
run: |
conda info
which -a python
which -a pip
# need build deps for no-build-isolation
# remove after Cython 3.1
pip install scikit-build-core ninja packaging
pip install --upgrade --pre -i https://pypi.anaconda.org/scientific-python-nightly-wheels/simple cython
- name: remove tornado
if: matrix.tornado == 'none'
Expand Down Expand Up @@ -180,12 +222,18 @@ jobs:
echo ZMQ_DRAFT_API=1 >> "$GITHUB_ENV"
- name: build pyzmq
if: ${{ !matrix.free_threading }}
run: |
pip install -v -e .
- name: build pyzmq (free threading)
if: ${{ matrix.free_threading }}
run: |
pip install -v --no-build-isolation .
- name: import zmq
run: |
python -c "import zmq"
python -I -c "import zmq"
- name: run tests
run: |
Expand Down
2 changes: 1 addition & 1 deletion examples/cython/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@
include_dirs=zmq.get_includes() + [numpy.get_include()],
)
]
setup(name="cython-zmq-example", ext_modules=cythonize(extensions))
setup(name="cython-zmq-example", ext_modules=cythonize(extensions)) # type: ignore
1 change: 1 addition & 0 deletions zmq/backend/cython/_zmq.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# cython: freethreading_compatible = True
"""Cython backend for pyzmq"""

# Copyright (C) PyZMQ Developers
Expand Down

0 comments on commit 00bae19

Please sign in to comment.