diff --git a/.github/matchers/pylint.json b/.github/matchers/pylint.json deleted file mode 100644 index e3a6bd16..00000000 --- a/.github/matchers/pylint.json +++ /dev/null @@ -1,32 +0,0 @@ -{ - "problemMatcher": [ - { - "severity": "warning", - "pattern": [ - { - "regexp": "^([^:]+):(\\d+):(\\d+): ([A-DF-Z]\\d+): \\033\\[[\\d;]+m([^\\033]+).*$", - "file": 1, - "line": 2, - "column": 3, - "code": 4, - "message": 5 - } - ], - "owner": "pylint-warning" - }, - { - "severity": "error", - "pattern": [ - { - "regexp": "^([^:]+):(\\d+):(\\d+): (E\\d+): \\033\\[[\\d;]+m([^\\033]+).*$", - "file": 1, - "line": 2, - "column": 3, - "code": 4, - "message": 5 - } - ], - "owner": "pylint-error" - } - ] -} diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ecf53387..95f4ef22 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -20,18 +20,17 @@ jobs: - uses: actions/setup-python@v5 with: python-version: "3.x" + - uses: astral-sh/setup-uv@v3 - uses: pre-commit/action@v3.0.1 with: extra_args: --all-files --hook-stage manual - name: PyLint - run: | - echo "::add-matcher::$GITHUB_WORKSPACE/.github/matchers/pylint.json" - pipx run nox -s pylint + run: uvx nox -s pylint -- --output-format=github checks: + name: Check ${{ matrix.os }} Python ${{ matrix.python-version }} runs-on: ${{ matrix.os }} - strategy: fail-fast: false matrix: @@ -41,7 +40,6 @@ jobs: - {os: macos-13, python-version: '3.9'} - {os: windows-latest, python-version: '3.8'} - {os: windows-latest, python-version: '3.11'} - name: Check ${{ matrix.os }} Python ${{ matrix.python-version }} steps: - uses: actions/checkout@v4 @@ -51,8 +49,10 @@ jobs: with: python-version: ${{ matrix.python-version }} + - uses: astral-sh/setup-uv@v3 + - name: Install package - run: python -m pip install -e .[test] + run: uv pip install --system -e .[test] - name: Pytest if: runner.os == 'Linux' @@ -82,17 +82,16 @@ jobs: with: python-version: "3.x" - - name: Install package - run: python -m pip install -e .[test] - - - name: Install notebook requirements - run: python -m pip install nbconvert jupyter_client ipykernel + - uses: astral-sh/setup-uv@v3 - name: Install dot run: sudo apt-get install graphviz - - name: Install pydot - run: python -m pip install pydot + - name: Install package + run: uv pip install --system -e .[test] + + - name: Install notebook requirements + run: uv pip install --system nbconvert jupyter_client ipykernel pydot - name: Run the notebooks inplace run: jupyter nbconvert --execute --inplace notebooks/DecayLanguageDemo.ipynb notebooks/ExampleDecFileParsingWithLark.ipynb diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index fc0b0b68..a7b92110 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -23,16 +23,14 @@ repos: hooks: - id: ruff args: ["--fix", "--show-fixes"] - types_or: [python, pyi, jupyter] - id: ruff-format - types_or: [python, pyi, jupyter] - repo: https://github.com/pre-commit/mirrors-mypy rev: v1.11.2 hooks: - id: mypy files: '^src/decaylanguage/(decay|dec|utils)/' - additional_dependencies: [attrs, particle, importlib_resources, numpy>=1.26] + additional_dependencies: [attrs, particle, importlib_resources, numpy] - repo: https://github.com/codespell-project/codespell rev: v2.3.0 @@ -55,10 +53,3 @@ repos: - id: rst-backticks - id: rst-directive-colons - id: rst-inline-touching-normal - -- repo: https://github.com/hadialqattan/pycln - rev: "v2.4.0" - hooks: - - id: pycln - args: [--all] - stages: [manual] diff --git a/noxfile.py b/noxfile.py index d1e23120..c3215771 100644 --- a/noxfile.py +++ b/noxfile.py @@ -6,7 +6,10 @@ nox.options.sessions = ["lint", "pylint", "tests"] -PYTHON_VERSIONS = ["3.7", "3.8", "3.9", "3.10", "3.11"] +PYTHON_VERSIONS = ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13"] + +nox.needs_version = ">=2024.4.15" +nox.options.default_venv_backend = "uv|virtualenv" @nox.session @@ -21,14 +24,14 @@ def pylint(session: nox.Session) -> None: Run pylint. """ - session.install("pylint~=2.15.0") - session.install("-e", ".[dev]") + session.install("pylint") + session.install("-e.[dev]") session.run("pylint", "src", *session.posargs) @nox.session(python=PYTHON_VERSIONS) def tests(session): - session.install(".[test]") + session.install("-y.[test]") session.run("pytest", *session.posargs) @@ -38,7 +41,6 @@ def build(session): Build an SDist and wheel. """ - session.install("build", "twine") session.install("build", "twine", "check-wheel-contents") session.run("python", "-m", "build") session.run("twine", "check", "--strict", "dist/*") diff --git a/pyproject.toml b/pyproject.toml index 9a6786aa..21c6e5bc 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -135,6 +135,7 @@ messages_control.disable = [ "too-many-public-methods", "too-many-return-statements", "too-many-statements", + "too-many-positional-arguments", "wrong-import-position", "invalid-name", "consider-using-f-string", # TODO @@ -144,9 +145,6 @@ messages_control.disable = [ "unused-argument", # covered by Ruff ] -[tool.ruff] -src = ["src"] - [tool.ruff.lint] extend-select = [ "B", # flake8-bugbear diff --git a/src/decaylanguage/dec/dec.py b/src/decaylanguage/dec/dec.py index 503d1b30..95ae9d11 100644 --- a/src/decaylanguage/dec/dec.py +++ b/src/decaylanguage/dec/dec.py @@ -311,13 +311,13 @@ def _load_grammar( with data.basepath.joinpath(filename).open() as f1: self._grammar = f1.read() - self._grammar_info = dict( - lark_file=filename, - parser=parser, - lexer=lexer, - edit_terminals=self._generate_edit_terminals_callback(), + self._grammar_info = { + "lark_file": filename, + "parser": parser, + "lexer": lexer, + "edit_terminals": self._generate_edit_terminals_callback(), **options, - ) + } def _generate_edit_terminals_callback(self) -> Callable[[TerminalDef], None]: """