Skip to content

Commit df4fa7f

Browse files
authored
Clarify PyPy support and enable unit testing with PyPy (#805)
* github: Add PyPy support to run_unit_tests.yml * github: Fix order of startsWith arguments * github: Fix install-opts evaluation * docs: Clarify PyPy support * docs: Link to gRPC PyPy GitHub issue * github: Test installdriver with PyPy
1 parent 6bcb66b commit df4fa7f

File tree

3 files changed

+45
-26
lines changed

3 files changed

+45
-26
lines changed

.github/workflows/run_unit_tests.yml

Lines changed: 40 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,13 @@ jobs:
1111
strategy:
1212
matrix:
1313
os: [ubuntu-latest, windows-latest]
14-
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
14+
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13", "pypy3.10", "pypy3.11"]
1515
# Fail-fast skews the pass/fail ratio and seems to make pytest produce
1616
# incomplete JUnit XML results.
1717
fail-fast: false
18+
env:
19+
install-opts: ${{ !startsWith(matrix.python-version, 'pypy') && '--extras grpc' || '' }}
20+
pytest-opts: ${{ startsWith(matrix.python-version, 'pypy') && '-k "not grpc"' || '' }}
1821
steps:
1922
- name: Check out repo
2023
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
@@ -25,36 +28,48 @@ jobs:
2528
python-version: ${{ matrix.python-version }}
2629
- name: Set up Poetry
2730
uses: ni/python-actions/setup-poetry@5286c12d65d90b2ea738bd57d452dc4366497581 # v0.4.1
28-
- name: Restore cached virtualenv (main only)
29-
uses: actions/cache/restore@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
30-
id: restore-nidaqmx-main-only
31-
with:
32-
path: .venv
33-
key: nidaqmx-main-only-${{ runner.os }}-py${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('poetry.lock') }}
34-
- name: Install main package dependencies
35-
run: |
36-
python -m pip install --upgrade pip
37-
poetry install --only main
38-
- name: check installdriver subcommand can be invoked
39-
run: poetry run nidaqmx installdriver --help
40-
- name: Save cached virtualenv (main only)
41-
uses: actions/cache/save@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
42-
if: steps.restore-nidaqmx-main-only.outputs.cache-hit != 'true'
43-
with:
44-
path: .venv
45-
key: ${{ steps.restore-nidaqmx-main-only.outputs.cache-primary-key }}
46-
- name: Cache virtualenv (with dev dependencies)
31+
- name: Cache virtualenv (with test dependencies)
4732
uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
4833
with:
4934
path: .venv
50-
key: nidaqmx-with-dev-${{ runner.os }}-py${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('poetry.lock') }}
51-
- name: Install dev dependencies
52-
run: poetry install
35+
key: nidaqmx-with-test-${{ runner.os }}-py${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('poetry.lock') }}
36+
- name: Install test dependencies
37+
run: poetry install --only main,test ${{ env.install-opts }}
5338
- name: Run unit tests
54-
run: poetry run pytest -v --cov=generated/nidaqmx --junitxml=test_results/unit-${{ matrix.os }}-py${{ matrix.python-version }}.xml tests/unit
39+
run: poetry run pytest -v --cov=generated/nidaqmx --junitxml=test_results/unit-${{ matrix.os }}-py${{ matrix.python-version }}.xml tests/unit ${{ env.pytest-opts }}
5540
- name: Upload test results
5641
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
5742
with:
5843
name: test_results_unit_${{ matrix.os }}_py${{ matrix.python-version }}
5944
path: test_results/*.xml
60-
if: always()
45+
if: always()
46+
test_installdriver:
47+
name: Test installdriver
48+
runs-on:
49+
- ${{ matrix.os }}
50+
strategy:
51+
matrix:
52+
os: [ubuntu-latest, windows-latest]
53+
python-version: ["3.9", "3.13", "pypy3.11"]
54+
steps:
55+
- name: Check out repo
56+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
57+
- name: Set up Python ${{ matrix.python-version }}
58+
uses: ni/python-actions/setup-python@5286c12d65d90b2ea738bd57d452dc4366497581 # v0.4.1
59+
id: setup-python
60+
with:
61+
python-version: ${{ matrix.python-version }}
62+
- name: Set up Poetry
63+
uses: ni/python-actions/setup-poetry@5286c12d65d90b2ea738bd57d452dc4366497581 # v0.4.1
64+
- name: Cache virtualenv (main only)
65+
uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
66+
id: cache-nidaqmx-main-only
67+
with:
68+
path: .venv
69+
key: nidaqmx-main-only-${{ runner.os }}-py${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('poetry.lock') }}
70+
- name: Install main package dependencies
71+
run: |
72+
python -m pip install --upgrade pip
73+
poetry install --only main
74+
- name: check installdriver subcommand can be invoked
75+
run: poetry run nidaqmx installdriver --help

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ All notable changes to this project will be documented in this file.
4141
distribution package and affected clients. Adding PyPy-specific constraints exacerbated
4242
this problem. Now, the distribution package specifies only a lower bound for the `numpy`
4343
and `click` versions.
44+
* Clarify PyPy support and enable unit testing with PyPy.
4445

4546
* ### Known Issues
4647
* ...

README.rst

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,10 @@ system.
5555
Python Version Support
5656
----------------------
5757

58-
**nidaqmx** supports CPython 3.9+ and PyPy3.
58+
**nidaqmx** supports CPython 3.9+.
59+
60+
**nidaqmx** supports PyPy3 for non-gRPC use cases. For the status of PyPy support for gRPC,
61+
see `PyPy support (grpc/grpc#4221) <https://github.com/grpc/grpc/issues/4221>`_.
5962

6063
Installation
6164
============

0 commit comments

Comments
 (0)