fastapi/applications.py", line 55 **extra: Any
See original GitHub issueapp.py in /app
# external libraries
import uvicorn
from fastapi import FastAPI
from pydantic import BaseSettings
class Config(BaseSettings):
API_APP_NAME="name"
APP_VERSION="1"
EXPOSE_PORT=80
DEVELOPMENT=True
WORKERS=1
TIMEOUT=5
conf = Config()
# main instance of webserver
app = FastAPI(
title=conf.API_APP_NAME,
description="Auth users and resources",
version=conf.APP_VERSION,
)
@app.get("/healthcheck", tags=["app"])
def healthcheck():
return True
# start config
if __name__=="__main__":
uvicorn.run(
"app:app",
host='0.0.0.0',
port=conf.EXPOSE_PORT,
reload= conf.DEVELOPMENT,
debug= conf.DEVELOPMENT,
workers=conf.WORKERS,
timeout_keep_alive=conf.TIMEOUT)
Traceback
Traceback (most recent call last):
File "app.py", line 3, in <module>
from fastapi import FastAPI
File "/usr/local/lib/python3.8/site-packages/fastapi/__init__.py", line 7, in <module>
from .applications import FastAPI
File "/usr/local/lib/python3.8/site-packages/fastapi/applications.py", line 55
**extra: Any,
^
SyntaxError: invalid syntax
Environment
- OS: WSL 2 (Linux)
Additional context - Docker file
########################################################################################
#
# This build stage builds the sources
#
########################################################################################
FROM python:3.8 AS builder
# Create the directory and instruct Docker to operate
# from there from now on
RUN mkdir /app
WORKDIR /app
# Copy the requirements file in order to install
# Python dependencies
COPY requirements.txt .
# Install Python dependencies
RUN pip install --upgrade pip --upgrade setuptools
RUN apt-get update && \
apt-get install --no-install-suggests --no-install-recommends --yes python3-venv gcc libpython3-dev
RUN pip install -r requirements.txt
# We copy the rest of the codebase into the image
COPY . .
########################################################################################
#
# This build stage creates an anonymous user to be used with the distroless build
# as defined below.
#
########################################################################################
FROM python:3.8 AS anon-user
RUN sed -i -r "/^(root|nobody)/!d" /etc/passwd /etc/shadow /etc/group \
&& sed -i -r 's#^(.*):[^:]*$#\1:/sbin/nologin#' /etc/passwd
########################################################################################
#
# This build stage creates a distroless image for production.
#
##############################################################################
FROM gcr.io/distroless/python3
COPY --from=builder /app /app
COPY --from=builder /usr/local/lib/python3.8/site-packages /usr/local/lib/python3.8/site-packages
COPY --from=anon-user /etc/passwd /etc/shadow /etc/group /etc/
ENV LC_ALL C.UTF-8
USER nobody
WORKDIR /app
# Set an environment variable with the directory
# where we'll be running the app
ENV APP /app
ENV PYTHONPATH=/usr/local/lib/python3.8/site-packages
CMD ["app.py"]
Issue Analytics
- State:
- Created 3 years ago
- Comments:10 (6 by maintainers)
Top Results From Across the Web
RuntimeError: No response returned in FastAPI when refresh ...
py ", line 55, in __call__ response = await self.dispatch_func(request, call_next) File "/gateway/./app/core/middlewares.py", line 26, ...
Read more >Release Notes - FastAPI
Upgraded and relaxed dependencies for package extras all (including new Uvicorn version), when you install "fastapi[all]" . New docs about how to Help ......
Read more >tiangolo/fastapi - Gitter
I want to deploy my app, but my hoster requires it to have a wsgi.py (https://docs.gandi.net/en/simple_hosting/instance_languages/python.html) , so I was ...
Read more >TimeoutError when Flow is finishing - Prefect Discourse
In this example Flow, each task is importing a set of external python scripts and executing their main with appropriate values.
Read more >textcat.teach error with ja language model - Prodigy Support
I believe I have installed all dependencies, but what is the issue here please? ... -packages/fastapi/applications.py", line 142, in __call__ await super().
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Thanks for the help here @Mause ! 👏 🙇
Thanks for reporting back and closing the issue @TobiaszG24 👍