Skip to content

Commit bb68aea

Browse files
authored
nidaqmx: Restore Python 3.9 support for internal testing (#889)
* nidaqmx: Restore Python 3.9 support for internal testing * chore: Update poetry.lock
1 parent 31fe4d7 commit bb68aea

File tree

23 files changed

+974
-51
lines changed

23 files changed

+974
-51
lines changed

.github/workflows/run_unit_tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ jobs:
1111
strategy:
1212
matrix:
1313
os: [ubuntu-latest, windows-latest]
14-
python-version: ["3.10", "3.11", "3.12", "3.13", "3.14", "3.14t", "pypy3.10", "pypy3.11"]
14+
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13", "3.14", "3.14t", "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

CHANGELOG.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ All notable changes to this project will be documented in this file.
3434
* [862: docs tox env fails on rdss-nidaqmxbot-win-10-py32](https://github.com/ni/nidaqmx-python/issues/862)
3535

3636
* ### Major Changes
37-
* Removed support for Python 3.9.
3837
* (IN PROGRESS behind "WAVEFORM_SUPPORT" feature toggle) Added support for reading and writing Waveform data through gRPC using [NI gRPC Device Server](https://github.com/ni/grpc-device).
3938

4039
* ### Known Issues

README.rst

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

58-
**nidaqmx** supports CPython 3.10+.
58+
**nidaqmx** supports CPython 3.9+.
5959

6060
**nidaqmx** supports PyPy3 for non-gRPC use cases. For the status of PyPy support for gRPC,
6161
see `PyPy support (grpc/grpc#4221) <https://github.com/grpc/grpc/issues/4221>`_.

examples/synchronization/multi_function/cont_ai_ci_tdms_sync.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
3. Log data from multiple tasks to a single TDMS file
77
"""
88

9+
from __future__ import annotations
10+
911
import os
1012
import queue
1113
import threading

generated/nidaqmx/__init__.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
"""The NI-DAQmx API for Python."""
22

3+
from importlib.metadata import version
4+
35
from nidaqmx.errors import (
46
DaqError,
57
DaqReadError,
@@ -12,11 +14,6 @@
1214
from nidaqmx.task import Task
1315
from nidaqmx.types import CtrFreq, CtrTick, CtrTime
1416

15-
try:
16-
from importlib.metadata import version
17-
except ImportError:
18-
from importlib_metadata import version # type: ignore[no-redef]
19-
2017
__version__ = version(__name__)
2118

2219
__all__ = [ # noqa: F405 - 'errors' may be undefined, or defined from star imports: nidaqmx.grpc_session_options (auto-generated noqa)

generated/nidaqmx/_dotenvpath.py

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,12 +45,27 @@ def _get_caller_path() -> Path | None:
4545
for frame, _ in traceback.walk_stack(inspect.currentframe()):
4646
if frame.f_code.co_filename:
4747
module_path = Path(frame.f_code.co_filename)
48-
if module_path.exists() and not module_path.is_relative_to(package_path):
48+
if _exists(module_path) and not module_path.is_relative_to(package_path):
4949
return module_path
5050

5151
return None
5252

5353

54+
# Path.exists() throws OSError when the path has invalid file characters.
55+
# https://github.com/python/cpython/issues/79487
56+
if sys.version_info >= (3, 10):
57+
58+
def _exists(path: Path) -> bool:
59+
return path.exists()
60+
61+
else:
62+
63+
def _exists(path: Path) -> bool:
64+
import os
65+
66+
return os.path.exists(path)
67+
68+
5469
def _get_package_path() -> Path:
5570
"""Get the path of this package."""
5671
module = sys.modules[__package__]

generated/nidaqmx/_feature_toggles.py

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
from __future__ import annotations
44

55
import functools
6-
import sys
76
from collections.abc import Callable
87
from enum import Enum
98
from typing import TYPE_CHECKING, TypeVar
@@ -14,12 +13,7 @@
1413
from nidaqmx.errors import FeatureNotSupportedError
1514

1615
if TYPE_CHECKING:
17-
from typing import ParamSpec
18-
19-
if sys.version_info >= (3, 11):
20-
from typing import Self
21-
else:
22-
from typing_extensions import Self
16+
from typing_extensions import ParamSpec, Self
2317

2418
_P = ParamSpec("_P")
2519
_T = TypeVar("_T")

generated/nidaqmx/_lib.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
)
1818

1919
if TYPE_CHECKING:
20-
from typing import TypeAlias
20+
from typing_extensions import TypeAlias
2121

2222

2323
_DAQ_NOT_FOUND_MESSAGE = (

generated/nidaqmx/_library_interpreter.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
from nitypes.waveform import AnalogWaveform, DigitalWaveform, SampleIntervalMode, Timing, ExtendedPropertyDictionary
2727

2828
if TYPE_CHECKING:
29-
from typing import TypeAlias
29+
from typing_extensions import TypeAlias
3030

3131
_logger = logging.getLogger(__name__)
3232
_was_runtime_environment_set = None

generated/nidaqmx/system/physical_channel.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# Do not edit this file; it was automatically generated.
22

3+
from __future__ import annotations
4+
35
import ctypes
46
import numpy
57
import pathlib

0 commit comments

Comments
 (0)