Skip to content

Commit 131a4d9

Browse files
heevastiHenri Ervasti
andauthored
Py314 and log dir patch (#182)
* [py314-and-log-dir-patch] Making QMI Python 3.14 compatible and fixed a bug in log directory location for services. * [py314-and-log-dir-patch] Adding Python 3.14 also in the CI pipelines and removed unnecessary dependencies in pyproject.toml. --------- Co-authored-by: Henri Ervasti <heevasti@tudelft.nl>
1 parent e3d9c51 commit 131a4d9

File tree

12 files changed

+52
-46
lines changed

12 files changed

+52
-46
lines changed

.github/requirements-ci.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ matplotlib
1111
pyserial
1212
pyusb
1313
python-vxi11
14+
# For legacy python-vxi11
15+
standard-xdrlib
1416
# For miscellaneous functionality
1517
pytz
1618
psutil

.github/workflows/pull-request-ci.yml

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@ env:
1818
jobs:
1919
build:
2020
strategy:
21-
max-parallel: 3
21+
max-parallel: 4
2222
matrix:
23-
python-version: ["3.11", "3.12", "3.13"]
23+
python-version: ["3.11", "3.12", "3.13", "3.14"]
2424

2525
uses: ./.github/workflows/reusable-ci-workflows.yml
2626
with:
@@ -55,7 +55,13 @@ jobs:
5555
name: coverage-results-3.11
5656
path: .
5757

58-
- name: Generate and push badges
58+
- name: Get coverage log file from Python latest build
59+
uses: actions/download-artifact@v4
60+
with:
61+
name: coverage-results-3.14
62+
path: .
63+
64+
- name: Generate and push badges for with python 3.11
5965
run: |
6066
git fetch origin "${{ github.head_ref }}" || true
6167
git checkout "${{ github.head_ref }}"

.github/workflows/reusable-ci-workflows.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,6 @@ jobs:
6868

6969
- name: Run coverage
7070
run: |
71-
if [[ ${{ inputs.python-version }} == "3.13" ]]; \
72-
then pip install py-xdrlib; fi
7371
coverage run --branch --source=$SOURCE_DIRS -m unittest discover --start-directory=tests --pattern="test_*.py"
7472
coverage report --show-missing --fail-under=$COVERAGE_MIN_PERC | tee coverage-${{ inputs.python-version }}.log
7573
COVERAGE_PERC=$(grep "TOTAL" coverage-${{ inputs.python-version }}.log | grep -Eo '[0-9.]+%' | sed 's/%//')

.github/workflows/scheduled-full-ci.yml

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
strategy:
1717
max-parallel: 1
1818
matrix:
19-
python-version: ["3.11", "3.12", "3.13"]
19+
python-version: ["3.11", "3.12", "3.13", "3.14"]
2020

2121
uses: ./.github/workflows/reusable-ci-workflows.yml
2222
with:
@@ -29,7 +29,7 @@ jobs:
2929
strategy:
3030
max-parallel: 1
3131
matrix:
32-
python-version: ["3.11", "3.12", "3.13"]
32+
python-version: ["3.11", "3.12", "3.13", "3.14"]
3333

3434
steps:
3535
- name: Checkout code
@@ -42,10 +42,6 @@ jobs:
4242
with:
4343
python-version: ${{ matrix.python-version }}
4444

45-
- name: Check py-xdrlib installation for Python 3.13
46-
if: ${{ matrix.python-version }} == "3.13"
47-
run: python -m pip install py-xdrlib
48-
4945
- name: Run unit tests and generate report
5046
if: always()
5147
run: |

.gitignore

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,4 +129,7 @@ dmypy.json
129129
.pyre/
130130

131131
# VS code settings
132-
.vscode
132+
.vscode/
133+
134+
# PyCharm
135+
.idea

CHANGELOG.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,15 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
55
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
66

77

8+
## [0.51.2] - 2026-02-20
9+
10+
### Added
11+
- `run` method in `QMI_Context` class as this is now required for Python 3.14, after changes in `threading` module.
12+
13+
### Fixed
14+
- Log file location config for services in `qmi_proc.py`. Location string starting with tilde (~) is now interpreted correctly to be the user's home directory.
15+
- Minor edits in docstrings, tutorial and .gitignore file.
16+
817
## [0.51.1] - 2026-01-26
918

1019
### Fixed

documentation/sphinx/source/tutorial.rst

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -860,16 +860,15 @@ Connecting with USBTMC devices on Windows can be tricky. Make sure you have libu
860860
https://pypi.org/project/libusb1/ and https://pypi.org/project/PyVISA/ (and perhaps pyvisa-py).
861861

862862
Then you'll need to have the backend set-up correctly, in case the ``libusb-1.0.dll`` is not found in your path.
863-
An example script to set-up and test the backend is
864-
```python
865-
import usb.core
866-
from usb.backend import libusb1
863+
An example script to set-up and test the backend is::
867864

868-
backend = libusb1.get_backend(
869-
find_library=lambda x: "<path_to_your_env>\\Lib\\site-packages\\usb1\\libusb-1.0.dll")
865+
import usb.core
866+
from usb.backend import libusb1
870867

871-
dev = list(usb.core.find(find_all=True))
872-
```
868+
backend = libusb1.get_backend(
869+
find_library=lambda x: "<path_to_your_env>\\Lib\\site-packages\\usb1\\libusb-1.0.dll")
870+
871+
dev = list(usb.core.find(find_all=True))
873872

874873
If you can now find devices, the backend is set correctly. There are of course other ways to set-up your backend
875874
as well, but as said, it can be tricky...

pyproject.toml

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ version="0.51.1"
1414
description="The Quantum Measurement Infrastructure framework"
1515
readme = {file = "README.md", content-type = "text/markdown"}
1616
license = {file = "LICENSE.md"}
17-
authors=[{name = "QuTech", email="F.J.Grooteman@tudelft.nl"}]
17+
authors=[{name = "QuTech", email="H.K.Ervasti@tudelft.nl"}]
1818
requires-python=">=3.11, <4"
1919
classifiers=[
2020
# complete classifier list: http://pypi.python.org/pypi?%3Aaction=list_classifiers
@@ -28,17 +28,14 @@ classifiers=[
2828
"Programming Language :: Python :: 3.11",
2929
"Programming Language :: Python :: 3.12",
3030
"Programming Language :: Python :: 3.13",
31+
"Programming Language :: Python :: 3.14",
3132
"Programming Language :: Python :: Implementation :: CPython",
3233
"Programming Language :: Python :: Implementation :: PyPy",
3334
"Topic :: Scientific/Engineering :: Physics",
3435
"Natural Language :: English",
3536
]
3637
keywords=["qmi", "hardware", "software", "interface", "laboratory", "physics"]
3738
dependencies = [
38-
# For generating an installable package and deploying
39-
"setuptools",
40-
"wheel",
41-
"twine",
4239
# For scientific data processing and visualisation
4340
"numpy",
4441
"scipy",
@@ -47,6 +44,8 @@ dependencies = [
4744
"pyserial",
4845
"pyusb",
4946
"python-vxi11",
47+
# For legacy python-vxi11
48+
"standard-xdrlib",
5049
# For miscellaneous functionality
5150
"pytz",
5251
"psutil",

qmi/core/context.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -461,6 +461,12 @@ def resolve_file_name(self, file_name: str) -> str:
461461

462462
return os.path.normpath(string.Template(file_name).substitute(mapping))
463463

464+
def run(self, _rpc_thread_run: Callable) -> None:
465+
"""Run thread. From Python 3.14 onwards objects that are run within a context, need a `run` method with
466+
a single input where the callable to run is given. Addition of this function should have no effect when
467+
using earlier Python versions."""
468+
_rpc_thread_run()
469+
464470
def start(self) -> None:
465471
"""Start the context.
466472

qmi/core/transport.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1321,7 +1321,7 @@ def create_transport(
13211321
- "port" (for UDP and TCP transports) specifies the UDP/TCP port number of the server/client.
13221322
- "connect_timeout" is TCP connection timeout.
13231323
1324-
Serial:
1324+
Serial:
13251325
- "device" is the name of the serial port, for example "COM3" or "/dev/ttyUSB0".
13261326
- "baudrate" specifies the number of bits per second.
13271327
This attribute is only required for instruments with a configurable baud rate.

0 commit comments

Comments
 (0)