diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 419fff8..1eeb490 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -27,16 +27,22 @@ jobs: fail-fast: false matrix: os: ['ubuntu-latest', 'macos-latest', 'windows-latest'] - python-version: ['3.7', '3.8', '3.9', '3.10', '3.11'] + python-version: ['3.8', '3.9', '3.10', '3.11'] steps: - uses: actions/checkout@v4 - - uses: conda-incubator/setup-miniconda@v2 + - uses: mamba-org/setup-micromamba@v1 with: - auto-update-conda: false - python-version: ${{ matrix.python-version }} - channels: conda-forge,nodefaults - miniforge-variant: Mambaforge + environment-name: gha-testing + condarc: | + channels: + - nodefaults + - conda-forge + create-args: >- + python=${{ matrix.python-version }} + mamba + tox-conda + cache-environment: true - name: Install core dependencies. shell: bash -l {0} diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 7947651..d2182cb 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -24,35 +24,30 @@ repos: - id: python-no-log-warn - id: python-use-type-annotations - id: text-unicode-replacement-char -- repo: https://github.com/asottile/reorder_python_imports - rev: v3.9.0 +- repo: https://github.com/asottile/reorder-python-imports + rev: v3.12.0 hooks: - id: reorder-python-imports - args: [--py37-plus, --add-import, 'from __future__ import annotations'] + args: [--py38-plus, --add-import, 'from __future__ import annotations'] - repo: https://github.com/asottile/setup-cfg-fmt - rev: v2.2.0 + rev: v2.5.0 hooks: - id: setup-cfg-fmt -- repo: https://github.com/PyCQA/docformatter - rev: v1.5.1 - hooks: - - id: docformatter - args: [--in-place, --wrap-summaries, "88", --wrap-descriptions, "88", --blank] - repo: https://github.com/psf/black - rev: 22.12.0 + rev: 23.9.1 hooks: - id: black -- repo: https://github.com/charliermarsh/ruff-pre-commit - rev: v0.0.223 +- repo: https://github.com/astral-sh/ruff-pre-commit + rev: v0.0.292 hooks: - id: ruff - repo: https://github.com/dosisod/refurb - rev: v1.10.0 + rev: v1.21.0 hooks: - id: refurb args: [--ignore, FURB126] - repo: https://github.com/executablebooks/mdformat - rev: 0.7.16 + rev: 0.7.17 hooks: - id: mdformat additional_dependencies: [ @@ -66,7 +61,7 @@ repos: - id: interrogate args: [-v, --fail-under=40, src] - repo: https://github.com/pre-commit/mirrors-mypy - rev: 'v0.991' + rev: 'v1.5.1' hooks: - id: mypy args: [ @@ -81,7 +76,7 @@ repos: ] pass_filenames: false - repo: https://github.com/codespell-project/codespell - rev: v2.2.2 + rev: v2.2.6 hooks: - id: codespell - repo: https://github.com/mgedmin/check-manifest diff --git a/pyproject.toml b/pyproject.toml index ccd88dc..c72a73e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -25,10 +25,12 @@ ignore_errors = true [tool.ruff] -target-version = "py37" +target-version = "py38" select = ["ALL"] fix = true extend-ignore = [ + "I", # ignore isort + "TRY", # ignore tryceratops # Numpy docstyle "D107", "D203", @@ -44,7 +46,6 @@ extend-ignore = [ "RET504", # unnecessary variable assignment before return. "S101", # raise errors for asserts. "B905", # strict parameter for zip that was implemented in py310. - "I", # ignore isort "ANN101", # type annotating self "ANN102", # type annotating cls "FBT", # flake8-boolean-trap @@ -56,7 +57,7 @@ extend-ignore = [ [tool.ruff.per-file-ignores] -"tests/*" = ["D", "ANN", "PLR2004"] +"tests/*" = ["D", "ANN", "PLR2004", "PLR0913"] [tool.ruff.pydocstyle] diff --git a/setup.cfg b/setup.cfg index 70bac67..10beeae 100644 --- a/setup.cfg +++ b/setup.cfg @@ -7,7 +7,7 @@ url = https://github.com/pytask-dev/pytask-julia author = Tobias Raabe author_email = raabe@posteo.de license = MIT -license_file = LICENSE +license_files = LICENSE platforms = any classifiers = Development Status :: 4 - Beta @@ -26,7 +26,7 @@ packages = find: install_requires = pybaum>=0.1.1 pytask>=0.3 -python_requires = >=3.7 +python_requires = >=3.8 include_package_data = True package_dir = =src zip_safe = False diff --git a/src/pytask_julia/collect.py b/src/pytask_julia/collect.py index a34b924..876fac2 100644 --- a/src/pytask_julia/collect.py +++ b/src/pytask_julia/collect.py @@ -34,9 +34,9 @@ def run_jl_script( project: list[str], ) -> None: """Run a Julia script.""" - cmd = ["julia"] + options + project + [_SEPARATOR, str(script), str(serialized)] + cmd = ["julia", *options, *project, _SEPARATOR, str(script), str(serialized)] print("Executing " + " ".join(cmd) + ".") # noqa: T201 - subprocess.run(cmd, check=True) + subprocess.run(cmd, check=True) # noqa: S603 @hookimpl diff --git a/src/pytask_julia/parametrize.py b/src/pytask_julia/parametrize.py index 6b15883..06193c7 100644 --- a/src/pytask_julia/parametrize.py +++ b/src/pytask_julia/parametrize.py @@ -10,5 +10,5 @@ @hookimpl def pytask_parametrize_kwarg_to_marker(obj: Any, kwargs: dict[str, Any]) -> None: """Attach parametrized Julia arguments to the function with a marker.""" - if callable(obj) and "julia" in kwargs: # noqa: PLR2004 + if callable(obj) and "julia" in kwargs: pytask.mark.julia(**kwargs.pop("julia"))(obj) diff --git a/src/pytask_julia/plugin.py b/src/pytask_julia/plugin.py index 0194eaa..dd7a9c5 100644 --- a/src/pytask_julia/plugin.py +++ b/src/pytask_julia/plugin.py @@ -1,13 +1,17 @@ """Register hook specifications and implementations.""" from __future__ import annotations -from pluggy import PluginManager +from typing import TYPE_CHECKING + from pytask import hookimpl from pytask_julia import collect from pytask_julia import config from pytask_julia import execute from pytask_julia import parametrize +if TYPE_CHECKING: + from pluggy import PluginManager + @hookimpl def pytask_add_hooks(pm: PluginManager) -> None: diff --git a/src/pytask_julia/serialization.py b/src/pytask_julia/serialization.py index 7199e1c..b365e78 100644 --- a/src/pytask_julia/serialization.py +++ b/src/pytask_julia/serialization.py @@ -2,11 +2,14 @@ from __future__ import annotations import json -from pathlib import Path from typing import Any from typing import Callable +from typing import TYPE_CHECKING -from pytask import Task + +if TYPE_CHECKING: + from pytask import Task + from pathlib import Path _HIDDEN_FOLDER = ".pytask" diff --git a/src/pytask_julia/shared.py b/src/pytask_julia/shared.py index d9f2672..36937cb 100644 --- a/src/pytask_julia/shared.py +++ b/src/pytask_julia/shared.py @@ -16,11 +16,11 @@ def julia( options: str | Iterable[str] | None = None, serializer: Callable[..., str] | str | None = None, suffix: str | None = None, - project: str | Path = None, + project: str | Path | None = None, ) -> tuple[ str | Path | None, str | Iterable[str] | None, - str | Callable[..., str] | str | None, + str | Callable[..., str] | None, str | None, str | Path | None, ]: