Repository: encode/starlette (branch: use-future-annotations)
Commit date: 2024-01-20T12:59:47Z

Workflow file: .github/workflows/test-suite.yml (Test Suite)
---
name: Test Suite

on:
  push:
    branches: ["master"]
  pull_request:
    branches: ["master"]

jobs:
  tests:
    name: "Python ${{ matrix.python-version }}"
    runs-on: "ubuntu-latest"
    services:
      pypi_wayback:
        image: ghcr.io/waleko/pypi-wayback
        ports:
          - 8629:8080

    strategy:
      matrix:
        python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]

    steps:
      - uses: "actions/checkout@v4"
      - uses: "actions/setup-python@v5"
        with:
          python-version: "${{ matrix.python-version }}"
          allow-prereleases: true
      - name: "Install dependencies"
        run: "scripts/install"
      - name: "Run linting checks"
        run: "scripts/check"
      - name: "Build package & docs"
        run: "scripts/build"
      - name: "Run tests"
        run: "scripts/test"
      - name: "Enforce coverage"
        run: "scripts/coverage"

env:
  PIP_INDEX_URL: http://localhost:8629/2024-01-20
  UV_INDEX_URL: http://localhost:8629/2024-01-20


Failed build logs:
step_name: Python 3.8/5_Run linting checks.txt
log: ##[group]Run scripts/check
[36;1mscripts/check[0m
shell: /usr/bin/bash -e {0}
env:
  pythonLocation: /opt/hostedtoolcache/Python/3.8.18/x64
  PKG_CONFIG_PATH: /opt/hostedtoolcache/Python/3.8.18/x64/lib/pkgconfig
  Python_ROOT_DIR: /opt/hostedtoolcache/Python/3.8.18/x64
  Python2_ROOT_DIR: /opt/hostedtoolcache/Python/3.8.18/x64
  Python3_ROOT_DIR: /opt/hostedtoolcache/Python/3.8.18/x64
  LD_LIBRARY_PATH: /opt/hostedtoolcache/Python/3.8.18/x64/lib
##[endgroup]
+ ./scripts/sync-version
+ ruff format --check --diff starlette tests
67 files already formatted
+ mypy starlette
starlette/concurrency.py:32: error: Need more than 1 value to unpack (2 expected)  [misc]
starlette/_utils.py:77: error: X | Y syntax for unions requires Python 3.10  [syntax]
starlette/exceptions.py:12: error: X | Y syntax for unions requires Python 3.10  [syntax]
starlette/exceptions.py:13: error: X | Y syntax for unions requires Python 3.10  [syntax]
starlette/exceptions.py:13: error: "dict" is not subscriptable, use "typing.Dict" instead  [misc]
starlette/exceptions.py:30: error: X | Y syntax for unions requires Python 3.10  [syntax]
starlette/exceptions.py:59: error: "list" is not subscriptable, use "typing.List" instead  [misc]
Found 7 errors in 3 files (checked 35 source files)
##[error]Process completed with exit code 1.

step_name: Python 3.9/5_Run linting checks.txt
log: ##[group]Run scripts/check
[36;1mscripts/check[0m
shell: /usr/bin/bash -e {0}
env:
  pythonLocation: /opt/hostedtoolcache/Python/3.9.18/x64
  PKG_CONFIG_PATH: /opt/hostedtoolcache/Python/3.9.18/x64/lib/pkgconfig
  Python_ROOT_DIR: /opt/hostedtoolcache/Python/3.9.18/x64
  Python2_ROOT_DIR: /opt/hostedtoolcache/Python/3.9.18/x64
  Python3_ROOT_DIR: /opt/hostedtoolcache/Python/3.9.18/x64
  LD_LIBRARY_PATH: /opt/hostedtoolcache/Python/3.9.18/x64/lib
##[endgroup]
+ ./scripts/sync-version
+ ruff format --check --diff starlette tests
67 files already formatted
+ mypy starlette
starlette/concurrency.py:32: error: Need more than 1 value to unpack (2 expected)  [misc]
starlette/_utils.py:77: error: X | Y syntax for unions requires Python 3.10  [syntax]
starlette/exceptions.py:12: error: X | Y syntax for unions requires Python 3.10  [syntax]
starlette/exceptions.py:13: error: X | Y syntax for unions requires Python 3.10  [syntax]
starlette/exceptions.py:13: error: "dict" is not subscriptable, use "typing.Dict" instead  [misc]
starlette/exceptions.py:30: error: X | Y syntax for unions requires Python 3.10  [syntax]
starlette/exceptions.py:59: error: "list" is not subscriptable, use "typing.List" instead  [misc]
Found 7 errors in 3 files (checked 35 source files)
##[error]Process completed with exit code 1.

step_name: Python 3.10/5_Run linting checks.txt
log: ##[group]Run scripts/check
[36;1mscripts/check[0m
shell: /usr/bin/bash -e {0}
env:
  pythonLocation: /opt/hostedtoolcache/Python/3.10.13/x64
  PKG_CONFIG_PATH: /opt/hostedtoolcache/Python/3.10.13/x64/lib/pkgconfig
  Python_ROOT_DIR: /opt/hostedtoolcache/Python/3.10.13/x64
  Python2_ROOT_DIR: /opt/hostedtoolcache/Python/3.10.13/x64
  Python3_ROOT_DIR: /opt/hostedtoolcache/Python/3.10.13/x64
  LD_LIBRARY_PATH: /opt/hostedtoolcache/Python/3.10.13/x64/lib
##[endgroup]
+ ./scripts/sync-version
+ ruff format --check --diff starlette tests
67 files already formatted
+ mypy starlette
starlette/concurrency.py:32: error: Need more than 1 value to unpack (2 expected)  [misc]
starlette/_utils.py:77: error: X | Y syntax for unions requires Python 3.10  [syntax]
starlette/exceptions.py:12: error: X | Y syntax for unions requires Python 3.10  [syntax]
starlette/exceptions.py:13: error: X | Y syntax for unions requires Python 3.10  [syntax]
starlette/exceptions.py:13: error: "dict" is not subscriptable, use "typing.Dict" instead  [misc]
starlette/exceptions.py:30: error: X | Y syntax for unions requires Python 3.10  [syntax]
starlette/exceptions.py:59: error: "list" is not subscriptable, use "typing.List" instead  [misc]
Found 7 errors in 3 files (checked 35 source files)
##[error]Process completed with exit code 1.

step_name: Python 3.11/5_Run linting checks.txt
log: ##[group]Run scripts/check
[36;1mscripts/check[0m
shell: /usr/bin/bash -e {0}
env:
  pythonLocation: /opt/hostedtoolcache/Python/3.11.7/x64
  PKG_CONFIG_PATH: /opt/hostedtoolcache/Python/3.11.7/x64/lib/pkgconfig
  Python_ROOT_DIR: /opt/hostedtoolcache/Python/3.11.7/x64
  Python2_ROOT_DIR: /opt/hostedtoolcache/Python/3.11.7/x64
  Python3_ROOT_DIR: /opt/hostedtoolcache/Python/3.11.7/x64
  LD_LIBRARY_PATH: /opt/hostedtoolcache/Python/3.11.7/x64/lib
##[endgroup]
+ ./scripts/sync-version
+ ruff format --check --diff starlette tests
67 files already formatted
+ mypy starlette
starlette/concurrency.py:32: error: Need more than 1 value to unpack (2 expected)  [misc]
starlette/_utils.py:77: error: X | Y syntax for unions requires Python 3.10  [syntax]
starlette/exceptions.py:12: error: X | Y syntax for unions requires Python 3.10  [syntax]
starlette/exceptions.py:13: error: X | Y syntax for unions requires Python 3.10  [syntax]
starlette/exceptions.py:13: error: "dict" is not subscriptable, use "typing.Dict" instead  [misc]
starlette/exceptions.py:30: error: X | Y syntax for unions requires Python 3.10  [syntax]
starlette/exceptions.py:59: error: "list" is not subscriptable, use "typing.List" instead  [misc]
Found 7 errors in 3 files (checked 35 source files)
##[error]Process completed with exit code 1.


Changed files:
starlette/_utils.py
starlette/concurrency.py
starlette/exceptions.py

Fix diff:
diff --git a/starlette/_utils.py b/starlette/_utils.py
index 2e7981f..42777c5 100644
--- a/starlette/_utils.py
+++ b/starlette/_utils.py
@@ -1,3 +1,5 @@
+from __future__ import annotations
+
 import asyncio
 import functools
 import re
diff --git a/starlette/concurrency.py b/starlette/concurrency.py
index e9ca46c..215e3a6 100644
--- a/starlette/concurrency.py
+++ b/starlette/concurrency.py
@@ -16,7 +16,7 @@ P = ParamSpec("P")
 T = typing.TypeVar("T")
 
 
-async def run_until_first_complete(*args: tuple[typing.Callable | dict]) -> None:  # type: ignore[type-arg]  # noqa: E501
+async def run_until_first_complete(*args: tuple[typing.Callable, dict]) -> None:  # type: ignore[type-arg]  # noqa: E501
     warnings.warn(
         "run_until_first_complete is deprecated "
         "and will be removed in a future version.",
diff --git a/starlette/exceptions.py b/starlette/exceptions.py
index e6d0b8a..bd3352e 100644
--- a/starlette/exceptions.py
+++ b/starlette/exceptions.py
@@ -1,3 +1,5 @@
+from __future__ import annotations
+
 import http
 import typing
 import warnings