Skip to content

Commit

Permalink
Fix support for Python 3.8
Browse files Browse the repository at this point in the history
Python 3.8 does not have `typing.Annotated` built-in.
The `typing-extensions` package has corresponding backports.
  • Loading branch information
amotl committed Apr 15, 2024
1 parent 0bc295a commit d8a09c6
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
9 changes: 8 additions & 1 deletion imagecast/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@
# (c) 2020-2021 Andreas Motl <andreas@terkin.org>
# License: GNU Affero General Public License, Version 3
import logging
import sys
from dataclasses import dataclass
from functools import lru_cache
from typing import List, Annotated
from typing import List
from urllib.parse import urlparse

from fastapi import Depends, FastAPI, HTTPException, Query
Expand All @@ -17,6 +18,12 @@
from imagecast.core import process


if sys.version_info < (3, 9):
from typing_extensions import Annotated
else:
from typing import Annotated


# https://fastapi.tiangolo.com/advanced/settings/
class Settings(BaseSettings):
allowed_hosts: List[str] = []
Expand Down
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
},
zip_safe=False,
install_requires=[
"typing-extensions<5; python_version<'3.9'",
"docopt-ng>=0.6,<1",
"munch>=2.3,<5",
"Pillow>=8,<11",
Expand Down

0 comments on commit d8a09c6

Please sign in to comment.