/fast_template

Build a FastAPI application using conventional Python and layered architecture.

Primary LanguagePythonMIT LicenseMIT

Project generated with PyScaffold

fast_tutorial

Build a FastAPI application using conventional Python and layered architecture.

There are a lot of resources I've used to get my projects running:

  • Docker containers: start with deployment in mind.
  • Tests: always a good idea to test-drive anything.
  • Sphinx: for documentation.
  • Tox: for testing, building, deploying, and more.
  • Makefile and local scripts: for running common tasks.
  • Layered architecture: for keeping the code testable and maintainable.

If I can remember what the standard way to use these are, that would be wonderful. Since I can't, I wrote a tutorial to learn the material more deeply and leave a reference for later.

Project Setup

To get started, you'll need to clone the respository:

git clone git@github.com:davidrichards/fast_template.git

Then, you'll need to install the dependencies. I like to do this in a conda environment, because I work with an M1 Mac.

conda create -n fast_tutorial python=3.9
conda activate fast_tutorial
pip install -r requirements.txt

At this point, you should be able to run the tests:

tox

If the tests pass, you're ready to start the server:

make run

In our case, we have two containers running: one for the FastAPI application and one for the database. The FastAPI application is running on port 8000, and the database is running on port 5432.

Because this is a tutorial repository, I will show you how to do this for your own projects.

Roadmap

This is the general plan for the project, likely to change dramatically:

  • 0.1.0: Initial release
  • 0.2.0: Examples run a few times, updated instructions
  • 0.3.0: Diagrams and visual artifacts added
  • 0.4.0: Deeper explanations, more data storage and container options
  • 0.5.0: Reviewed and updated
  • 1.0.0: Simulacra-based release (interactive examples using an LLM and online presentation)

Contributing

Contributions are welcome! Please see the Contributing Guide for more details.

Always remember to be kind and respectful to yourself, Humane Coding . Then, do the same for others.

Note

This project has been set up using PyScaffold 4.5. For details and usage information on PyScaffold see https://pyscaffold.org/.