FastAPI Workshop - First Steps¶
In the following chapters I'll show you the code for the FastAPI workshop.
Before we start writing code, we need to set up the environment, install the packages, etc.
Make sure you create a Python virtual environment as described in the previous section Virtual Environments.
Install Dependencies¶
In your project directory create a file requirements.txt
with the following content:
fastapi
uvicorn
sqlmodel
Make sure you activate your virtual environment and install these packages with the command:
# (env) $$ pip install -r requirements.txt
Development Dependencies¶
You can also install some packages that are useful during development, they can help you to detect errors, autoformat our code, etc.
You could put them in another file to separate the packages you need to run your application and the packages that are only used during development. For example you could name it dev-requirements.txt
.
Here are some of the packages I normally use during development that can be useful to you.
black
mypy
flake8
isort
autoflake
Then you could install them in your virtual environment with:
# (env) $$ pip install -r dev-requirements.txt