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

Drop asgiref dependency at all #1999

Merged
merged 3 commits into from Jun 8, 2023
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
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