Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • 07:29
    awemulya commented #213
  • 07:00

    github-actions[bot] on master

    📝 Update release notes (compare)

  • 05:36
    github-actions[bot] commented #2443
  • 05:34
    codecov[bot] commented #2443
  • 05:34
    codecov[bot] commented #2443
  • 05:32
    codecov[bot] commented #2443
  • 05:32
    codecov[bot] commented #2443
  • 05:32
    waynerv synchronize #2443
  • 01:51
    PriyatamNayak commented #1718
  • 01:39
    Mickls edited #2456
  • 01:37
    Mickls opened #2456
  • 01:37
    Mickls labeled #2456
  • 01:06
    dstlny commented #2448
  • 00:51
    dstlny commented #2448
  • 00:51
    dstlny commented #2448
  • 00:28
    Bill-Lathrop commented #2448
  • 00:26
    Bill-Lathrop commented #2448
  • Dec 01 23:44
    github-actions[bot] commented #2431
  • Dec 01 23:43
    tricosmo commented #2431
  • Dec 01 23:43
    codecov[bot] commented #2431
Nicolas Gilles
@ngilles
I'm not sure how workers are isolated ... I'm assuming different processes... so maybe the solution is shared memory or something like that, in which case, redis might actually be an easier solution
if they are just threads, well, an object and lock and you should be fine
Akhilesh Kumar
@Max2ben_twitter
ok. Thanks @ngilles and @madkote
Workers are processes
Nicolas Gilles
@ngilles
though not sure how to mix that with the async nature actually :D
Alexandre Gerona
@alecgerona
Anyone has an idea how to make mypy happy in this instance?
Marcelo Trylesinski
@Kludex
can I see the two classes involved on that union? @alecgerona
Valon Januzaj
@vjanz
@alecgerona I also had similar issues
What you have to do is to look at the infered return types, and then to do some checking or assertion ( not recommended) because it can cause problems in prod.
Do some "strict" type checking yourself and then mypy knows that it had passed that kind of check, and the error will dissapear
ruselljane
@ruselljane

