Generate FastAPI projects for high performance applications

Overview

fastapi-mvc

fastapi-mvc CI codecov K8s integration Code style: black PyPI PyPI - Downloads PyPI - Python Version GitHub


Example generated project: https://github.com/rszamszur/fastapi-mvc-example


Features

Generated project core implemented using MVC architectural pattern

Generated project is structured in MVC architectural pattern to help developers who don't know FastAPI yet but are familiar with MVC to get up to speed quickly.

WSGI + ASGI for high performance and better configuration

TLDR;

Running WSGI as a master worker with ASGI workers gives better results than running pure ASGI (for FastAPI for now):

  • better performance (requests per second)
  • better support for different protocols
  • broader configuration
  • better support with using reverse proxy

First of all, whether it's ASGI, WSGI, or combined, think of this as something that serves the application. For instance, Ruby on Rails uses Puma. The result of any of those servers is a TCP/IP or UNIX socket which is later on utilized by reverse proxy ex: Nginx (a TCP/IP socket you can access directly over the network, but still in production, usually it'll be behind a reverse proxy).

Now to WSGI + ASGI part. FastAPI is implemented with asyncio (https://docs.python.org/3/library/asyncio.html), so having a pure WSGI server doesn't make sense since you'd lose all the benefits of asynchronous concurrency. That's where ASGI comes in. However, Python journey with asyncio is still pretty young. Most projects have yet to reach maturity level (you should expect early bugs and a limited feature set). FastAPI, as ASGI server uses uvicorn, which is still prior 1.x.x release (17 in total so far, current 0.16.0) and lacks support for some protocols (ex: no HTTP/2). Moreover, some reverse proxy might not know how to work with asynchronous servers, and some problems or early bugs on this layer might happen as well.

I'm not saying uvicorn is bad. Quite contrary, if you'd run 4 pure uvicorn workes, you'd still get great results. But if you'd run the same amount of workers with gunicorn (WSGI) as a master worker, it turns out you can even pump those numbers up.

Gunicorn with 4 Uvicorn Workers (source: https://stackoverflow.com/a/62977786/10566747):

Requests per second: 7891.28 [#/sec] (mean)
Time per request: 126.722 [ms] (mean)
Time per request: 0.127 [ms] (mean, across all concurrent requests)

Pure Uvicorn with 4 workers:

Requests per second: 4359.68 [#/sec] (mean)
Time per request: 229.375 [ms] (mean)
Time per request: 0.229 [ms] (mean, across all concurrent requests)

~80% better

I guess gunicorn does a better job in worker management. However, it's a more mature project, so it's probably a matter of time when uvicorn (or other ASGI for that matter) will catch up to this benchmark.

Last but not least, gunicorn gives a ton of settings to configure (https://docs.gunicorn.org/en/stable/settings.html), which can come in handy.

Generated project comes with tests at 99% coverage

Unit test coverage is at 99% regardless of chosen configuration. There is also a placeholder for integration tests with an example dummy test.

Proper Dockerfile created with best practices for the cloud and Kubernetes

Container image features:

  • Based on lightweight alpine.
  • Run as PID 1 (with child processes)
  • Utilizes multi-stage build for smallest size possible, also this results in having only necessary libraries/dependencies/tools in outcome container image.
  • DigestSHA - immutable identifier instead of tags, for better reproducibility and security.
  • Signal handling, for Kubernetes to be able to gracefully shut down pods.
  • Created with common layers.

Based on Google Best practices for building containers and own experience.

Extensive GitHub actions for CI

ci_example

Helm chart for Kubernetes

For easily deploying application in Kubernetes cluster.

Reproducible virtualized development environment

Easily boot virtual machine with Vagrant. Code and test straight away.

Note: Project directory is rsync'ed between Host and Guest.

Note2: provided Vagrant vm doesn't have port forwarding configured which means, that application won't be accessible on Host OS.

Redis and aiohttp utilities

For your discretion, I've provided some basic utilities:

  • RedisClient .app.utils.redis
  • AiohttpClient .app.utils.aiohttp_client

They're initialized in asgi.py on FastAPI startup event handler, and are available for whole application scope without passing object instances between controllers.

Kubernetes deployment with HA Redis cluster

Application stack in Kubernetes: k8s_arch

Readable and documented code

The metrics stage in CI workflow ensures important PEP rules are enforced. For additional readability and formatting checks - black is used. Every piece of generated code is documented with docstrings. Last but not least there is also extended README with how to.

Configurable from env

Generated application provides flexibility of configuration. All significant settings are defined by the environment variables, each with the default value.

Quick start

$ pip install fastapi-mvc
$ fastapi-mvc new my-project
$ cd my-project
$ my-project serve

Prerequisites

Installation

pip install fastapi-mvc

Usage

This package exposes simple CLI for easier interaction:

$ fastapi-mvc --help
Usage: fastapi-mvc [OPTIONS] COMMAND [ARGS]...

  Generate and manage fastapi-mvc projects.

Options:
  -v, --verbose  Enable verbose logging.
  --help         Show this message and exit.

Commands:
  new  Create a new FastAPI application.
$ fastapi-mvc new --help
Usage: fastapi-mvc new [OPTIONS] APP_PATH

  Create a new FastAPI application.

  The 'fastapi-mvc new' command creates a new FastAPI application with a
  default directory structure and configuration at the path you specify.

Options:
  -R, --skip-redis                Skip Redis utility files.
  -A, --skip-aiohttp              Skip aiohttp utility files.
  -V, --skip-vagrantfile          Skip Vagrantfile.
  -H, --skip-helm                 Skip Helm chart files.
  -G, --skip-actions              Skip GitHub actions files.
  -C, --skip-codecov              Skip codecov in GitHub actions.
  -I, --skip-install              Dont run make install
  --license [MIT|BSD2|BSD3|ISC|Apache2.0|LGPLv3+|LGPLv3|LGPLv2+|LGPLv2|no]
                                  Choose license.  [default: MIT]
  --repo-url TEXT                 Repository url.
  --help                          Show this message and exit.

To generate new project:

> ~/.bashrc - for zsh: $ echo 'eval "$(_MY_PROJECT_COMPLETE=source_zsh my-project)' >> ~/.zshrc - for fish: $ echo 'eval "$(_MY_PROJECT_COMPLETE=source_fish my-project)' >> ~/.config/fish/completions/my-project.fish">
$ fastapi-mvc new my-project
[install] Begin installing project.
Updating dependencies
Resolving dependencies... (0.7s)

Writing lock file

No dependencies to install or update

Installing the current project: my-project (0.1.0)
Project successfully installed.
To activate virtualenv run: $ poetry shell
Now you should access CLI script: $ my-project --help
Alternatively you can access CLI script via poetry run: $ poetry run my-project --help
To deactivate virtualenv simply type: $ deactivate
To activate shell completion:
 - for bash: $ echo 'eval "$(_MY_PROJECT_COMPLETE=source_bash my-project)' >> ~/.bashrc
 - for zsh: $ echo 'eval "$(_MY_PROJECT_COMPLETE=source_zsh my-project)' >> ~/.zshrc
 - for fish: $ echo 'eval "$(_MY_PROJECT_COMPLETE=source_fish my-project)' >> ~/.config/fish/completions/my-project.fish

To serve api:

$ cd my-project/
$ my-project serve
[2022-01-08 21:47:06 +0100] [2268861] [INFO] Start gunicorn WSGI with ASGI workers.
[2022-01-08 21:47:06 +0100] [2268861] [INFO] Starting gunicorn 20.1.0
[2022-01-08 21:47:06 +0100] [2268861] [INFO] Listening at: http://127.0.0.1:8000 (2268861)
[2022-01-08 21:47:06 +0100] [2268861] [INFO] Using worker: uvicorn.workers.UvicornWorker
[2022-01-08 21:47:06 +0100] [2268861] [INFO] Server is ready. Spawning workers
[2022-01-08 21:47:06 +0100] [2268867] [INFO] Booting worker with pid: 2268867
[2022-01-08 21:47:06 +0100] [2268867] [INFO] Worker spawned (pid: 2268867)
[2022-01-08 21:47:06 +0100] [2268867] [INFO] Started server process [2268867]
[2022-01-08 21:47:06 +0100] [2268867] [INFO] Waiting for application startup.
[2022-01-08 21:47:06 +0100] [2268867] [INFO] Application startup complete.
[2022-01-08 21:47:06 +0100] [2268873] [INFO] Booting worker with pid: 2268873
[2022-01-08 21:47:06 +0100] [2268873] [INFO] Worker spawned (pid: 2268873)
[2022-01-08 21:47:06 +0100] [2268873] [INFO] Started server process [2268873]
[2022-01-08 21:47:06 +0100] [2268873] [INFO] Waiting for application startup.
[2022-01-08 21:47:06 +0100] [2268873] [INFO] Application startup complete.

To confirm it's working:

$ curl localhost:8000/api/ready
{"status":"ok"}

Contributing

Questions, comments or improvements? Please create an issue on Github. I do my best to include every contribution proposed in any way that I can.

License

MIT

Comments
  • Fix install fail when Python version >= 3.10

    Fix install fail when Python version >= 3.10

    A bash condition leads to Python 3.10 being "lower" than Python 3.7, thus the installation of fastapi-mvc would fail.

    Checklist:

    • [x] Added tests for changed code where applicable.
    • [x] Documentation reflects the changes where applicable.
    • [x] Updated the CHANGELOG.md file with your changes.
    • [x] My PR is ready to review.

    Resolves: #60

    Description of the changes being introduced by the pull request: The python version bash condition is changed so Python version >=10 should also pass.

    bug 
    opened by Merinorus 8
  • Restart workers when code changes in development mode

    Restart workers when code changes in development mode

    It would be useful to have reloading changes in development mode. Either as a new option --reload to template CLI serve command, or automatically based on env variable, ex: FASTAPI_ENV=development FASTAPI_ENV=production, similar to Ruby on Rails. Not yet sure which approach would be better. Moreover, just adding --reload flag to WSGI + ASGI combo doesn't work properly, at least from initial tests. It's possible that for development in order to have reloading changes app would need to run on pure uvicorn (ASGI).

    TODO:

    • [x] Research if it's possible to have working reloading changes running gunicorn with uvicorn workers
    • [x] Decide on the way in which this feature should be implemented.
    • [ ] Implement feature + tests
    • [ ] Update template README
    enhancement copier: project 
    opened by rszamszur 6
  • Bump copier from 6.2.0 to 7.0.1

    Bump copier from 6.2.0 to 7.0.1

    Bumps copier from 6.2.0 to 7.0.1.

    Release notes

    Sourced from copier's releases.

    v7.0.1 (2022-10-14)

    Fix

    • remove deprecated code scheduled for removal in Copier v7 (#843)

    v7.0.0 (2022-10-12)

    Feat

    • expand tilde in template source path (#835)

    Fix

    • delete temporary clones after execution automatically (#802)
    • typing: remove invalid migration task stage "task"

    Refactor

    • typing: use abstract container types where possible (#832)
    • use dict constructor as default factory
    • typing: remove unused types
    • remove unreachable code (#826)
    • model a task to execute using a dataclass
    • reduce module imports
    Changelog

    Sourced from copier's changelog.

    v7.0.1 (2022-10-14)

    Fix

    • remove deprecated code scheduled for removal in Copier v7 (#843)

    v7.0.0 (2022-10-12)

    Feat

    • expand tilde in template source path (#835)

    Fix

    • delete temporary clones after execution automatically (#802)
    • typing: remove invalid migration task stage "task"

    Refactor

    • typing: use abstract container types where possible (#832)
    • use dict constructor as default factory
    • typing: remove unused types
    • remove unreachable code (#826)
    • model a task to execute using a dataclass
    • reduce module imports
    Commits
    • ecc0b80 bump: version 7.0.0 → 7.0.1
    • 6085f77 fix: remove deprecated code scheduled for removal in Copier v7 (#843)
    • 3b2bb0e bump: version 6.2.0 → 7.0.0
    • 8cb181a docs: don't lie
    • f0b8490 build(deps): bump plumbum from 1.7.2 to 1.8.0
    • 287b5df build(deps): bump typing-extensions from 4.3.0 to 4.4.0
    • 482db41 refactor(typing): use abstract container types where possible (#832)
    • c653b68 refactor: use dict constructor as default factory
    • 1f40dda docs: replace default argument value N/A by [] for lists
    • 3d00700 refactor(typing): remove unused types
    • Additional commits viewable in compare view

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    dependencies python 
    opened by dependabot[bot] 3
  • Bump pytest-cov from 2.12.1 to 4.0.0

    Bump pytest-cov from 2.12.1 to 4.0.0

    Bumps pytest-cov from 2.12.1 to 4.0.0.

    Changelog

    Sourced from pytest-cov's changelog.

    4.0.0 (2022-09-28)

    Note that this release drops support for multiprocessing.

    • --cov-fail-under no longer causes pytest --collect-only to fail Contributed by Zac Hatfield-Dodds in [#511](https://github.com/pytest-dev/pytest-cov/issues/511) <https://github.com/pytest-dev/pytest-cov/pull/511>_.

    • Dropped support for multiprocessing (mostly because issue 82408 <https://github.com/python/cpython/issues/82408>_). This feature was mostly working but very broken in certain scenarios and made the test suite very flaky and slow.

      There is builtin multiprocessing support in coverage and you can migrate to that. All you need is this in your .coveragerc::

      [run] concurrency = multiprocessing parallel = true sigterm = true

    • Fixed deprecation in setup.py by trying to import setuptools before distutils. Contributed by Ben Greiner in [#545](https://github.com/pytest-dev/pytest-cov/issues/545) <https://github.com/pytest-dev/pytest-cov/pull/545>_.

    • Removed undesirable new lines that were displayed while reporting was disabled. Contributed by Delgan in [#540](https://github.com/pytest-dev/pytest-cov/issues/540) <https://github.com/pytest-dev/pytest-cov/pull/540>_.

    • Documentation fixes. Contributed by Andre Brisco in [#543](https://github.com/pytest-dev/pytest-cov/issues/543) <https://github.com/pytest-dev/pytest-cov/pull/543>_ and Colin O'Dell in [#525](https://github.com/pytest-dev/pytest-cov/issues/525) <https://github.com/pytest-dev/pytest-cov/pull/525>_.

    • Added support for LCOV output format via --cov-report=lcov. Only works with coverage 6.3+. Contributed by Christian Fetzer in [#536](https://github.com/pytest-dev/pytest-cov/issues/536) <https://github.com/pytest-dev/pytest-cov/issues/536>_.

    • Modernized pytest hook implementation. Contributed by Bruno Oliveira in [#549](https://github.com/pytest-dev/pytest-cov/issues/549) <https://github.com/pytest-dev/pytest-cov/pull/549>_ and Ronny Pfannschmidt in [#550](https://github.com/pytest-dev/pytest-cov/issues/550) <https://github.com/pytest-dev/pytest-cov/pull/550>_.

    3.0.0 (2021-10-04)

    Note that this release drops support for Python 2.7 and Python 3.5.

    • Added support for Python 3.10 and updated various test dependencies. Contributed by Hugo van Kemenade in [#500](https://github.com/pytest-dev/pytest-cov/issues/500) <https://github.com/pytest-dev/pytest-cov/pull/500>_.
    • Switched from Travis CI to GitHub Actions. Contributed by Hugo van Kemenade in [#494](https://github.com/pytest-dev/pytest-cov/issues/494) <https://github.com/pytest-dev/pytest-cov/pull/494>_ and [#495](https://github.com/pytest-dev/pytest-cov/issues/495) <https://github.com/pytest-dev/pytest-cov/pull/495>_.
    • Add a --cov-reset CLI option. Contributed by Danilo Šegan in [#459](https://github.com/pytest-dev/pytest-cov/issues/459) <https://github.com/pytest-dev/pytest-cov/pull/459>_.
    • Improved validation of --cov-fail-under CLI option. Contributed by ... Ronny Pfannschmidt's desire for skark in [#480](https://github.com/pytest-dev/pytest-cov/issues/480) <https://github.com/pytest-dev/pytest-cov/pull/480>_.
    • Dropped Python 2.7 support.

    ... (truncated)

    Commits
    • 28db055 Bump version: 3.0.0 → 4.0.0
    • 57e9354 Really update the changelog.
    • 56b810b Update chagelog.
    • f7fced5 Add support for LCOV output
    • 1211d31 Fix flake8 error
    • b077753 Use modern approach to specify hook options
    • 00713b3 removed incorrect docs on data_file.
    • b3dda36 Improve workflow with a collecting status check. (#548)
    • 218419f Prevent undesirable new lines to be displayed when report is disabled
    • 60b73ec migrate build command from distutils to setuptools
    • Additional commits viewable in compare view

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    dependencies python 
    opened by dependabot[bot] 3
  • Add Nix CI workflow

    Add Nix CI workflow

    • [x] I have searched the issues of this repo and believe that this is not a duplicate.

    Feature Request

    I need to play a bit with nix in GH actions prior deciding whether to implement this.

    Clarify/test:

    • nix setup in actions
    • Steps needed to refactor current actions
    • /nix/store caching?

    Resources:

    • https://github.com/cachix/install-nix-action
    • https://github.com/cachix/cachix-action
    automation 
    opened by rszamszur 3
  • Add project template improvements

    Add project template improvements

    Checklist:

    • [x] Added tests for changed code where applicable.
    • [x] Documentation reflects the changes where applicable.
    • [x] Updated the CHANGELOG.md file with your changes.
    • [x] My PR is ready to review.

    Resolves: #90 Resolves: #89

    Description of the changes being introduced by the pull request: Still TODO:

    • [x] Fix project template style guide
    • [x] Refactor some of the project template configuration * remove --skip-vagrantfile * remove --skip-redis (?) * remove --skip-helm (?)
    • [x] Update docs, readme
    • [ ] Add --skip-docs option (?)
    • [x] Add GH pages docs deployment if GH actions enabled
    • [ ] Move generated HOW TO in project readme to generated Sphinx docs
    enhancement copier: project refactor 
    opened by rszamszur 3
  • Initial implementation of generators feature

    Initial implementation of generators feature

    Checklist:

    • [x] Added tests for changed code where applicable.
    • [ ] Documentation reflects the changes where applicable.
    • [x] Updated the CHANGELOG.md file with your changes.
    • [x] My PR is ready to review.

    Resolves: #69 Resolves: #68 Resolves: #47 Resolves: #71 Resolves: #72 Resolves: #73

    Description of the changes being introduced by the pull request:

    TODO:

    • [x] Implement base abstract class for all generators to inherit
    • [x] Solve the problem of dynamically creating click sub-commands at runtime - add initial implementation.
    • [x] Implement method for programmatically loading user generated generators from path at runtime
    • [x] Solve the problem of dynamically creating click sub-commands arguments and options at runtime based on chosen generators - add initial implementation
    • [x] Implement controller generator with template
    • [x] Implement generator generator with template
    • [x] Refactor invoker with using deque
    • [x] Refactor fastapi_mvc.commands to be more generic
    • [x] Implement global except hook, refactor current project exceptions
    • [x] Add and modify unit test cases
    • [x] Add docstrings
    • [x] Fix styleguide
    • [ ] Add integration tests for builtins generators -> will be done via #76
    • [x] Add integration tests for programmatically loading user generators

    This will be a looooong merge :rocket:

    enhancement refactor 
    opened by rszamszur 3
  • Fix `fastapi-mvc run` implementation

    Fix `fastapi-mvc run` implementation

    Checklist:

    • [ ] Added tests for changed code where applicable.
    • [ ] Documentation reflects the changes where applicable.
    • [ ] Updated the CHANGELOG.md file with your changes.
    • [ ] My PR is ready to review.

    **Resolves: #48 **

    Description of the changes being introduced by the pull request: Draft solution, TODO:

    • [ ] Update docs
    • [ ] Manually test current command implementation with different scenarios
    • [ ] Extend current unit test cases?
    • [ ] Update documentation
    bug 
    opened by rszamszur 3
  • ModuleNotFoundError: No module named 'test-app'

    ModuleNotFoundError: No module named 'test-app'

    • [X ] I have searched the issues of this repo and believe that this is not a duplicate.

    Describe the bug

    I receive the error ModuleNotFoundError: No module named 'test-app' after fresh install of fastapi-mvc

    Expected behavior

    :) to work

    To Reproduce

    Install fastapi-mvc on a mac machine with MacOS High Sierra 10.13.6 and follow the steps from documentation: pip install fastapi-mvc fastapi-mvc new /test-app cd /test-app fastapi-mvc run

    Environment

    • Python version: 3.9.7
    • Operating System and version: MacOS High Sierra 10.13.6
    • fastapi-mvc version: https://github.com/rszamszur/fastapi-mvc/releases/tag/0.8.0

    Additional context

    bug 
    opened by faierbol 3
  • Fix #39

    Fix #39

    Checklist:

    • [x] Added tests for changed code where applicable.
    • [ ] Documentation reflects the changes where applicable.
    • [x] Updated the CHANGELOG.md file with your changes.
    • [x] My PR is ready to review.

    Resolves: #39

    Description of the changes being introduced by the pull request:

    bug 
    opened by rszamszur 3
  • Migrate to Poetry 1.2.x release

    Migrate to Poetry 1.2.x release

    The get-poetry.py script will be replaced in Poetry 1.2 by install-poetry.py.

    Moreover, some additional adjustments will be needed in order to accommodate to new minor version:

    • [x] Change default $POETRY_HOME to $HOME/.local/share/pypoetry in all relevant files (make scripts, Dockerfiles, nix shell expressions).
    • [x] Change absolute path to poetry executable to: $POETRY_HOME/venv/bin/poetry
    • [x] Update install scripts with install-poetry.py URL.
    • [ ] Update Poetry config in GitHub workflows

    The above applies to both package (fastapi-mvc) and template.

    enhancement 
    opened by rszamszur 3
  • Handle generator aliases conflicts

    Handle generator aliases conflicts

    • [x] I have searched the issues of this repo and believe that this is not a duplicate.

    Feature Request

    Resolve how to handle generator aliases conflicts. Currently, there is no mechanism for such a scenario. https://github.com/fastapi-mvc/fastapi-mvc/blob/46c6dc5c873edeb12724e599246de864d3f2f68a/fastapi_mvc/core.py#L427-L428

    enhancement 
    opened by rszamszur 0
  • Dockerfile is missing `git` runtime dependency

    Dockerfile is missing `git` runtime dependency

    • [x] I have searched the issues of this repo and believe that this is not a duplicate.

    Describe the bug

    Dockerfile is missing git runtime dependency. Without it fastapi-mvc will not work.

    Expected behavior

    Does not apply

    To Reproduce

    Does not apply

    Environment

    • Python version:
    • Operating System and version:
    • fastapi-mvc version:

    Additional context

    bug dockerfile 
    opened by rszamszur 0
  • Implement type checking in copier-project template

    Implement type checking in copier-project template

    • [ ] I have searched the issues of this repo and believe that this is not a duplicate.

    Feature Request

    Implement type checking, and add some checks in the CI action as well.

    enhancement copier: project 
    opened by rszamszur 0
  • Implement type checking

    Implement type checking

    • [x] I have searched the issues of this repo and believe that this is not a duplicate.

    Feature Request

    Implement type checking for fastapi-mvc Probably add some checks in the CI action as well.

    enhancement 
    opened by rszamszur 0
  • [Databases support] Implement Session class responsible for managing SQLAlchemy session

    [Databases support] Implement Session class responsible for managing SQLAlchemy session

    • [x] I have searched the issues of this repo and believe that this is not a duplicate.

    Feature Request

    This class will be responsible for managing SQLAlchemy engine connection and session.

    To figure out/clarify:

    • What SQLAlchemy engine and session/sessionmaker parameters should be configurable for the user via pydantic BaseSettings configuration class.
    • How long keep an open session? Perpetual per worker? Or per request with a context manager?
    • Only implement async session or sync as well?
    • How to pass session to FastAPI controllers? Via FastAPI Depends()? Or just do plain import and access class variable for sessionmaker object instance?
    • How to handle different database engine hacks (for instance sqlite needs connect_args={"check_same_thread": False}). Might be useful: https://github.com/pallets-eco/flask-sqlalchemy/blob/e5bf821072de0d55ff92891432004322864a7265/src/flask_sqlalchemy/init.py#L888
    • ?
    enhancement copier: project 
    opened by rszamszur 0
  • Version management workflow

    Version management workflow

    • [x] I have searched the issues of this repo and believe that this is not a duplicate.

    Issue

    Hi, thanks for this wonderful tool, it's a very nice starting point for my projects.

    I just wonder how the release process could be. I mean, with poetry version I can bump the version defined in pyproject.toml -> [tool.poetry] -> version, but I wonder how to update the TAG file as well, automatically. And also, how to refresh CHANGELOG.md accordingly with (semantic) commit messages?

    Any recommended workflow?

    UPDATE: btw, I also see we have a version.py to keep up-to-date.

    question 
    opened by paolodina 6
Releases(0.24.0)
Owner
Radosław Szamszur
Way of the Peaceful Warrior|武士道 Whoever is reading this, I wish you a beautiful day!
Radosław Szamszur
Backend logic implementation for realworld with awesome FastAPI

Backend logic implementation for realworld with awesome FastAPI

Nik 2.2k Jan 08, 2023
A simple docker-compose app for orchestrating a fastapi application, a celery queue with rabbitmq(broker) and redis(backend)

fastapi - celery - rabbitmq - redis - Docker A simple docker-compose app for orchestrating a fastapi application, a celery queue with rabbitmq(broker

Kartheekasasanka Kaipa 83 Dec 19, 2022
A Jupyter server based on FastAPI (Experimental)

jupyverse is experimental and should not be used in place of jupyter-server, which is the official Jupyter server.

Jupyter Server 122 Dec 27, 2022
Fastapi practice project

todo-list-fastapi practice project How to run Install dependencies npm, yarn: standard-version, husky make: script for lint, test pipenv: virtualenv +

Deo Kim 10 Nov 30, 2022
Code for my JWT auth for FastAPI tutorial

FastAPI tutorial Code for my video tutorial FastAPI tutorial What is FastAPI? FastAPI is a high-performant REST API framework for Python. It's built o

José Haro Peralta 8 Dec 16, 2022
The template for building scalable web APIs based on FastAPI, Tortoise ORM and other.

FastAPI and Tortoise ORM. Powerful but simple template for web APIs w/ FastAPI (as web framework) and Tortoise-ORM (for working via database without h

prostomarkeloff 95 Jan 08, 2023
Reusable utilities for FastAPI

Reusable utilities for FastAPI Documentation: https://fastapi-utils.davidmontague.xyz Source Code: https://github.com/dmontagu/fastapi-utils FastAPI i

David Montague 1.3k Jan 04, 2023
I'm curious if pydantic + fast api can be sensibly used with DDD + hex arch methodology

pydantic-ddd-exploration I'm curious if pydantic + fast api can be sensibly used with DDD + hex arch methodology Prerequisites nix direnv (nix-env -i

Olgierd Kasprowicz 2 Nov 17, 2021
Example of integrating Poetry with Docker leveraging multi-stage builds.

Poetry managed Python FastAPI application with Docker multi-stage builds This repo serves as a minimal reference on setting up docker multi-stage buil

Michael Oliver 266 Dec 27, 2022
The base to start an openapi project featuring: SQLModel, Typer, FastAPI, JWT Token Auth, Interactive Shell, Management Commands.

The base to start an openapi project featuring: SQLModel, Typer, FastAPI, JWT Token Auth, Interactive Shell, Management Commands.

Bruno Rocha 251 Jan 09, 2023
Mnist API server w/ FastAPI

Mnist API server w/ FastAPI

Jinwoo Park (Curt) 8 Feb 08, 2022
A simple api written in python/fastapi that serves movies from a cassandra table.

A simple api written in python/fastapi that serves movies from a cassandra table. 1)clone the repo 2)rename sample_global_config_.py to global_config.

Sreeraj 1 Aug 26, 2021
volunteer-database

This is the official CSM (Crowd source medical) database The What Now? We created this in light of the COVID-19 pandemic to allow volunteers to work t

32 Jun 21, 2022
更新 2.0 版本,使用 Python WEB 高性能异步框架 FastAPI 制作的抖音无水印解析下载,采用前后端分离思想!

前言 这个是 2.0 版本,使用现在流行的前后端分离思想重构。 体验网址:https://douyin.bigdataboy.cn 更新日志 2020.05.30:使用 FastAPI 前后端分离重构 2020.05.02:已更新,正常使用 2020.04.27:抖音结构更新,已修复视频有水印。(失

64 Nov 25, 2022
API & Webapp to answer questions about COVID-19. Using NLP (Question Answering) and trusted data sources.

This open source project serves two purposes. Collection and evaluation of a Question Answering dataset to improve existing QA/search methods - COVID-

deepset 329 Nov 10, 2022
Example app using FastAPI and JWT

FastAPI-Auth Example app using FastAPI and JWT virtualenv -p python3 venv source venv/bin/activate pip3 install -r requirements.txt mv config.yaml.exa

Sander 28 Oct 25, 2022
An image validator using FastAPI.

fast_api_image_validator An image validator using FastAPI.

Kevin Zehnder 7 Jan 06, 2022
An extension for GINO to support Starlette server.

gino-starlette Introduction An extension for GINO to support starlette server. Usage The common usage looks like this: from starlette.applications imp

GINO Community 75 Dec 08, 2022
A minimalistic example of preparing a model for (synchronous) inference in production.

A minimalistic example of preparing a model for (synchronous) inference in production.

Anton Lozhkov 6 Nov 29, 2021
Auth for use with FastAPI

FastAPI Auth Pluggable auth for use with FastAPI Supports OAuth2 Password Flow Uses JWT access and refresh tokens 100% mypy and test coverage Supports

David Montague 95 Jan 02, 2023