diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 82c08a66..1360832b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -7,6 +7,9 @@ on: branches: - master +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true jobs: pre-commit: @@ -33,12 +36,12 @@ jobs: fail-fast: false matrix: os: [ubuntu-latest] - python-version: ["3.7", "3.8", "3.9", "3.10", "3.11"] + python-version: ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12"] include: - {os: macos-latest, python-version: '3.7'} - - {os: macos-latest, python-version: '3.11'} + - {os: macos-latest, python-version: '3.12'} - {os: windows-latest, python-version: '3.7'} - - {os: windows-latest, python-version: '3.11'} + - {os: windows-latest, python-version: '3.12'} steps: - uses: actions/checkout@v4 @@ -63,7 +66,7 @@ jobs: uses: codecov/codecov-action@v3 - name: Test docstrings with doctest - if: "runner.os == 'Linux' && matrix.python-version == 3.11" + if: "runner.os == 'Linux' && matrix.python-version == 3.12" run: python -m pytest --doctest-modules src/particle --ignore-glob="src/particle/particle/convert.py" notebooks: diff --git a/pyproject.toml b/pyproject.toml index ef63befe..c40fe7e2 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -99,6 +99,7 @@ minversion = "6.0" testpaths = ["tests"] junit_family = "xunit2" log_cli_level = "info" +xfail_strict = true addopts = [ "--benchmark-disable", "-ra", @@ -144,9 +145,11 @@ messages_control.disable = [ [tool.ruff] +src = ["src"] + +[tool.ruff.lint] select = [ - "E", "F", "W", # flake8 - "B", "B904", # flake8-bugbear + "B", # flake8-bugbear "I", # isort "ARG", # flake8-unused-arguments "C4", # flake8-comprehensions @@ -164,23 +167,20 @@ select = [ "YTT", # flake8-2020 ] ignore = [ - "B905", - "E402", - "E501", - "RUF001", # Ambiguous unicode - "RUF002", # Ambiguous unicode docstring - "PLR", # Design related pylint codes - "PT013", # Importing approx from pytest is fine -] -src = ["src"] -unfixable = [ - "T20", # Removes print statements - "F841", # Removes unused variables + "RUF001", # Ambiguous unicode + "RUF002", # Ambiguous unicode docstring + "PLR2004", # Magic value used in comparison + "PLR09", # Too many X ] isort.required-imports = ["from __future__ import annotations"] +mccabe.max-complexity = 24 -[tool.ruff.mccabe] -max-complexity = 24 - -[tool.ruff.per-file-ignores] +[tool.ruff.lint.per-file-ignores] "src/particle/__main__.py" = ["T20"] +"tests/**.py" = [ + "PT013", # Importing approx from pytest is fine +] + + +[tool.repo-review] +ignore = ["RTD"] diff --git a/src/particle/particle/particle.py b/src/particle/particle/particle.py index 39934423..7981df3d 100644 --- a/src/particle/particle/particle.py +++ b/src/particle/particle/particle.py @@ -193,7 +193,7 @@ class Particle: minus_one, converter=_none_or_positive_converter ) _three_charge: Charge | None = attr.ib(Charge.u, converter=Charge) # charge * 3 - I: float | None = attr.ib(none_float, converter=_isospin_converter) # noqa: E741 + I: float | None = attr.ib(none_float, converter=_isospin_converter) # J = attr.ib(None) # Total angular momentum G = attr.ib(Parity.u, converter=Parity) # Parity: '', +, -, or ? P = attr.ib(Parity.u, converter=Parity) # Space parity