Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clean Up Black and Isort Config #2449

Merged
merged 4 commits into from May 26, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 0 additions & 2 deletions .black.toml

This file was deleted.

6 changes: 3 additions & 3 deletions Makefile
Expand Up @@ -66,15 +66,15 @@ ifdef include_tests
isort -rc sanic tests
else
$(info Sorting Imports)
isort -rc sanic tests --profile=black
isort -rc sanic tests
endif
endif

black:
black --config ./.black.toml sanic tests
black sanic tests

isort:
isort sanic tests --profile=black
isort sanic tests

pretty: black isort

Expand Down
15 changes: 15 additions & 0 deletions pyproject.toml
@@ -1,3 +1,18 @@
[build-system]
requires = ["setuptools<60.0", "wheel"]
build-backend = "setuptools.build_meta"

[tool.black]
line-length = 79

[tool.isort]
atomic = true
default_section = "THIRDPARTY"
include_trailing_comma = true
known_first_party = "sanic"
known_third_party = "pytest"
line_length = 79
lines_after_imports = 2
lines_between_types = 1
multi_line_output = 3
profile = "black"
11 changes: 0 additions & 11 deletions setup.cfg
@@ -1,13 +1,2 @@
[flake8]
ignore = E203, W503

[isort]
atomic = true
default_section = THIRDPARTY
include_trailing_comma = true
known_first_party = sanic
known_third_party = pytest
line_length = 79
lines_after_imports = 2
lines_between_types = 1
multi_line_output = 3
2 changes: 1 addition & 1 deletion tests/test_asgi.py
Expand Up @@ -9,7 +9,7 @@
from sanic import Sanic
from sanic.application.state import Mode
from sanic.asgi import MockTransport
from sanic.exceptions import Forbidden, BadRequest, ServiceUnavailable
from sanic.exceptions import BadRequest, Forbidden, ServiceUnavailable
from sanic.request import Request
from sanic.response import json, text
from sanic.server.websockets.connection import WebSocketConnection
Expand Down
7 changes: 1 addition & 6 deletions tests/test_blueprint_group.py
Expand Up @@ -3,12 +3,7 @@
from sanic.app import Sanic
from sanic.blueprint_group import BlueprintGroup
from sanic.blueprints import Blueprint
from sanic.exceptions import (
Forbidden,
BadRequest,
SanicException,
ServerError,
)
from sanic.exceptions import BadRequest, Forbidden, SanicException, ServerError
from sanic.request import Request
from sanic.response import HTTPResponse, text

Expand Down
7 changes: 1 addition & 6 deletions tests/test_blueprints.py
Expand Up @@ -7,12 +7,7 @@
from sanic.app import Sanic
from sanic.blueprints import Blueprint
from sanic.constants import HTTP_METHODS
from sanic.exceptions import (
BadRequest,
NotFound,
SanicException,
ServerError,
)
from sanic.exceptions import BadRequest, NotFound, SanicException, ServerError
from sanic.request import Request
from sanic.response import json, text

Expand Down
2 changes: 1 addition & 1 deletion tests/test_exceptions_handler.py
Expand Up @@ -10,7 +10,7 @@
from pytest import LogCaptureFixture, MonkeyPatch

from sanic import Sanic, handlers
from sanic.exceptions import Forbidden, BadRequest, NotFound, ServerError
from sanic.exceptions import BadRequest, Forbidden, NotFound, ServerError
from sanic.handlers import ErrorHandler
from sanic.request import Request
from sanic.response import stream, text
Expand Down
4 changes: 2 additions & 2 deletions tox.ini
Expand Up @@ -19,8 +19,8 @@ commands =
[testenv:lint]
commands =
flake8 sanic
black --config ./.black.toml --check --verbose sanic/
isort --check-only sanic --profile=black
black --check --verbose sanic/
isort --check-only sanic
slotscheck --verbose -m sanic

[testenv:type-checking]
Expand Down