@eseglem thank you for replying to me
this is the error
?[33mWARNING?[0m: Detected file change in 'main.py'. Reloading...
email-validator not installed, email fields will be treated as str.
To install, run: pip install email-validator
Process SpawnProcess-5:
Traceback (most recent call last):
File "c:\users\rquitain\appdata\local\programs\python\python38\lib\multiprocessing\process.py", line 315, in _bootstrap
self.run()
File "c:\users\rquitain\appdata\local\programs\python\python38\lib\multiprocessing\process.py", line 108, in run
self._target(self._args, *self._kwargs)
File "C:\Users\rquitain\AppData\Roaming\Python\Python38\site-packages\uvicorn\subprocess.py", line 61, in subprocess_started
target(sockets=sockets)
File "C:\Users\rquitain\AppData\Roaming\Python\Python38\site-packages\uvicorn\main.py", line 407, in run
loop.run_until_complete(self.serve(sockets=sockets))
File "c:\users\rquitain\appdata\local\programs\python\python38\lib\asyncio\base_events.py", line 616, in run_until_complete
return future.result()
File "C:\Users\rquitain\AppData\Roaming\Python\Python38\site-packages\uvicorn\main.py", line 414, in serve
config.load()
File "C:\Users\rquitain\AppData\Roaming\Python\Python38\site-packages\uvicorn\config.py", line 300, in load
self.loaded_app = import_from_string(self.app)
File "C:\Users\rquitain\AppData\Roaming\Python\Python38\site-packages\uvicorn\importer.py", line 23, in import_from_string
raise exc from None
File "C:\Users\rquitain\AppData\Roaming\Python\Python38\site-packages\uvicorn\importer.py", line 20, in import_from_string
module = importlib.import_module(module_str)
File "c:\users\rquitain\appdata\local\programs\python\python38\lib\importlib__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
File "<frozen importlib._bootstrap>", line 991, in _find_and_load
File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 783, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File ".\main.py", line 2, in <module>
from fastapi.responses import JSONResponses

ModuleNotFoundError: No module named 'fastapi.responses'

ran pip list and found these versions
(ConvergedApp) C:\Users\rquitain\Documents\GitHub\fbprophet-forecasting-api>pip list
uvicorn 0.12.1
fastapi 0.61.1

fbprophet 0.7.1

also yes im using the environment i made but installed there firstly fast api and ran pip list on that environment

Ak4zh
@Ak4zh
Can anyone help me deploy https://github.com/long2ice/fastapi-admin frontend and backend on a single heroku app.
Valon Januzaj
@vjanz
@ruselljane please format your snipet..
Ak4zh
@Ak4zh

Can anyone help me deploy https://github.com/long2ice/fastapi-admin frontend and backend on a single heroku app.
Yarn build is creating the files inside /dist but my fastapi is trying to access "GET /js/app.2e733260.js HTTP/1.1" 404 and getting 404

I did app.mount("/dist", StaticFiles(directory="dist"))

David Baldo
@baldodavi_gitlab
Hi all, using openapi_url and proxy my fastapi docker container behind a nginx server my apis are correctly available and openapi.json is also available at https://address/subaddress/api/v1/openapi.json. https://address/subaddress/docs give me following error:
Fetch error NetworkError when attempting to fetch resource. /api/v1/openapi.json
What's wrong ?
David Baldo
@baldodavi_gitlab

Hi all, using openapi_url and proxy my fastapi docker container behind a nginx server my apis are correctly available and openapi.json is also available at https://address/subaddress/api/v1/openapi.json. https://address/subaddress/docs give me following error:
Fetch error NetworkError when attempting to fetch resource. /api/v1/openapi.json
What's wrong ?

Solved using openapi_prefix="/subaddress", docs is available.
Perhaps I've another issue: when trying to use autheticate to access to protected routes in /docs page i've the following error: auth errorTypeError: NetworkError when attempting to fetch resource.
Any advice? Thanks in advance!

Steven Garcia
@sjosegarcia
I was wondering if anyone solved how to convert sqlalchemy records into pydantic models.
ruselljane
@ruselljane
thank you @eseglem , did conda install uvicorn.
Darren Eberly
@Cleptomania
Does anyone know if there is a way to exclude a router from docs?
Pedro
@phaltoe85_twitter

Hi guys, beginner here, I am wondering if anyone can help me with this:

def get_address_from_latitude_and_longitude(latlng: Tuple[float, float]):

I am getting this:
AssertionError: Path params must be of one of the supported types

Carlo Mazzaferro
@carlomazzaferro
Hi all, QQ: the /openapi.json endpoint does not contain the example section https://swagger.io/docs/specification/adding-examples/ in the ['endpoint_name']['schema']['requestBody'], however my FastAPI endpoint clearly has a generated one in the Swagger. How can I get it? Need to programmatically fetch it
@phaltoe85_twitter Tuples are not supported by the OpenAPI spec: tiangolo/fastapi#466 , ran into this recently as well :)
Pedro
@phaltoe85_twitter
thanks @carlomazzaferro!
Carlo Mazzaferro
@carlomazzaferro
@Cleptomania not sure if it fits your needs but https://fastapi.tiangolo.com/advanced/path-operation-advanced-configuration/#exclude-from-openapi you can exclude a certain path
Just to note, my models are dynamically generated so I can't manually set the schema_extra in my pydantic models
sreemol-s
@sreemol-s
hi
Valon Januzaj
@vjanz
Guys, how do you ignore alembic directory from mypy?
Andreas Franzén
@triptec
@vjanz ```
[mypy-app.tests.*]
ignore_errors = True
but change the .tests. to .alembic. perhaps
Valon Januzaj
@vjanz
So the tests in this case refers to the directory right
Andreas Franzén
@triptec
yeah
Valon Januzaj
@vjanz
Yes let me try, thank you!
Andreas Franzén
@triptec
actually app.tests represent dirs
so I have app/tests
Valon Januzaj
@vjanz
In my case mypy-src.alembic
Thank you man :)
Andreas Franzén
@triptec
np
Jan Kesten
@janobug_gitlab
Hi there - maybe a noob question: is it normal that an uvicorn started fastapi does only use a singe cpu core?
Timothée Mazzucotelli
@pawamoy
Hi there - weird question on my end... can I run fastapi synchronously? I need to deploy a web service that will handle only one request at a time (to prevent data corruption on disk). I could use another api framework but it would be so much simpler with fastapi/pydantic. Maybe I can just run it through a wsgi server like gunicorn, with a single process?
Nicolas Gilles
@ngilles
@pawamoy that will not solve your problem, if you want to make sure only one request is running at a time, use a lock
Jan Kesten
@janobug_gitlab
I tried different combinations, but what ever I do - one cpu core is 100% busy and the other one just idle. Is that by design?
I saw that I could start uvicorn with --workers - but as I need some huge in memory data structure, this leads to high memory pressure which I would like to avoid.
flapili
@flapili
The ram is cheap in 2020, if you are in a working context explain to your boss the time to learn and use https://docs.python.org/fr/3.8/library/mmap.html is not worse at all
Jan Kesten
@janobug_gitlab
I know mmap - which is what came to my mind already (as old c hacker). But I was wondering if it is 'right' that only one core is used. As for the ram, this is a private project - but data volume is quite huge anyway. I tried some in memory data grid - but it blows up the needed memory too much. Right now it's a numpy array.
Daniel Lassahn
@meteoDaniel
Dear all, I am having a problem with nested asynchronous functions. I receive the well known Message: RuntimeError: This event loop is already running. By adding nest_asyncio.apply() my test's are running but on production the api runs with uvicorn and it does not work anymore. This is because nest_asyncio does not support uvloop. I hope anyone knows the right work around.
Daniel Lassahn
@meteoDaniel

Dear all, I am having a problem with nested asynchronous functions. I receive the well known Message: RuntimeError: This event loop is already running. By adding nest_asyncio.apply() my test's are running but on production the api runs with uvicorn and it does not work anymore. This is because nest_asyncio does not support uvloop. I hope anyone knows the right work around.

I solved this issue by using hypercorn!

Noah
@LoopsGod
hi
I am using SqlAlchemy with db: Session dependency injected
But i keep hitting pool limits
It appears as though it's recreating / adding a new pool on every request