{"id":16429939,"url":"https://github.com/smarlhens/python-fastapi-hello-word","last_synced_at":"2025-10-26T23:31:38.437Z","repository":{"id":49650425,"uuid":"505836073","full_name":"smarlhens/python-fastapi-hello-word","owner":"smarlhens","description":"FastAPI hello-world example API using uvicorn.","archived":false,"fork":false,"pushed_at":"2024-04-29T21:20:38.000Z","size":46,"stargazers_count":0,"open_issues_count":2,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-04-29T23:07:43.089Z","etag":null,"topics":["fastapi","hello-world","python","uvicorn"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/smarlhens.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-06-21T12:35:39.000Z","updated_at":"2022-06-22T09:29:50.000Z","dependencies_parsed_at":"2024-03-18T22:25:06.004Z","dependency_job_id":"227dceb6-ee00-40ea-a6a8-9022e02e5936","html_url":"https://github.com/smarlhens/python-fastapi-hello-word","commit_stats":null,"previous_names":[],"tags_count":0,"template":true,"template_full_name":"smarlhens/python-boilerplate","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/smarlhens%2Fpython-fastapi-hello-word","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/smarlhens%2Fpython-fastapi-hello-word/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/smarlhens%2Fpython-fastapi-hello-word/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/smarlhens%2Fpython-fastapi-hello-word/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/smarlhens","download_url":"https://codeload.github.com/smarlhens/python-fastapi-hello-word/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":219862103,"owners_count":16555980,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["fastapi","hello-world","python","uvicorn"],"created_at":"2024-10-11T08:24:58.768Z","updated_at":"2025-10-26T23:31:33.164Z","avatar_url":"https://github.com/smarlhens.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://fastapi.tiangolo.com/\" target=\"blank\"\u003e\u003cimg src=\"https://cdn.worldvectorlogo.com/logos/fastapi.svg\" height=\"100\" alt=\"FastAPI logo\" /\u003e\u003c/a\u003e\n  \u003ca href=\"https://github.com/encode/uvicorn\" target=\"blank\"\u003e\u003cimg src=\"https://raw.githubusercontent.com/tomchristie/uvicorn/master/docs/uvicorn.png\" height=\"100\" alt=\"uvicorn logo\" /\u003e\u003c/a\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://python-poetry.org/\" target=\"blank\"\u003e\u003cimg src=\"https://python-poetry.org/images/logo-origami.svg\" height=\"80\" alt=\"Poetry logo\" /\u003e\u003c/a\u003e\n  \u003ca href=\"https://pre-commit.com/\" target=\"blank\"\u003e\u003cimg src=\"https://pre-commit.com/logo.svg\" height=\"80\" alt=\"pre-commit logo\" /\u003e\u003c/a\u003e\n  \u003ca href=\"https://pycqa.github.io/isort/\" target=\"blank\"\u003e\u003cimg src=\"https://pycqa.github.io/isort/art/logo.png\" height=\"80\" alt=\"isort logo\" /\u003e\u003c/a\u003e\n  \u003ca href=\"https://bandit.readthedocs.io/\" target=\"blank\"\u003e\u003cimg src=\"https://raw.githubusercontent.com/pycqa/bandit/main/logo/logo.svg\" height=\"80\" alt=\"bandit logo\" /\u003e\u003c/a\u003e\n  \u003ca href=\"https://docs.pytest.org/\" target=\"blank\"\u003e\u003cimg src=\"https://raw.githubusercontent.com/pytest-dev/pytest/main/doc/en/img/pytest_logo_curves.svg\" height=\"80\" alt=\"pytest logo\" /\u003e\u003c/a\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://docs.docker.com/\" target=\"blank\"\u003e\u003cimg src=\"https://www.docker.com/wp-content/uploads/2022/03/Moby-logo.png\" height=\"60\" alt=\"Docker logo\" /\u003e\u003c/a\u003e\n  \u003ca href=\"https://github.com/features/actions\" target=\"blank\"\u003e\u003cimg src=\"https://avatars.githubusercontent.com/u/44036562\" height=\"60\" alt=\"GitHub Actions logo\" /\u003e\u003c/a\u003e\n\u003c/p\u003e\n\n# Python FastAPI Hello World\n\n[![CodeQL](https://github.com/smarlhens/python-fastapi-hello-word/workflows/codeql/badge.svg)](https://github.com/smarlhens/python-fastapi-hello-word/actions/workflows/codeql.yml)\n[![GitHub CI](https://github.com/smarlhens/python-fastapi-hello-word/workflows/ci/badge.svg)](https://github.com/smarlhens/python-fastapi-hello-word/actions/workflows/ci.yml)\n[![pre-commit.ci status](https://results.pre-commit.ci/badge/github/smarlhens/python-fastapi-hello-word/main.svg)](https://results.pre-commit.ci/latest/github/smarlhens/python-fastapi-hello-word/main)\n[![GitHub license](https://img.shields.io/github/license/smarlhens/python-fastapi-hello-word)](https://github.com/smarlhens/python-fastapi-hello-word)\n\n---\n\n## Table of Contents\n\n- [Prerequisites](#prerequisites)\n- [Installation](#installation)\n- [What's in the box ?](#whats-in-the-box-)\n- [Testing](#testing)\n- [Docker](#docker)\n\n---\n\n## Prerequisites\n\n- [Python](https://www.python.org/downloads/) **\u003e=3.10 \u003c3.11** (_tested with 3.10.5_)\n- [pre-commit](https://pre-commit.com/#install)\n- [docker](https://docs.docker.com/get-docker/) (_optional_)\n\n---\n\n## Installation\n\n1. Clone the git repository\n\n   ```bash\n   git clone https://github.com/smarlhens/python-fastapi-hello-word.git\n   ```\n\n2. Go into the project directory\n\n   ```bash\n   cd python-fastapi-hello-word/\n   ```\n\n3. Checkout working branch\n\n   ```bash\n   git checkout \u003cbranch\u003e\n   ```\n\n4. Enable pre-commit hooks\n\n   ```bash\n   pre-commit install\n   ```\n\n5. Start FastAPI app\n\n   ```bash\n   uvicorn myservice.main:app --host 0.0.0.0 --proxy-headers --forwarded-allow-ips='*' --port 8000\n   ```\n\n6. Navigate to docs: [http://0.0.0.0:8000/docs](http://0.0.0.0:8000/docs)\n\n---\n\n## What's in the box ?\n\n### Poetry\n\n[Poetry](https://python-poetry.org/) is a tool for dependency management and packaging in Python. It allows you to\ndeclare the libraries your project depends on and it will manage (install/update) them for you.\n\n**pyproject.toml file** ([`pyproject.toml`](pyproject.toml)): orchestrate your project and its dependencies\n**poetry.lock file** ([`poetry.lock`](poetry.lock)): ensure that the package versions are consistent for everyone\nworking on your project\n\nFor more configuration options and details, see the [configuration docs](https://python-poetry.org/docs/).\n\n### pre-commit\n\n[pre-commit](https://pre-commit.com/) is a framework for managing and maintaining multi-language pre-commit hooks.\n\n**.pre-commit-config.yaml file** ([`.pre-commit-config.yaml`](.pre-commit-config.yaml)): describes what repositories and\nhooks are installed\n\nFor more configuration options and details, see the [configuration docs](https://pre-commit.com/).\n\n### flake8\n\n[flake8](https://flake8.pycqa.org/) is a tool for style guide enforcement.\n\nRules are defined in the [`setup.cfg`](setup.cfg).\n\nFor more configuration options and details, see the [configuration docs](https://flake8.pycqa.org/).\n\n### mypy\n\n[mypy](http://mypy-lang.org/) is an optional static type checker for Python that aims to combine the benefits of\ndynamic (or \"duck\") typing and static typing.\n\nRules are defined in the [`pyproject.toml`](pyproject.toml).\n\nFor more configuration options and details, see the [configuration docs](https://mypy.readthedocs.io/).\n\n### isort\n\n[isort](https://pycqa.github.io/isort/) is tool that sort your imports, so you don't have to.\n\nRules are defined in the [`pyproject.toml`](pyproject.toml).\n\nFor more configuration options and details, see the [configuration docs](https://pycqa.github.io/isort/).\n\n### black\n\n[black](https://black.readthedocs.io/) is an uncompromising code formatter.\n\nRules are defined in the [`pyproject.toml`](pyproject.toml).\n\nFor more configuration options and details, see the [configuration docs](https://black.readthedocs.io/).\n\n### bandit\n\n[bandit](https://bandit.readthedocs.io/) is a tool designed to find common security issues in Python code.\n\nRules are defined in the [`pyproject.toml`](pyproject.toml).\n\nFor more configuration options and details, see the [configuration docs](https://bandit.readthedocs.io/).\n\n### docformatter\n\n[docformatter](https://github.com/PyCQA/docformatter) is a tool designed to format docstrings to\nfollow [PEP 257](https://peps.python.org/pep-0257/).\n\nOptions are defined in the [`.pre-commit-config.yaml`](.pre-commit-config.yaml).\n\n---\n\n## Testing\n\nWe are using [pytest](https://docs.pytest.org/) \u0026 [pytest-cov](https://github.com/pytest-dev/pytest-cov) to write tests.\n\nTo run tests:\n\n```bash\npoetry run pytest tests\n```\n\n\u003cdetails\u003e\n\n\u003csummary\u003eOutput\u003c/summary\u003e\n\n```text\ncollected 3 items\n\ntests/test_myservice.py::test_read_root PASSED                                             [ 33%]\ntests/test_myservice.py::test_read_item_with_id_and_query PASSED                           [ 66%]\ntests/test_myservice.py::test_read_item_with_id_without_query PASSED                       [100%]\n```\n\n\u003c/details\u003e\n\nTo run tests with coverage:\n\n```bash\npoetry run pytest tests --cov=src\n```\n\n\u003cdetails\u003e\n\n\u003csummary\u003eOutput\u003c/summary\u003e\n\n```text\ncollected 3 items\n\ntests/test_myservice.py::test_read_root PASSED                                             [ 33%]\ntests/test_myservice.py::test_read_item_with_id_and_query PASSED                           [ 66%]\ntests/test_myservice.py::test_read_item_with_id_without_query PASSED                       [100%]\n\n---------- coverage: platform linux, python 3.10.4-final-0 -----------\nName                        Stmts   Miss  Cover\n-----------------------------------------------\nsrc/myservice/__init__.py       1      0   100%\nsrc/myservice/main.py          15      0   100%\nsrc/myservice/settings.py       8      0   100%\n-----------------------------------------------\nTOTAL                          24      0   100%\n```\n\n\u003c/details\u003e\n\n---\n\n## Docker\n\n### Build\n\nTo build the docker `production` image using [`Dockerfile`](Dockerfile):\n\n```bash\ndocker build . -t my-fastapi-application:latest\n```\n\nTo build the docker `development` image using [`Dockerfile`](Dockerfile):\n\n```bash\ndocker build . --target development -t my-fastapi-application:dev\n```\n\n### Run\n\nTo run the FastAPI production app example using Docker:\n\n```bash\ndocker run -p 8000:8000 -it --rm my-fastapi-application:latest # or :dev for development\n```\n\n### Execute command inside container\n\n```bash\ndocker run -p 8000:8000 -it --rm --entrypoint /bin/bash my-fastapi-application:lastest # or :dev for development\n```\n\n---\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsmarlhens%2Fpython-fastapi-hello-word","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsmarlhens%2Fpython-fastapi-hello-word","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsmarlhens%2Fpython-fastapi-hello-word/lists"}