diff --git a/.github/workflows/.pre-commit.yml b/.github/workflows/.pre-commit.yml deleted file mode 100644 index 7fe7e0c..0000000 --- a/.github/workflows/.pre-commit.yml +++ /dev/null @@ -1,19 +0,0 @@ -name: pre-commit - -on: - pull_request: - -jobs: - pre-commit: - runs-on: ubuntu-latest - - strategy: - matrix: - python-version: [ "3.10" ] - - steps: - - uses: actions/checkout@v4 - - uses: actions/setup-python@v4 - with: - python-version: ${{ matrix.python-version }} - - uses: pre-commit/action@v3.0.0 diff --git a/.github/workflows/pre-commit.yml b/.github/workflows/pre-commit.yml new file mode 100644 index 0000000..44048ab --- /dev/null +++ b/.github/workflows/pre-commit.yml @@ -0,0 +1,26 @@ +name: pre-commit + +on: + pull_request: + +jobs: + pre-commit: + runs-on: ubuntu-latest + + strategy: + matrix: + python-version: [ "3.12" ] + + steps: + - name: Checkout source repository + uses: actions/checkout@v4 + - name: Set up python ${{ matrix.python-version }} + uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python-version }} + - name: Install dependencies for testing + run: | + python3 -m pip install --upgrade pip + python3 -m pip install .[test] + - name: Run pre-commit + uses: pre-commit/action@v3.0.1 diff --git a/.github/workflows/publish-pypi.yml b/.github/workflows/publish-pypi.yml index 20b71f5..dfb6970 100644 --- a/.github/workflows/publish-pypi.yml +++ b/.github/workflows/publish-pypi.yml @@ -13,7 +13,7 @@ jobs: strategy: matrix: - python-version: [ "3.10" ] + python-version: [ "3.12" ] steps: - name: Checkout source repository diff --git a/.github/workflows/publish-test-pypi.yml b/.github/workflows/publish-test-pypi.yml index 6c6eba7..ead9b38 100644 --- a/.github/workflows/publish-test-pypi.yml +++ b/.github/workflows/publish-test-pypi.yml @@ -16,7 +16,7 @@ jobs: strategy: matrix: - python-version: [ "3.10" ] + python-version: [ "3.12" ] steps: - name: Checkout source repository diff --git a/.github/workflows/pylint.yml b/.github/workflows/pylint.yml index b3f6a8e..ffabb87 100644 --- a/.github/workflows/pylint.yml +++ b/.github/workflows/pylint.yml @@ -16,7 +16,7 @@ jobs: strategy: matrix: - python-version: [ "3.10", "3.11" ] + python-version: [ "3.10", "3.11", "3.12" ] steps: - name: Checkout source repository diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index a49de25..3cc1341 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -2,19 +2,23 @@ # See https://pre-commit.com/hooks.html for more hooks repos: - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.4.0 + rev: v4.5.0 hooks: + - id: check-executables-have-shebangs # Check for invalid files - id: check-toml # Check Python files + - id: end-of-file-fixer - id: fix-encoding-pragma args: [--remove] - - id: end-of-file-fixer - id: mixed-line-ending args: [--fix=lf] - id: check-executables-have-shebangs + - id: requirements-txt-fixer + - id: trailing-whitespace + args: [--markdown-linebreak-ext=md] - repo: https://github.com/psf/black - rev: 23.9.1 + rev: 24.4.2 hooks: - id: black - repo: https://github.com/asottile/blacken-docs @@ -23,7 +27,7 @@ repos: - id: blacken-docs args: [--line-length=120] - repo: https://github.com/PyCQA/isort - rev: 5.12.0 + rev: 5.13.2 hooks: - id: isort - repo: local @@ -35,6 +39,6 @@ repos: types: [python] require_serial: true - repo: https://github.com/pre-commit/mirrors-mypy - rev: 'v1.5.1' + rev: 'v1.10.0' hooks: - id: mypy diff --git a/README.md b/README.md index 8b75b48..5850297 100644 --- a/README.md +++ b/README.md @@ -83,7 +83,7 @@ The most obvious ones are the following: ## Versioning -I use [SemVer](http://semver.org/) for versioning. For the versions available, see the [tags on this repository](../../tags). +I use [SemVer](http://semver.org/) for versioning. For the versions available, see the [tags on this repository](../../tags). ## Documentation I use the [Numpydoc](https://numpydoc.readthedocs.io/en/latest/format.html) style for documentation. diff --git a/pylintrc b/pylintrc deleted file mode 100644 index af20646..0000000 --- a/pylintrc +++ /dev/null @@ -1,6 +0,0 @@ -[MASTER] -# Needed to find the module if it is not yet installed in the python module directory -init-hook="from pylint.config import find_pylintrc; import os, sys; sys.path.append(os.path.dirname(find_pylintrc()))" - -[MESSAGES CONTROL] -disable=line-too-long diff --git a/pyproject.toml b/pyproject.toml index 5289425..0674e2f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,5 +1,5 @@ [project] -name = "ug_gpib" +name = "ug-gpib" authors = [ { name="Patrick Baus", email="patrick.baus@physik.tu-darmstadt.de" }, { name="Jacob Alexander", email="haata@kiibohd.com" }, @@ -10,7 +10,6 @@ license = { text="GNU General Public License v3 (GPLv3)" } requires-python = ">=3.7" classifiers = [ "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.7", "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", @@ -42,7 +41,7 @@ dev = [ ] test = [ - "mypy", "pylint", + "mypy", "pylint", "setuptools", ] [tool.pylint.'MESSAGES CONTROL'] diff --git a/ug_gpib/__init__.py b/ug_gpib/__init__.py index da3c194..3907129 100644 --- a/ug_gpib/__init__.py +++ b/ug_gpib/__init__.py @@ -1,5 +1,6 @@ """ A python library for the LQ Electronics Corp. UGPlus USB to GPIB Controller. """ + from ._version import __version__ from .ug_gpib import UGPlusGpib diff --git a/ug_gpib/_version.py b/ug_gpib/_version.py index 9a5e45c..956b05b 100644 --- a/ug_gpib/_version.py +++ b/ug_gpib/_version.py @@ -1,4 +1,5 @@ """ Version information. """ + __version__ = "1.2.1" diff --git a/ug_gpib/gpib_helper.py b/ug_gpib/gpib_helper.py index c156a98..81b4d14 100644 --- a/ug_gpib/gpib_helper.py +++ b/ug_gpib/gpib_helper.py @@ -1,6 +1,7 @@ """ Helper functions supporting the UGPlusGpib library. """ + import errno from typing import Generator diff --git a/ug_gpib/ug_gpib.py b/ug_gpib/ug_gpib.py index e840f84..e833639 100644 --- a/ug_gpib/ug_gpib.py +++ b/ug_gpib/ug_gpib.py @@ -1,6 +1,7 @@ """ A pure Python module for the LQ Electronics Corp UGPlus USB to GPIB Controller using pyUSB. """ + from __future__ import annotations import errno @@ -208,7 +209,8 @@ def __device_read(self, command_expected: UgPlusCommands) -> bytes | None: byte_data = self._usb_read(length - 2) self.__logger.debug( - "Received packet:\n Header:\n Command: %(command)r\n Length %(length)d\n Payload:\n %(payload)s.", + "Received packet:\n Header:\n Command: %(command)r\n Length %(length)d\n Payload:" + "\n %(payload)s.", {"command": command, "length": length, "payload": [hex(i) for i in byte_data]}, )