Skip to content

iamdanielv/pythonmicroservice

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

50 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Python Microservice

A Sample Python Microservice using FastAPI

Prerequisites

Before you begin, ensure you have the following installed:

  • Python 3.11 or higher
  • pip (Python package installer)
  • pipenv

Create a virtual environment

To create an environment from scratch, you can run the following command in your terminal:

python3 -m venv .venv

followed by activating the environment:

source .venv/bin/activate

Alternative way of creating an environment is to use the makefile:

make env

The make file will tell you how to activate the environment. In my case it printed out:

[i] To activate the virtual environment, type:
  source pythonmicroservice.venv/bin/activate 

Install Application Requirements

Manual way of installing dependencies

Note

You should activate your virtual environment before installing dependencies.

Install FastAPI:

pip install "fastapi[all]"

Install all other requirements:

pip install -r requirements.txt

Using makefile way of installing dependencies

If you used the command:

make env

all of the requirements should already be installed for you. Just make sure that you have activated the environment.

Start the server

To start the server, you can run the following command in your terminal:

uvicorn src.main:app --reload

Or you can use the makefile target

make run

View Docs

Documentation is available at:

docs

or

redocs

About

A Sample Python Microservice using FastAPI

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published