From e748964cac9ce1e2d27ef97c684936d300d8a868 Mon Sep 17 00:00:00 2001 From: Anthony Romaniello <66272872+aromanielloNTIA@users.noreply.github.com> Date: Thu, 7 Nov 2024 17:18:50 -0500 Subject: [PATCH 1/3] Update pre-commit hooks --- .pre-commit-config.yaml | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 824a318..f2b8ba5 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,8 +1,6 @@ -default_language_version: - python: python3.8 repos: - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.5.0 + rev: v5.0.0 hooks: - id: check-ast types: [file, python] @@ -16,10 +14,10 @@ repos: - id: end-of-file-fixer - id: trailing-whitespace - repo: https://github.com/asottile/pyupgrade - rev: v3.15.2 + rev: v3.19.0 hooks: - id: pyupgrade - args: ["--py38-plus"] + args: ["--py39-plus"] - repo: https://github.com/pycqa/isort rev: 5.13.2 hooks: @@ -28,12 +26,12 @@ repos: types: [file, python] args: ["--profile", "black", "--filter-files", "--gitignore"] - repo: https://github.com/psf/black - rev: 24.4.2 + rev: 24.10.0 hooks: - id: black types: [file, python] - repo: https://github.com/igorshubovych/markdownlint-cli - rev: v0.40.0 + rev: v0.42.0 hooks: - id: markdownlint types: [file, markdown] From e8568b88a33cc7445f05af70640181a79af4ab62 Mon Sep 17 00:00:00 2001 From: Anthony Romaniello <66272872+aromanielloNTIA@users.noreply.github.com> Date: Thu, 7 Nov 2024 17:28:09 -0500 Subject: [PATCH 2/3] Drop Python 3.8 support --- README.md | 4 ++-- pyproject.toml | 10 +++++----- src/rsa_api/__init__.py | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index c5461a4..4017d65 100644 --- a/README.md +++ b/README.md @@ -33,7 +33,7 @@ instead of using this wrapper. ## Installation -Requires `python>=3.8`, `numpy>=1.22`, and the Tektronix RSA API for Linux. +Requires `python>=3.9`, `numpy>=1.25`, and the Tektronix RSA API for Linux. First, download and install the [RSA API for Linux](https://www.tek.com/spectrum-analyzer/rsa306-software/rsa-application-programming-interface--api-for-64bit-linux--v100014) @@ -128,7 +128,7 @@ as errors and handled as configured in `IQSTREAM_StatusParser`. Set up a development environment using a tool like [Conda](https://docs.conda.io/en/latest/) -or [venv](https://docs.python.org/3/library/venv.html#module-venv), with `python>=3.8`. +or [venv](https://docs.python.org/3/library/venv.html#module-venv). Then, from the cloned directory, install the development dependencies by running: ```bash diff --git a/pyproject.toml b/pyproject.toml index 1f57a49..054de2e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -7,7 +7,7 @@ name = "tekrsa-api-wrap" dynamic = ["version"] description = "NTIA/ITS Python wrapper for the Tektronix RSA API for Linux" readme = "README.md" -requires-python = ">=3.8" +requires-python = ">=3.9" license = { file = "LICENSE.md" } authors = [ @@ -31,22 +31,22 @@ classifiers = [ "Operating System :: POSIX :: Linux", "Programming Language :: Python", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", + "Programming Language :: Python :: 3.13", ] dependencies = [ - "numpy>=1.22", + "numpy>=1.25", ] [project.optional-dependencies] dev = [ "hatchling>=1.6.0,<2.0", - "pre-commit>=2.20.0", - "twine>=4.0.1,<5.0", + "pre-commit>=4.0,<5.0", + "twine>=5.0,<6.0", ] [project.urls] diff --git a/src/rsa_api/__init__.py b/src/rsa_api/__init__.py index 4205a81..fcaa7f9 100644 --- a/src/rsa_api/__init__.py +++ b/src/rsa_api/__init__.py @@ -1,3 +1,3 @@ from .rsa_api import * -__version__ = "1.3.3" +__version__ = "2.0.0" From 1661c6cbc8fb74740862972a807e0be9155f3682 Mon Sep 17 00:00:00 2001 From: Anthony Romaniello <66272872+aromanielloNTIA@users.noreply.github.com> Date: Thu, 7 Nov 2024 17:28:54 -0500 Subject: [PATCH 3/3] Run pre-commit hooks on all files --- src/rsa_api/rsa_api.py | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/src/rsa_api/rsa_api.py b/src/rsa_api/rsa_api.py index 0231f90..d4df736 100644 --- a/src/rsa_api/rsa_api.py +++ b/src/rsa_api/rsa_api.py @@ -10,7 +10,7 @@ from enum import Enum from os.path import abspath, join from time import sleep -from typing import Any, Tuple, Union +from typing import Any, Union import numpy as np @@ -1016,7 +1016,7 @@ def DEVICE_Stop(self) -> None: """ self.err_check(self.rsa.DEVICE_Stop()) - def DEVICE_GetEventStatus(self, event_id: str) -> Tuple[bool, int]: + def DEVICE_GetEventStatus(self, event_id: str) -> tuple[bool, int]: """ Return global device real-time event status. @@ -1057,7 +1057,7 @@ def DEVICE_GetEventStatus(self, event_id: str) -> Tuple[bool, int]: # IQ BLOCK METHODS - def IQBLK_GetIQAcqInfo(self) -> Tuple[int, int, int, int]: + def IQBLK_GetIQAcqInfo(self) -> tuple[int, int, int, int]: """ Return IQ acquisition status info for the most recent IQ block. @@ -1133,7 +1133,7 @@ def IQBLK_GetIQData(self, req_length: int) -> np.ndarray: def IQBLK_GetIQDataDeinterleaved( self, req_length: int - ) -> Tuple[np.ndarray, np.ndarray]: + ) -> tuple[np.ndarray, np.ndarray]: """ Retrieve an IQ block data record in separate I and Q array format. @@ -1316,7 +1316,7 @@ def IQSTREAM_ClearAcqStatus(self) -> None: """ self.err_check(self.rsa.IQSTREAM_ClearAcqStatus()) - def IQSTREAM_GetAcqParameters(self) -> Tuple[float, float]: + def IQSTREAM_GetAcqParameters(self) -> tuple[float, float]: """ Retrieve the processing parameters of IQ streaming output bandwidth and sample rate, resulting from the user's requested bandwidth. @@ -1394,7 +1394,7 @@ def IQSTREAM_GetDiskFileInfo(self) -> _IQStreamFileInfo: self.err_check(self.rsa.IQSTREAM_GetDiskFileInfo(byref(file_info))) return file_info - def IQSTREAM_GetDiskFileWriteStatus(self) -> Tuple[bool, bool]: + def IQSTREAM_GetDiskFileWriteStatus(self) -> tuple[bool, bool]: """ Allow monitoring the progress of file output. @@ -1430,7 +1430,7 @@ def IQSTREAM_GetEnable(self) -> bool: def IQSTREAM_GetIQData( self, dtype: str, buffer_size: int - ) -> Tuple[np.ndarray, int, _IQStreamIQInfo]: + ) -> tuple[np.ndarray, int, _IQStreamIQInfo]: """ Retrieve interleaved IQ data generated by IQ Stream processing. @@ -1761,7 +1761,7 @@ def SPECTRUM_GetSettings(self) -> dict: def SPECTRUM_GetTrace( self, trace: str, max_trace_points: int - ) -> Tuple[np.ndarray, int]: + ) -> tuple[np.ndarray, int]: """ Return the spectrum trace data. @@ -1825,7 +1825,7 @@ def SPECTRUM_GetTraceInfo(self) -> dict: } return info_dict - def SPECTRUM_GetTraceType(self, trace: str) -> Tuple[bool, str]: + def SPECTRUM_GetTraceType(self, trace: str) -> tuple[bool, str]: """ Query the trace settings. @@ -2211,7 +2211,7 @@ def DEVICE_SearchAndConnect(self, verbose: bool = False) -> None: def IQSTREAM_Tempfile_NoConfig( self, duration_msec: int, return_status: bool = False - ) -> Union[np.ndarray, Tuple[np.ndarray, str]]: + ) -> Union[np.ndarray, tuple[np.ndarray, str]]: """ Retrieve IQ data from device by first writing to a tempfile. Does not perform any device configuration: only captures data. @@ -2304,7 +2304,7 @@ def IQSTREAM_Tempfile( bw: Union[float, int], duration_msec: int, return_status: bool = False, - ) -> Union[np.ndarray, Tuple[np.ndarray, str]]: + ) -> Union[np.ndarray, tuple[np.ndarray, str]]: """ Retrieve IQ data from device by first writing to a tempfile. Tunes device parameters before recording: center frequency, @@ -2509,7 +2509,7 @@ def IQSTREAMIQInfo_StatusParser( def SPECTRUM_Acquire( self, trace: str = "Trace1", trace_points: int = 801, timeout_msec: int = 50 - ) -> Tuple[np.ndarray, int]: + ) -> tuple[np.ndarray, int]: """ Acquire spectrum trace. @@ -2567,7 +2567,7 @@ def IQBLK_Configure( def IQBLK_Acquire( self, rec_len: int = 1024, timeout_ms: int = 50 - ) -> Tuple[np.ndarray, np.ndarray]: + ) -> tuple[np.ndarray, np.ndarray]: """ Acquire IQBLK data using IQBLK_GetIQDataDeinterleaved. @@ -2637,7 +2637,7 @@ def DEVICE_GetTemperature(self, unit: str = "celsius") -> float: def IQSTREAM_Acquire( self, duration_msec: int, return_status: bool - ) -> Union[np.ndarray, Tuple[np.ndarray, str]]: + ) -> Union[np.ndarray, tuple[np.ndarray, str]]: """ Stream IQ data to a NumPy array.