Skip to content

Commit

Permalink
Bump the python-packages group with 13 updates (#2632)
Browse files Browse the repository at this point in the history
* Bump the python-packages group with 13 updates

Bumps the python-packages group with 13 updates:

| Package | From | To |
| --- | --- | --- |
| [anyio](https://github.com/agronholm/anyio) | `4.3.0` | `4.4.0` |
| [coverage](https://github.com/nedbat/coveragepy) | `7.4.3` | `7.5.4` |
| [importlib-metadata](https://github.com/python/importlib_metadata) | `7.0.1` | `8.0.0` |
| [mypy](https://github.com/python/mypy) | `1.8.0` | `1.10.1` |
| [ruff](https://github.com/astral-sh/ruff) | `0.1.15` | `0.5.0` |
| [typing-extensions](https://github.com/python/typing_extensions) | `4.10.0` | `4.12.2` |
| [types-pyyaml](https://github.com/python/typeshed) | `6.0.12.12` | `6.0.12.20240311` |
| [pytest](https://github.com/pytest-dev/pytest) | `8.0.2` | `8.2.2` |
| [trio](https://github.com/python-trio/trio) | `0.24.0` | `0.25.1` |
| [mkdocs](https://github.com/mkdocs/mkdocs) | `1.5.3` | `1.6.0` |
| [mkdocs-material](https://github.com/squidfunk/mkdocs-material) | `9.5.12` | `9.5.27` |
| [build](https://github.com/pypa/build) | `1.1.1` | `1.2.1` |
| [twine](https://github.com/pypa/twine) | `5.0.0` | `5.1.1` |


Updates `anyio` from 4.3.0 to 4.4.0
- [Release notes](https://github.com/agronholm/anyio/releases)
- [Changelog](https://github.com/agronholm/anyio/blob/master/docs/versionhistory.rst)
- [Commits](agronholm/anyio@4.3.0...4.4.0)

Updates `coverage` from 7.4.3 to 7.5.4
- [Release notes](https://github.com/nedbat/coveragepy/releases)
- [Changelog](https://github.com/nedbat/coveragepy/blob/master/CHANGES.rst)
- [Commits](nedbat/coveragepy@7.4.3...7.5.4)

Updates `importlib-metadata` from 7.0.1 to 8.0.0
- [Release notes](https://github.com/python/importlib_metadata/releases)
- [Changelog](https://github.com/python/importlib_metadata/blob/main/NEWS.rst)
- [Commits](python/importlib_metadata@v7.0.1...v8.0.0)

Updates `mypy` from 1.8.0 to 1.10.1
- [Changelog](https://github.com/python/mypy/blob/master/CHANGELOG.md)
- [Commits](python/mypy@v1.8.0...v1.10.1)

Updates `ruff` from 0.1.15 to 0.5.0
- [Release notes](https://github.com/astral-sh/ruff/releases)
- [Changelog](https://github.com/astral-sh/ruff/blob/main/CHANGELOG.md)
- [Commits](astral-sh/ruff@v0.1.15...0.5.0)

Updates `typing-extensions` from 4.10.0 to 4.12.2
- [Release notes](https://github.com/python/typing_extensions/releases)
- [Changelog](https://github.com/python/typing_extensions/blob/main/CHANGELOG.md)
- [Commits](python/typing_extensions@4.10.0...4.12.2)

Updates `types-pyyaml` from 6.0.12.12 to 6.0.12.20240311
- [Commits](https://github.com/python/typeshed/commits)

Updates `pytest` from 8.0.2 to 8.2.2
- [Release notes](https://github.com/pytest-dev/pytest/releases)
- [Changelog](https://github.com/pytest-dev/pytest/blob/main/CHANGELOG.rst)
- [Commits](pytest-dev/pytest@8.0.2...8.2.2)

Updates `trio` from 0.24.0 to 0.25.1
- [Release notes](https://github.com/python-trio/trio/releases)
- [Commits](python-trio/trio@v0.24.0...v0.25.1)

Updates `mkdocs` from 1.5.3 to 1.6.0
- [Release notes](https://github.com/mkdocs/mkdocs/releases)
- [Commits](mkdocs/mkdocs@1.5.3...1.6.0)

Updates `mkdocs-material` from 9.5.12 to 9.5.27
- [Release notes](https://github.com/squidfunk/mkdocs-material/releases)
- [Changelog](https://github.com/squidfunk/mkdocs-material/blob/master/CHANGELOG)
- [Commits](squidfunk/mkdocs-material@9.5.12...9.5.27)

Updates `build` from 1.1.1 to 1.2.1
- [Release notes](https://github.com/pypa/build/releases)
- [Changelog](https://github.com/pypa/build/blob/main/CHANGELOG.rst)
- [Commits](pypa/build@1.1.1...1.2.1)

Updates `twine` from 5.0.0 to 5.1.1
- [Release notes](https://github.com/pypa/twine/releases)
- [Changelog](https://github.com/pypa/twine/blob/main/docs/changelog.rst)
- [Commits](pypa/twine@5.0.0...v5.1.1)

---
updated-dependencies:
- dependency-name: anyio
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: python-packages
- dependency-name: coverage
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: python-packages
- dependency-name: importlib-metadata
  dependency-type: direct:production
  update-type: version-update:semver-major
  dependency-group: python-packages
- dependency-name: mypy
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: python-packages
- dependency-name: ruff
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: python-packages
- dependency-name: typing-extensions
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: python-packages
- dependency-name: types-pyyaml
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: python-packages
- dependency-name: pytest
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: python-packages
- dependency-name: trio
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: python-packages
- dependency-name: mkdocs
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: python-packages
- dependency-name: mkdocs-material
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: python-packages
- dependency-name: build
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: python-packages
- dependency-name: twine
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: python-packages
...

Signed-off-by: dependabot[bot] <support@github.com>

* Add all changes needed for bump

* Ignore ResourceWarning

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Marcelo Trylesinski <marcelotryle@gmail.com>
  • Loading branch information
dependabot[bot] and Kludex authored Jul 27, 2024
1 parent 07427f8 commit 296cab9
Show file tree
Hide file tree
Showing 14 changed files with 64 additions and 89 deletions.
3 changes: 3 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ path = "starlette/__init__.py"

[tool.ruff.lint]
select = ["E", "F", "I", "FA", "UP"]
ignore = ["UP031"]

[tool.ruff.lint.isort]
combine-as-imports = true
Expand Down Expand Up @@ -78,6 +79,8 @@ filterwarnings = [
"ignore: The `allow_redirects` argument is deprecated. Use `follow_redirects` instead.:DeprecationWarning",
"ignore: 'cgi' is deprecated and slated for removal in Python 3.13:DeprecationWarning",
"ignore: You seem to already have a custom sys.excepthook handler installed. I'll skip installing Trio's custom handler, but this means MultiErrors will not show full tracebacks.:RuntimeWarning",
# TODO: This warning appeared when we bumped anyio to 4.4.0.
"ignore: Unclosed .MemoryObject(Send|Receive)Stream.:ResourceWarning",
]

[tool.coverage.run]
Expand Down
26 changes: 13 additions & 13 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,25 @@
-e .[full]

# TODO: We need to delete the following line when fixing the test suite for anyio 4.4.0.
anyio==4.3.0
anyio==4.4.0

# Testing
coverage==7.4.3
importlib-metadata==7.0.1
mypy==1.8.0
ruff==0.1.15
typing_extensions==4.10.0
coverage==7.5.4
importlib-metadata==8.0.0
mypy==1.10.1
ruff==0.5.0
typing_extensions==4.12.2
types-contextvars==2.4.7.3
types-PyYAML==6.0.12.12
types-PyYAML==6.0.12.20240311
types-dataclasses==0.6.6
pytest==8.0.2
trio==0.24.0
pytest==8.2.2
trio==0.25.1

# Documentation
mkdocs==1.5.3
mkdocs-material==9.5.12
mkdocs==1.6.0
mkdocs-material==9.5.27
mkautodoc==0.2.0

# Packaging
build==1.1.1
twine==5.0.0
build==1.2.1
twine==5.1.1
2 changes: 1 addition & 1 deletion scripts/lint
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ export SOURCE_FILES="starlette tests"
set -x

${PREFIX}ruff format $SOURCE_FILES
${PREFIX}ruff --fix $SOURCE_FILES
${PREFIX}ruff check --fix $SOURCE_FILES
12 changes: 4 additions & 8 deletions starlette/_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,11 @@


@typing.overload
def is_async_callable(obj: AwaitableCallable[T]) -> TypeGuard[AwaitableCallable[T]]:
...
def is_async_callable(obj: AwaitableCallable[T]) -> TypeGuard[AwaitableCallable[T]]: ...


@typing.overload
def is_async_callable(obj: typing.Any) -> TypeGuard[AwaitableCallable[typing.Any]]:
...
def is_async_callable(obj: typing.Any) -> TypeGuard[AwaitableCallable[typing.Any]]: ...


def is_async_callable(obj: typing.Any) -> typing.Any:
Expand All @@ -49,13 +47,11 @@ def is_async_callable(obj: typing.Any) -> typing.Any:

class AwaitableOrContextManager(
typing.Awaitable[T_co], typing.AsyncContextManager[T_co], typing.Protocol[T_co]
):
...
): ...


class SupportsAsyncClose(typing.Protocol):
async def close(self) -> None:
... # pragma: no cover
async def close(self) -> None: ... # pragma: no cover


SupportsAsyncCloseType = typing.TypeVar(
Expand Down
17 changes: 7 additions & 10 deletions starlette/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,29 +68,26 @@ def __init__(
self.file_values = self._read_file(env_file)

@typing.overload
def __call__(self, key: str, *, default: None) -> str | None:
...
def __call__(self, key: str, *, default: None) -> str | None: ...

@typing.overload
def __call__(self, key: str, cast: type[T], default: T = ...) -> T:
...
def __call__(self, key: str, cast: type[T], default: T = ...) -> T: ...

@typing.overload
def __call__(self, key: str, cast: type[str] = ..., default: str = ...) -> str:
...
def __call__(self, key: str, cast: type[str] = ..., default: str = ...) -> str: ...

@typing.overload
def __call__(
self,
key: str,
cast: typing.Callable[[typing.Any], T] = ...,
default: typing.Any = ...,
) -> T:
...
) -> T: ...

@typing.overload
def __call__(self, key: str, cast: type[str] = ..., default: T = ...) -> T | str:
...
def __call__(
self, key: str, cast: type[str] = ..., default: T = ...
) -> T | str: ...

def __call__(
self,
Expand Down
10 changes: 6 additions & 4 deletions starlette/middleware/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,13 @@


class _MiddlewareClass(Protocol[P]):
def __init__(self, app: ASGIApp, *args: P.args, **kwargs: P.kwargs) -> None:
... # pragma: no cover
def __init__(
self, app: ASGIApp, *args: P.args, **kwargs: P.kwargs
) -> None: ... # pragma: no cover

async def __call__(self, scope: Scope, receive: Receive, send: Send) -> None:
... # pragma: no cover
async def __call__(
self, scope: Scope, receive: Receive, send: Send
) -> None: ... # pragma: no cover


class Middleware:
Expand Down
8 changes: 3 additions & 5 deletions starlette/responses.py
Original file line number Diff line number Diff line change
Expand Up @@ -299,12 +299,10 @@ def __init__(
if self.filename is not None:
content_disposition_filename = quote(self.filename)
if content_disposition_filename != self.filename:
content_disposition = "{}; filename*=utf-8''{}".format(
content_disposition_type, content_disposition_filename
)
content_disposition = f"{content_disposition_type}; filename*=utf-8''{content_disposition_filename}" # noqa: E501
else:
content_disposition = '{}; filename="{}"'.format(
content_disposition_type, self.filename
content_disposition = (
f'{content_disposition_type}; filename="{self.filename}"'
)
self.headers.setdefault("content-disposition", content_disposition)
self.stat_result = stat_result
Expand Down
1 change: 1 addition & 0 deletions starlette/status.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
And RFC 2324 - https://tools.ietf.org/html/rfc2324
"""

from __future__ import annotations

import warnings
Expand Down
9 changes: 3 additions & 6 deletions starlette/templating.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,7 @@ def __init__(
context_processors: list[typing.Callable[[Request], dict[str, typing.Any]]]
| None = None,
**env_options: typing.Any,
) -> None:
...
) -> None: ...

@typing.overload
def __init__(
Expand All @@ -81,8 +80,7 @@ def __init__(
env: jinja2.Environment,
context_processors: list[typing.Callable[[Request], dict[str, typing.Any]]]
| None = None,
) -> None:
...
) -> None: ...

def __init__(
self,
Expand Down Expand Up @@ -150,8 +148,7 @@ def TemplateResponse(
headers: typing.Mapping[str, str] | None = None,
media_type: str | None = None,
background: BackgroundTask | None = None,
) -> _TemplateResponse:
...
) -> _TemplateResponse: ...

@typing.overload
def TemplateResponse(
Expand Down
33 changes: 11 additions & 22 deletions tests/test__utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,18 @@


def test_async_func() -> None:
async def async_func() -> None:
... # pragma: no cover
async def async_func() -> None: ... # pragma: no cover

def func() -> None:
... # pragma: no cover
def func() -> None: ... # pragma: no cover

assert is_async_callable(async_func)
assert not is_async_callable(func)


def test_async_partial() -> None:
async def async_func(a: Any, b: Any) -> None:
... # pragma: no cover
async def async_func(a: Any, b: Any) -> None: ... # pragma: no cover

def func(a: Any, b: Any) -> None:
... # pragma: no cover
def func(a: Any, b: Any) -> None: ... # pragma: no cover

partial = functools.partial(async_func, 1)
assert is_async_callable(partial)
Expand All @@ -31,25 +27,21 @@ def func(a: Any, b: Any) -> None:

def test_async_method() -> None:
class Async:
async def method(self) -> None:
... # pragma: no cover
async def method(self) -> None: ... # pragma: no cover

class Sync:
def method(self) -> None:
... # pragma: no cover
def method(self) -> None: ... # pragma: no cover

assert is_async_callable(Async().method)
assert not is_async_callable(Sync().method)


def test_async_object_call() -> None:
class Async:
async def __call__(self) -> None:
... # pragma: no cover
async def __call__(self) -> None: ... # pragma: no cover

class Sync:
def __call__(self) -> None:
... # pragma: no cover
def __call__(self) -> None: ... # pragma: no cover

assert is_async_callable(Async())
assert not is_async_callable(Sync())
Expand All @@ -61,16 +53,14 @@ async def __call__(
self,
a: Any,
b: Any,
) -> None:
... # pragma: no cover
) -> None: ... # pragma: no cover

class Sync:
def __call__(
self,
a: Any,
b: Any,
) -> None:
... # pragma: no cover
) -> None: ... # pragma: no cover

partial = functools.partial(Async(), 1)
assert is_async_callable(partial)
Expand All @@ -83,8 +73,7 @@ def test_async_nested_partial() -> None:
async def async_func(
a: Any,
b: Any,
) -> None:
... # pragma: no cover
) -> None: ... # pragma: no cover

partial = functools.partial(async_func, b=2)
nested_partial = functools.partial(partial, a=1)
Expand Down
6 changes: 2 additions & 4 deletions tests/test_applications.py
Original file line number Diff line number Diff line change
Expand Up @@ -463,8 +463,7 @@ def test_decorator_deprecations() -> None:

async def middleware(
request: Request, call_next: RequestResponseEndpoint
) -> None:
... # pragma: no cover
) -> None: ... # pragma: no cover

app.middleware("http")(middleware)
assert len(record) == 1
Expand Down Expand Up @@ -494,8 +493,7 @@ async def middleware(
)
) as record:

async def startup() -> None:
... # pragma: no cover
async def startup() -> None: ... # pragma: no cover

app.on_event("startup")(startup)
assert len(record) == 1
Expand Down
8 changes: 4 additions & 4 deletions tests/test_responses.py
Original file line number Diff line number Diff line change
Expand Up @@ -510,17 +510,17 @@ def test_streaming_response_known_size(test_client_factory: TestClientFactory) -


def test_response_memoryview(test_client_factory: TestClientFactory) -> None:
app = Response(content=memoryview(b"\xC0"))
app = Response(content=memoryview(b"\xc0"))
client: TestClient = test_client_factory(app)
response = client.get("/")
assert response.content == b"\xC0"
assert response.content == b"\xc0"


def test_streaming_response_memoryview(test_client_factory: TestClientFactory) -> None:
app = StreamingResponse(content=iter([memoryview(b"\xC0"), memoryview(b"\xF5")]))
app = StreamingResponse(content=iter([memoryview(b"\xc0"), memoryview(b"\xf5")]))
client: TestClient = test_client_factory(app)
response = client.get("/")
assert response.content == b"\xC0\xF5"
assert response.content == b"\xc0\xf5"


@pytest.mark.anyio
Expand Down
15 changes: 5 additions & 10 deletions tests/test_routing.py
Original file line number Diff line number Diff line change
Expand Up @@ -909,19 +909,15 @@ def test_duplicated_param_names() -> None:


class Endpoint:
async def my_method(self, request: Request) -> None:
... # pragma: no cover
async def my_method(self, request: Request) -> None: ... # pragma: no cover

@classmethod
async def my_classmethod(cls, request: Request) -> None:
... # pragma: no cover
async def my_classmethod(cls, request: Request) -> None: ... # pragma: no cover

@staticmethod
async def my_staticmethod(request: Request) -> None:
... # pragma: no cover
async def my_staticmethod(request: Request) -> None: ... # pragma: no cover

def __call__(self, request: Request) -> None:
... # pragma: no cover
def __call__(self, request: Request) -> None: ... # pragma: no cover


@pytest.mark.parametrize(
Expand Down Expand Up @@ -1254,8 +1250,7 @@ def test_decorator_deprecations() -> None:

with pytest.deprecated_call():

async def startup() -> None:
... # pragma: nocover
async def startup() -> None: ... # pragma: nocover

router.on_event("startup")(startup)

Expand Down
3 changes: 1 addition & 2 deletions tests/test_websockets.py
Original file line number Diff line number Diff line change
Expand Up @@ -492,8 +492,7 @@ def test_websocket_scope_interface() -> None:
async def mock_receive() -> Message: # type: ignore
... # pragma: no cover

async def mock_send(message: Message) -> None:
... # pragma: no cover
async def mock_send(message: Message) -> None: ... # pragma: no cover

websocket = WebSocket(
{"type": "websocket", "path": "/abc/", "headers": []},
Expand Down

0 comments on commit 296cab9

Please sign in to comment.