Skip to content

Commit

Permalink
Merge pull request #123 from simonsobs/dev
Browse files Browse the repository at this point in the history
Format code with `ruff`
  • Loading branch information
TaiSakuma authored Sep 25, 2024
2 parents 2b593ce + 87ec95e commit 8306835
Show file tree
Hide file tree
Showing 15 changed files with 73 additions and 62 deletions.
1 change: 0 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion nextlinegraphql/plugins/ctrl/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion nextlinegraphql/plugins/ctrl/schema/mutation.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
2 changes: 1 addition & 1 deletion nextlinegraphql/plugins/ctrl/schema/subscription.py
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down
105 changes: 61 additions & 44 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down Expand Up @@ -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"
Expand All @@ -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
4 changes: 0 additions & 4 deletions setup.cfg

This file was deleted.

2 changes: 1 addition & 1 deletion tests/plugins/ctrl/schema/mutations/test_interrupt.py
Original file line number Diff line number Diff line change
@@ -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

Expand Down
2 changes: 1 addition & 1 deletion tests/plugins/ctrl/schema/mutations/test_kill.py
Original file line number Diff line number Diff line change
@@ -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

Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion tests/plugins/ctrl/schema/mutations/test_reset.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion tests/plugins/ctrl/schema/mutations/test_terminate.py
Original file line number Diff line number Diff line change
@@ -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

Expand Down
2 changes: 1 addition & 1 deletion tests/plugins/ctrl/schema/queries/test_exception.py
Original file line number Diff line number Diff line change
@@ -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

Expand Down
2 changes: 1 addition & 1 deletion tests/plugins/ctrl/schema/queries/test_source.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down
1 change: 0 additions & 1 deletion tests/plugins/ctrl/schema/subscriptions/test_stdout.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions tests/plugins/ctrl/schema/test_run.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 8306835

Please sign in to comment.