Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Python 3.12 #39

Merged
merged 4 commits into from
Nov 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/spectrumdevice-integration-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11"]
python-version: ["3.9", "3.10", "3.11", "3.12"]

steps:
- uses: actions/checkout@v3
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/spectrumdevice-linters.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
strategy:

matrix:
python-version: ["3.11"]
python-version: ["3.12"]

steps:
- uses: actions/checkout@v3
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/spectrumdevice-unit-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11"]
python-version: ["3.9", "3.10", "3.11", "3.12"]

steps:
- uses: actions/checkout@v3
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ Limitations section for more information.
* [PyPI](https://pypi.org/project/spectrumdevice/)

## Requirements
Python 3.9+

`spectrumdevice` works with hardware on Windows and Linux. Spectrum do not currently provide a hardware driver for
macOS, but `spectrumdevice` provides mock classes for development and testing without hardware, which work on macOS.

Expand Down
14 changes: 7 additions & 7 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ classifiers =
Operating System :: POSIX :: Linux
Operating System :: Microsoft :: Windows :: Windows 10
Operating System :: MacOS :: MacOS X
Programming Language :: Python :: 3.8
Programming Language :: Python :: 3.9
Programming Language :: Python :: 3.10
Programming Language :: Python :: 3.11
Programming Language :: Python :: 3.11
Programming Language :: Python :: 3.12
Topic :: Scientific/Engineering
Typing :: Typed
project_urls =
Expand Down Expand Up @@ -48,20 +48,20 @@ test=pytest

[options.extras_require]
test =
pytest == 6.2.5
pytest == 7.4.3
dev =
flake8 == 4.0
flake8-bugbear == 21.9.2
flake8 == 6.1.0
flake8-bugbear == 23.9.16
black == 22.3.0
mypy == 1.3.0
mypy == 1.6.1
types-setuptools == 67.8.0.0
doc =
pdoc == 8.0.1
examples =
matplotlib >= 3.5.0

[mypy]
python_version = 3.11
python_version = 3.12
warn_unused_configs = True
disallow_subclassing_any = True
disallow_untyped_calls = True
Expand Down
14 changes: 7 additions & 7 deletions src/spectrumdevice/spectrum_wrapper/error_handler.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
"""Defines an error handling wrapper function for wrapping calls to the Spectrum API."""

# Christian Baker, King's College London
# Copyright (c) 2021 School of Biomedical Engineering & Imaging Sciences, King's College London
# Licensed under the MIT. You may obtain a copy at https://opensource.org/licenses/MIT.

import logging
from functools import wraps
from importlib import resources
from typing import Callable, Dict, Any

from pkg_resources import resource_filename

from spectrumdevice.exceptions import SpectrumApiCallFailed, SpectrumFIFOModeHardwareBufferOverrun
from spectrum_gmbh.spcerr import (
ERR_OK,
Expand All @@ -24,10 +22,12 @@

def _parse_errors_table() -> Dict[int, str]:
errors: Dict[int, str] = {}
with open(resource_filename(__name__, "spectrum_errors.csv"), "r") as f:
for line in f.readlines():
cells = line.split(",")
errors[int(cells[2].strip())] = cells[3].strip()
errors_file = resources.files(__package__) / "spectrum_errors.csv"
with resources.as_file(errors_file) as file_path:
with open(file_path) as f:
for line in f.readlines():
cells = line.split(",")
errors[int(cells[2].strip())] = cells[3].strip()
return errors


Expand Down
Loading