Skip to content

Commit

Permalink
Drop asgiref dependency at all (#1999)
Browse files Browse the repository at this point in the history
  • Loading branch information
Kludex committed Jun 8, 2023
1 parent 7d4eab2 commit 1cb58c7
Show file tree
Hide file tree
Showing 22 changed files with 407 additions and 182 deletions.
3 changes: 3 additions & 0 deletions pyproject.toml
Expand Up @@ -68,6 +68,9 @@ ignore = ["B904", "B028"]
combine-as-imports = true

[tool.mypy]
warn_unused_ignores = true
warn_redundant_casts = true
show_error_codes = true
disallow_untyped_defs = true
ignore_missing_imports = true
follow_imports = "silent"
Expand Down
3 changes: 0 additions & 3 deletions requirements.txt
@@ -1,8 +1,5 @@
-e .[standard]

# Type annotation
asgiref==3.5.2

# Explicit optionals
a2wsgi==1.7.0
wsproto==1.2.0
Expand Down
2 changes: 1 addition & 1 deletion scripts/check
Expand Up @@ -11,6 +11,6 @@ set -x

./scripts/sync-version
${PREFIX}black --check --diff --target-version=py37 $SOURCE_FILES
${PREFIX}mypy --show-error-codes $SOURCE_FILES
${PREFIX}mypy $SOURCE_FILES
${PREFIX}ruff check $SOURCE_FILES
${PREFIX}python -m tools.cli_usage --check
2 changes: 1 addition & 1 deletion tests/middleware/test_proxy_headers.py
Expand Up @@ -2,9 +2,9 @@

import httpx
import pytest
from asgiref.typing import ASGIReceiveCallable, ASGISendCallable, Scope

from tests.response import Response
from uvicorn._types import ASGIReceiveCallable, ASGISendCallable, Scope
from uvicorn.middleware.proxy_headers import ProxyHeadersMiddleware


Expand Down
7 changes: 2 additions & 5 deletions tests/middleware/test_wsgi.py
@@ -1,17 +1,14 @@
import io
import sys
from typing import TYPE_CHECKING, AsyncGenerator, Callable, List
from typing import AsyncGenerator, Callable, List

import a2wsgi
import httpx
import pytest

from uvicorn._types import Environ, StartResponse
from uvicorn._types import Environ, HTTPRequestEvent, HTTPScope, StartResponse
from uvicorn.middleware import wsgi

if TYPE_CHECKING:
from asgiref.typing import HTTPRequestEvent, HTTPScope


def hello_world(environ: Environ, start_response: StartResponse) -> List[bytes]:
status = "200 OK"
Expand Down
6 changes: 2 additions & 4 deletions tests/supervisors/test_multiprocess.py
@@ -1,13 +1,11 @@
import signal
import socket
from typing import TYPE_CHECKING, List, Optional
from typing import List, Optional

from uvicorn import Config
from uvicorn._types import ASGIReceiveCallable, ASGISendCallable, Scope
from uvicorn.supervisors import Multiprocess

if TYPE_CHECKING:
from asgiref.typing import ASGIReceiveCallable, ASGISendCallable, Scope


async def app(
scope: "Scope", receive: "ASGIReceiveCallable", send: "ASGISendCallable"
Expand Down
17 changes: 8 additions & 9 deletions tests/test_config.py
Expand Up @@ -13,7 +13,14 @@
from pytest_mock import MockerFixture

from tests.utils import as_cwd
from uvicorn._types import Environ, StartResponse
from uvicorn._types import (
ASGIApplication,
ASGIReceiveCallable,
ASGISendCallable,
Environ,
Scope,
StartResponse,
)
from uvicorn.config import Config
from uvicorn.middleware.proxy_headers import ProxyHeadersMiddleware
from uvicorn.middleware.wsgi import WSGIMiddleware
Expand All @@ -24,14 +31,6 @@
else: # pragma: py-lt-38
from typing import Literal

if typing.TYPE_CHECKING:
from asgiref.typing import (
ASGIApplication,
ASGIReceiveCallable,
ASGISendCallable,
Scope,
)


@pytest.fixture
def mocked_logging_config_module(mocker: MockerFixture) -> MagicMock:
Expand Down
6 changes: 2 additions & 4 deletions tests/test_subprocess.py
@@ -1,13 +1,11 @@
import socket
from typing import TYPE_CHECKING, List
from typing import List
from unittest.mock import patch

from uvicorn._subprocess import SpawnProcess, get_subprocess, subprocess_started
from uvicorn._types import ASGIReceiveCallable, ASGISendCallable, Scope
from uvicorn.config import Config

if TYPE_CHECKING:
from asgiref.typing import ASGIReceiveCallable, ASGISendCallable, Scope


def server_run(sockets: List[socket.socket]): # pragma: no cover
...
Expand Down

0 comments on commit 1cb58c7

Please sign in to comment.