diff --git a/.vscode/settings.json b/.vscode/settings.json index 0190eb1a..90182072 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -10,7 +10,6 @@ "python.testing.unittestEnabled": false, "python.testing.pytestEnabled": true, "python.testing.pytestArgs": ["tests"], - "isort.check": true, "markdownlint.config": { "MD033": { "allowed_elements": ["i", "span", "a", "img"] }, "MD041": false diff --git a/nextlinegraphql/plugins/ctrl/__init__.py b/nextlinegraphql/plugins/ctrl/__init__.py index 9ccedb46..0b638f62 100644 --- a/nextlinegraphql/plugins/ctrl/__init__.py +++ b/nextlinegraphql/plugins/ctrl/__init__.py @@ -3,8 +3,8 @@ from collections.abc import AsyncIterator, MutableMapping from apluggy import asynccontextmanager -from nextline import Nextline +from nextline import Nextline from nextlinegraphql.hook import spec from .cache import CacheStdout diff --git a/nextlinegraphql/plugins/ctrl/schema/mutation.py b/nextlinegraphql/plugins/ctrl/schema/mutation.py index 47ff22ac..00ea9a2f 100644 --- a/nextlinegraphql/plugins/ctrl/schema/mutation.py +++ b/nextlinegraphql/plugins/ctrl/schema/mutation.py @@ -2,9 +2,9 @@ from typing import Optional import strawberry -from nextline import Nextline from strawberry.types import Info +from nextline import Nextline from nextlinegraphql.plugins.ctrl import example_script as example_script_module EXAMPLE_SCRIPT_PATH = Path(example_script_module.__file__).parent / 'script.py' diff --git a/nextlinegraphql/plugins/ctrl/schema/subscription.py b/nextlinegraphql/plugins/ctrl/schema/subscription.py index 708cc94e..5f5d885a 100644 --- a/nextlinegraphql/plugins/ctrl/schema/subscription.py +++ b/nextlinegraphql/plugins/ctrl/schema/subscription.py @@ -2,9 +2,9 @@ from collections.abc import AsyncIterator import strawberry -from nextline import Nextline from strawberry.types import Info +from nextline import Nextline from nextlinegraphql.plugins.ctrl.cache import CacheStdout diff --git a/pyproject.toml b/pyproject.toml index e0c2f385..46c604d3 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -10,35 +10,35 @@ readme = "README.md" requires-python = ">=3.10" license = "MIT" authors = [ - { name = "Simons Observatory", email = "so_software@simonsobservatory.org" }, + { name = "Simons Observatory", email = "so_software@simonsobservatory.org" }, ] classifiers = [ - "Development Status :: 4 - Beta", - "Intended Audience :: Science/Research", - "License :: OSI Approved :: MIT License", - "Programming Language :: Python :: 3.10", - "Programming Language :: Python :: 3.11", - "Programming Language :: Python :: 3.12", + "Development Status :: 4 - Beta", + "Intended Audience :: Science/Research", + "License :: OSI Approved :: MIT License", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", ] dependencies = [ - "nextline>=0.7.15", - "apluggy>=1.0", - "dynaconf>=3.2", - "starlette>=0.31", - "strawberry-graphql>=0.240", - "websockets>=12.0", - "rich>=13.6", - "async-asgi-testclient>=1.4", + "nextline>=0.7.15", + "apluggy>=1.0", + "dynaconf>=3.2", + "starlette>=0.31", + "strawberry-graphql>=0.240", + "websockets>=12.0", + "rich>=13.6", + "async-asgi-testclient>=1.4", ] [project.optional-dependencies] dev = ["black", "flake8", "logging_tree", "mypy", "tox", "twine", "uvicorn"] tests = [ - "pytest-asyncio>=0.21", - "pytest-cov>=4.1", - "pytest-timeout>=2.2", - "pytest>=7.4", - "syrupy>=4.6", + "pytest-asyncio>=0.21", + "pytest-cov>=4.1", + "pytest-timeout>=2.2", + "pytest>=7.4", + "syrupy>=4.6", ] [project.urls] @@ -70,34 +70,51 @@ branch = true source = ["nextlinegraphql", "tests"] concurrency = ["multiprocessing"] omit = [ - "nextlinegraphql/plugins/ctrl/example_script/*", - "venv/*", - "*/site-packages/*", + "nextlinegraphql/plugins/ctrl/example_script/*", + "venv/*", + "*/site-packages/*", ] [tool.coverage.report] exclude_lines = [ - "pragma: no cover", - "def __repr__", - "if self\\.debug", - "raise AssertionError", - "raise NotImplementedError", - "if 0:", - 'if __name__ == "__main__":', - "if TYPE_CHECKING:", + "pragma: no cover", + "def __repr__", + "if self\\.debug", + "raise AssertionError", + "raise NotImplementedError", + "if 0:", + 'if __name__ == "__main__":', + "if TYPE_CHECKING:", ] ignore_errors = true -[tool.black] -skip-string-normalization = true -target_version = ['py310', 'py311', 'py312'] -exclude = '''(?x)( - plugins/db/alembic/versions/.*\.py$ - | example_script/.*\.py$ -)''' +[tool.ruff] +line-length = 88 +extend-exclude = ["example_script"] + +[tool.ruff.format] +quote-style = "preserve" + +[tool.ruff.lint] +select = [ + "E", # pycodestyle errors + "W", # pycodestyle warnings + "F", # pyflakes + "I", # isort +] +ignore = [ + "E203", # Whitespace before '{symbol}' + "E265", # Block comment should start with # + "E266", # Too many leading # before block comment + "E501", # Line too long ({width} > {limit}) + "E741", # Ambiguous variable name '{name}' +] + +[tool.ruff.lint.mccabe] +max-complexity = 20 -[tool.isort] -profile = "black" +[tool.ruff.lint.isort] +known-first-party = ["nextline"] [tool.mypy] plugins = "strawberry.ext.mypy_plugin" @@ -108,9 +125,9 @@ disallow_untyped_defs = true [[tool.mypy.overrides]] module = [ - "dynaconf.*", - "async_asgi_testclient.*", - "snapshottest.*", - "apluggy.*", + "dynaconf.*", + "async_asgi_testclient.*", + "snapshottest.*", + "apluggy.*", ] ignore_missing_imports = true diff --git a/setup.cfg b/setup.cfg deleted file mode 100644 index 6b4300af..00000000 --- a/setup.cfg +++ /dev/null @@ -1,4 +0,0 @@ -[flake8] -ignore = E203, E265, E266, E501, E741, W503 -max-line-length = 150 -max-complexity = 20 diff --git a/tests/plugins/ctrl/schema/mutations/test_interrupt.py b/tests/plugins/ctrl/schema/mutations/test_interrupt.py index 6fffbaca..b3d50d8d 100644 --- a/tests/plugins/ctrl/schema/mutations/test_interrupt.py +++ b/tests/plugins/ctrl/schema/mutations/test_interrupt.py @@ -1,8 +1,8 @@ import asyncio -from nextline import Nextline from strawberry.types import ExecutionResult +from nextline import Nextline from nextlinegraphql.plugins.ctrl.graphql import MUTATE_INTERRUPT from tests.plugins.ctrl.schema.conftest import Schema diff --git a/tests/plugins/ctrl/schema/mutations/test_kill.py b/tests/plugins/ctrl/schema/mutations/test_kill.py index 57b1d070..36e051e9 100644 --- a/tests/plugins/ctrl/schema/mutations/test_kill.py +++ b/tests/plugins/ctrl/schema/mutations/test_kill.py @@ -1,8 +1,8 @@ import asyncio -from nextline import Nextline from strawberry.types import ExecutionResult +from nextline import Nextline from nextlinegraphql.plugins.ctrl.graphql import MUTATE_KILL from tests.plugins.ctrl.schema.conftest import Schema diff --git a/tests/plugins/ctrl/schema/mutations/test_load_example_script.py b/tests/plugins/ctrl/schema/mutations/test_load_example_script.py index a924c8d7..a164eaeb 100644 --- a/tests/plugins/ctrl/schema/mutations/test_load_example_script.py +++ b/tests/plugins/ctrl/schema/mutations/test_load_example_script.py @@ -1,8 +1,8 @@ from pathlib import Path -from nextline import Nextline from strawberry.types import ExecutionResult +from nextline import Nextline from nextlinegraphql.plugins.ctrl import example_script as example_script_module from nextlinegraphql.plugins.ctrl.graphql import MUTATE_LOAD_EXAMPLE_SCRIPT from tests.plugins.ctrl.schema.conftest import Schema diff --git a/tests/plugins/ctrl/schema/mutations/test_reset.py b/tests/plugins/ctrl/schema/mutations/test_reset.py index 361a2584..8f69aff2 100644 --- a/tests/plugins/ctrl/schema/mutations/test_reset.py +++ b/tests/plugins/ctrl/schema/mutations/test_reset.py @@ -1,9 +1,9 @@ from pathlib import Path import pytest -from nextline import Nextline from strawberry.types import ExecutionResult +from nextline import Nextline from nextlinegraphql.plugins.ctrl import example_script as example_script_module from nextlinegraphql.plugins.ctrl.graphql import MUTATE_RESET, QUERY_SOURCE from tests.plugins.ctrl.schema.conftest import Schema diff --git a/tests/plugins/ctrl/schema/mutations/test_terminate.py b/tests/plugins/ctrl/schema/mutations/test_terminate.py index 9b65ecd0..ceaf3879 100644 --- a/tests/plugins/ctrl/schema/mutations/test_terminate.py +++ b/tests/plugins/ctrl/schema/mutations/test_terminate.py @@ -1,8 +1,8 @@ import asyncio -from nextline import Nextline from strawberry.types import ExecutionResult +from nextline import Nextline from nextlinegraphql.plugins.ctrl.graphql import MUTATE_TERMINATE from tests.plugins.ctrl.schema.conftest import Schema diff --git a/tests/plugins/ctrl/schema/queries/test_exception.py b/tests/plugins/ctrl/schema/queries/test_exception.py index bb7bab02..4d04c7b4 100644 --- a/tests/plugins/ctrl/schema/queries/test_exception.py +++ b/tests/plugins/ctrl/schema/queries/test_exception.py @@ -1,6 +1,6 @@ -from nextline import Nextline from strawberry.types import ExecutionResult +from nextline import Nextline from nextlinegraphql.plugins.ctrl.graphql import QUERY_EXCEPTION from tests.plugins.ctrl.schema.conftest import Schema diff --git a/tests/plugins/ctrl/schema/queries/test_source.py b/tests/plugins/ctrl/schema/queries/test_source.py index b4a4f02a..9c483d4c 100644 --- a/tests/plugins/ctrl/schema/queries/test_source.py +++ b/tests/plugins/ctrl/schema/queries/test_source.py @@ -1,10 +1,10 @@ from pathlib import Path import pytest -from nextline import Nextline from strawberry.types import ExecutionResult from syrupy.assertion import SnapshotAssertion +from nextline import Nextline from nextlinegraphql.plugins.ctrl import example_script as example_script_module from nextlinegraphql.plugins.ctrl.graphql import QUERY_SOURCE from tests.plugins.ctrl.schema.conftest import Schema diff --git a/tests/plugins/ctrl/schema/subscriptions/test_stdout.py b/tests/plugins/ctrl/schema/subscriptions/test_stdout.py index 94c0185a..7caf8f1b 100644 --- a/tests/plugins/ctrl/schema/subscriptions/test_stdout.py +++ b/tests/plugins/ctrl/schema/subscriptions/test_stdout.py @@ -2,7 +2,6 @@ from typing import Any from nextline import Nextline - from nextlinegraphql.plugins.ctrl.cache import CacheStdout from nextlinegraphql.plugins.ctrl.graphql import SUBSCRIBE_STDOUT from tests.plugins.ctrl.schema.conftest import Schema diff --git a/tests/plugins/ctrl/schema/test_run.py b/tests/plugins/ctrl/schema/test_run.py index f12cc345..a6572b08 100644 --- a/tests/plugins/ctrl/schema/test_run.py +++ b/tests/plugins/ctrl/schema/test_run.py @@ -3,10 +3,10 @@ from pathlib import Path from typing import Any -from nextline import Nextline -from nextline.utils import agen_with_wait from strawberry.types import ExecutionResult +from nextline import Nextline +from nextline.utils import agen_with_wait from nextlinegraphql.plugins.ctrl import example_script as example_script_module from nextlinegraphql.plugins.ctrl.graphql import ( MUTATE_EXEC,