diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index f246d69..ab39b3b 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -12,7 +12,7 @@ jobs: strategy: matrix: os: [ubuntu-latest, windows-latest, macos-latest] - python-version: ["3.7", "3.11"] + python-version: ["3.8", "3.12"] runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v4 diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 16b5b93..562c5e3 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -6,13 +6,10 @@ repos: rev: v4.5.0 hooks: - id: check-added-large-files - - id: check-builtin-literals - id: check-case-conflict - - id: check-docstring-first - id: check-merge-conflict - id: check-toml - id: check-yaml - - id: debug-statements - id: end-of-file-fixer - id: mixed-line-ending args: [--fix=lf] @@ -21,11 +18,8 @@ repos: rev: v0.1.9 hooks: - id: ruff - args: [--fix, --exit-non-zero-on-fix] - - repo: https://github.com/psf/black-pre-commit-mirror - rev: 23.12.1 - hooks: - - id: black + args: [--fix] + - id: ruff-format - repo: https://github.com/pre-commit/mirrors-mypy rev: v1.8.0 hooks: diff --git a/.vscode/settings.json b/.vscode/settings.json index 29ef66e..50b126b 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,12 +1,11 @@ { - "python.formatting.provider": "none", "python.testing.pytestEnabled": true, "python.testing.unittestEnabled": false, "[python]": { - "editor.defaultFormatter": "ms-python.black-formatter", + "editor.defaultFormatter": "charliermarsh.ruff", "editor.formatOnSave": true, "editor.codeActionsOnSave": { - "source.organizeImports": true - } + "source.organizeImports": "explicit", + }, }, } diff --git a/README.md b/README.md index ff35e23..c2723ee 100644 --- a/README.md +++ b/README.md @@ -1,12 +1,10 @@ # lsports -A simple Python 3.7+ module to list serial ports on Windows, Linux, and macOS. +A simple Python module to list serial ports on Windows, Linux, and macOS. This is a modified version of `serial.tools.list_ports` from -[pySerial](https://github.com/pyserial/pyserial) ([license](licenses/pyserial_LICENSE)). - -The goal of this project is to integrate some fixes and improvements to the original *list_ports* -functionality with a faster release cycle. +[pySerial](https://github.com/pyserial/pyserial) with the goal of integrating some fixes and +improvements to the original *list_ports* functionality with a faster release cycle. ## Installation @@ -27,7 +25,6 @@ for port in comports(): For a full list of available attributes, see the `PortInfo` class. Only `comports` and `PortInfo` are considered public API. - ## Notable changes from `serial.tools.list_ports` * The information class name is `PortInfo` instead of `ListPortInfo`. diff --git a/lsports/_macos.py b/lsports/_macos.py index 08f5f76..e5ccb11 100644 --- a/lsports/_macos.py +++ b/lsports/_macos.py @@ -46,8 +46,8 @@ iokit.IOServiceGetMatchingServices.restype = kern_return_t iokit.IORegistryEntryCreateCFProperty.argtypes = ( - ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_uint32 # fmt: skip -) + ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_uint32 +) # fmt: skip iokit.IORegistryEntryCreateCFProperty.restype = ctypes.c_void_p iokit.IORegistryEntryGetPath.argtypes = (ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p) diff --git a/pyproject.toml b/pyproject.toml index c73e394..3f9f322 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -16,7 +16,6 @@ classifiers = [ "Development Status :: 3 - Alpha", "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", - "Programming Language :: Python :: 3.7", "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", @@ -25,7 +24,7 @@ classifiers = [ ] keywords = ["serial", "lsports", "list-ports", "USB", "COM"] dependencies = [] -requires-python = ">=3.7" +requires-python = ">=3.8" urls.Home = "https://github.com/hamdanal/lsports" [tool.hatch] @@ -34,7 +33,7 @@ build.packages = ["lsports"] [tool.tox] legacy_tox_ini = """ [tox] -envlist = py37,py38,py39,py310,py311,py312 +envlist = py38,py39,py310,py311,py312 skip_missing_interpreters = true [testenv] deps = @@ -43,18 +42,15 @@ commands = pytest {posargs} """ -[tool.black] -line_length = 100 - [tool.ruff] line-length = 100 -select = ["E", "F", "B", "UP", "RUF100", "TID"] +extend-select = ["E", "F", "C", "B", "UP", "RUF100", "TID", "T10"] unfixable = ["B"] -ignore = ["E501"] +extend-ignore = ["E501", "C901"] isort.required-imports = ["from __future__ import annotations"] flake8-tidy-imports.ban-relative-imports = "all" -[tool.ruff.per-file-ignores] +[tool.ruff.extend-per-file-ignores] "lsports/_windows.py" = ["E221", "E402"] [tool.mypy]