diff --git a/.github/workflows/testing.yml b/.github/workflows/testing.yml index 591a31420..de150217e 100644 --- a/.github/workflows/testing.yml +++ b/.github/workflows/testing.yml @@ -29,8 +29,7 @@ jobs: run: | pip install pre-commit pre-commit run - - + test: needs: lint services: diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 987d9550a..8c9a33980 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -7,7 +7,7 @@ repos: rev: v0.0.275 hooks: - id: ruff - args: [--fix, --ignore, "D,E501"] + args: [--fix, --ignore, D] - repo: https://github.com/psf/black rev: 23.3.0 diff --git a/pyproject.toml b/pyproject.toml index f28dabd03..4287753e9 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -20,7 +20,7 @@ version_scheme = "no-guess-dev" line-length = 120 [tool.ruff] -target-version = "py38" +target-version = "py37" line-length = 120 select = [ "B", # flake8-bugbear @@ -61,10 +61,10 @@ ignore = [ "D105", # Missing docstring in magic method "D205", # 1 blank line required between summary line and description "D212", # Multi-line docstring summary should start at the first line - "FA100", # Missing `from __future__ import annotations`, but uses `typing.XXX` + "FA100", # Missing `from __future__ import annotations`, but uses `typing.XXX` TODO "PD011", # pandas-use-of-dot-values "PD901", # pandas-df-variable-name - "PT011", # `pytest.raises(XXXError)` is too broad, set the `match` parameter... + "PT011", # `pytest.raises(XXXError)` is too broad, set the `match` parameter... TODO "PERF203", # try-except-in-loop "PERF401", # manual-list-comprehension (TODO fix these or wait for autofix) "PLR", # pylint refactor @@ -82,6 +82,8 @@ isort.split-on-trailing-comma = false "tests/*" = ["D"] "src/maggma/api/*" = ["B008", "B021", "RET505", "RET506"] "tests/api/*" = ["B017", "B018"] +"src/maggma/cli/*" = ["EXE001"] # triggered by ! at top of file +"src/maggma/api/utils.py" = ["I001"] # to allow unsorted import block [tool.pytest.ini_options] addopts = "--color=yes -p no:warnings --import-mode=importlib --durations=30" diff --git a/requirements-testing.txt b/requirements-testing.txt index 6569e943f..038f33d25 100644 --- a/requirements-testing.txt +++ b/requirements-testing.txt @@ -5,10 +5,7 @@ pytest-cov==3.0.0 pytest-mock==3.10.0 pytest-xdist==2.5.0 moto==3.1.17 -pydocstyle==6.1.1 -flake8==4.0.1 -mypy==0.971 -mypy-extensions==0.4.3 +ruff==0.0.280 responses<0.22.0 types-PyYAML==6.0.11 types-setuptools==65.4.0.0 diff --git a/src/maggma/api/resource/__init__.py b/src/maggma/api/resource/__init__.py index 3726acd89..aafd982b1 100644 --- a/src/maggma/api/resource/__init__.py +++ b/src/maggma/api/resource/__init__.py @@ -1,10 +1,7 @@ -# isort: off from maggma.api.resource.core import Resource from maggma.api.resource.core import HintScheme from maggma.api.resource.core import HeaderProcessor -# isort: on - from maggma.api.resource.aggregation import AggregationResource from maggma.api.resource.post_resource import PostOnlyResource from maggma.api.resource.read_resource import ReadOnlyResource, attach_query_ops diff --git a/src/maggma/api/utils.py b/src/maggma/api/utils.py index e48c98a1e..aae16155a 100644 --- a/src/maggma/api/utils.py +++ b/src/maggma/api/utils.py @@ -1,8 +1,14 @@ import base64 import inspect import sys -from typing import Any, Callable, Dict, List, Optional, Type - +from typing import ( + Any, + Callable, + Dict, + List, + Optional, + Type, +) from bson.objectid import ObjectId from monty.json import MSONable from pydantic import BaseModel @@ -15,7 +21,6 @@ else: from typing_extensions import get_args # pragma: no cover - QUERY_PARAMS = ["criteria", "properties", "skip", "limit"] STORE_PARAMS = Dict[ Literal[