{"id":15044037,"url":"https://github.com/xnuinside/lof","last_synced_at":"2025-10-23T20:30:18.234Z","repository":{"id":46796237,"uuid":"387241804","full_name":"xnuinside/lof","owner":"xnuinside","description":"AWS Lambdas on FastAPI for local run \u0026 test (based on AWS Code Deploy template)","archived":false,"fork":false,"pushed_at":"2021-10-08T12:58:24.000Z","size":110,"stargazers_count":7,"open_issues_count":0,"forks_count":2,"subscribers_count":3,"default_branch":"main","last_synced_at":"2024-09-27T09:43:16.612Z","etag":null,"topics":["aws","aws-lambda","fastapi","sam","testing","testing-tools","webserver"],"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/xnuinside.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.txt","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-07-18T18:18:02.000Z","updated_at":"2023-05-12T12:10:30.000Z","dependencies_parsed_at":"2022-08-25T12:52:20.350Z","dependency_job_id":null,"html_url":"https://github.com/xnuinside/lof","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xnuinside%2Flof","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xnuinside%2Flof/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xnuinside%2Flof/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xnuinside%2Flof/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/xnuinside","download_url":"https://codeload.github.com/xnuinside/lof/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":219867932,"owners_count":16555811,"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":["aws","aws-lambda","fastapi","sam","testing","testing-tools","webserver"],"created_at":"2024-09-24T20:49:59.259Z","updated_at":"2025-10-23T20:30:17.837Z","avatar_url":"https://github.com/xnuinside.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"## AWS Lambdas on FastAPI - LoF\n![badge1](https://img.shields.io/pypi/v/lof) ![badge2](https://img.shields.io/pypi/l/lof) ![badge3](https://img.shields.io/pypi/pyversions/lof)![workflow](https://github.com/xnuinside/lof/actions/workflows/main.yml/badge.svg)\n\nAWS Lambdas on FastAPI (LoF) is a command line tool that helps you fast \u0026 easy up \u0026 run your Python AWS Lambdas for tests and local development. \n\nPay attention, that this is only for **Python lambdas**.\n\nIt does not support any other programming languages.\n\n## How does it work?\n\n### Install\n\n```bash\n\n    pip install lof\n\n```\n\nNow run lof \u0026 provide to it path to your template yaml/json file.\nOr you can run it from source dir with template.yaml (/.json) without any args\n\n### How to use\n\n```bash\n\n    lof\n\n    # or if path custom\n\n    lof --template example/template.yaml\n\n```\n\nYou can choose that lambdas exclude from run by passing their names:\n\n```bash\n\n    lof --template example/template.yaml --exclude=PostLambda2Function\n\n```\n\n\nTo pass environment variables to Lambdas, use flag --env, you can pass variables in 2 formats - json format and '.env' format. Both files as examples presented in example/ folder\n\n```bash\n\n    lof --env=.env\n\n    # or \n    \n    lof --env=vars.json\n\n```\n\n### Autorizer Lambda\n\nTo emulate behaviour of Authorizer lambda use flag --proxy-lambdas, where - LambdaAuthorizer must be changed to your lambda name from cloud formation template. Request will got through this proxy lambdas and only if everything ok it will call target lambda.\n\nSame as in API GAteway - all return values from proxy lambdas will update \"requestContext\" key in the event.\n\n```bash\n\n    lof --proxy-lambdas=LambdaAuthorizer\n\n    # or \n    \n    lof --proxy-lambdas=LambdaAuthorizer,CORS # if you need to or more proxy lambdas\n\n```\n\n## Other settings\n\n```text\n\n    Usage: lof [OPTIONS]\n\n    Options:\n  --template TEXT                 Path to AWS Code Deploy template with\n                                  lambdas  [default: template.yaml]\n\n  --env TEXT                      Path to file with environment variables\n  --exclude TEXT                  Exclude lambdas.FastAPI will not up \u0026 run\n                                  them. Pass as string with comma. Example:\n                                  PostTrafficHook,PretrafficHook.  [default: ]\n\n  --port INTEGER                  Port to run lof  [default: 8000]\n  --host TEXT                     Host to run lof  [default: 0.0.0.0]\n  --proxy-lambdas TEXT            Lambdas Names that must be used as Handlers\n                                  for request. For example, Authorizer Lambda\n                                  or CORS Lambds. Each time when you send\n                                  request to some lambda - it will go through\n                                  those lambdas and populate 'requestContext'\n                                  in the event  [default: ]\n\n  --workers INTEGER               Count of unicorn workers to run.If you want\n                                  run more when 1 worker LoF will generate\n                                  temp FastAPI server code for your lambdas.\n                                  [default: 1]\n\n  --debug / --no-debug            Debug flag for Uvicorn  [default: True]\n  --reload / --no-reload          Reload flag for Uvicorn  [default: False]\n  --help                          Show this message and exit.\n\n```\n\nThis mean, that lof will up \u0026 run all lambdas exclude this 2: PostTrafficHook \u0026 Roles\n\n## Demo\n\nwill be added soon\n\n\n## Example\nTo try how LoF works you can use AWS CloudFormation template.yaml \u0026 Lambdas from example/ folder.\n\n\n## Issues \u0026 features request\n\nFill free to open Issues \u0026 report bugs. I will solve them as soon as possible. If you have any sugesstions or feature request - also fell free to open the issue.\n\n## Problem Context\n\nOn my current project I works a lot with AWS Lambdas \u0026 tries to up \u0026 run them with SAM local. \nAnd there is some issues especially when you work on the project with a big count of lambdas.\n\nSome of them:\n\n1) First of all it does not allow skip some lambdas form config\n2) It build lambdas inside each docker container so it takes significant time to build/rebuild \u0026 up all containers (and you need up all containers if you want to have fast integration tests)\n\nBoth points in the mix make impossible to use SAM in weak developers envs like VDI, for example.\n\n\n## Changelog\n**v0.5.5**\n1. One more fix autorizer response population in event context\n\n**v0.5.4**\n1. Fix autorizer response population in event context\n\n**v0.5.3**\n1. Fixed bunch of issues relative to missed pathParams in event \u0026 wrong authorizer context providing\n\n**v0.5.2**\n1. Bug fixies.\n\n**v0.5.0**\n1. Added AWS Context object. Part of values filed right now with mock values, values from config will be added in next versions.\n\n**v0.4.1**\nFeatures:\n1. Added option --proxy-lambdas where you can pass a list of lambdas that will be used as middleware request handlers. \nFor example, as Authorization Lambda or CORS lambda.\n\nBased on order in that you provided lambdas names in --proxy-lambdas option request will be send through them and populates same as on aws in \"requestContext\" field of the event.\nFor example, if you use --proxy-lambdas=CORS,Authorizer this mean request first of all will go to CORS lambda and if all ok (no raise errors) will got to Authorizer lambda and when to target lambda (endpoint that you call).\n\nFixes:\n1. Paths with symbols '-.' now does not cause issue during running with 1 and more worker.\n\n**v0.3.0**\n1. Added Possimility to run multiple workers with flag --workers. \nThis helpful if you need speed up your local server or some lambdas need to call another lambdas directly.\n2. Added flag --reload to cli if you want auto reload server when code changed (uvicor --reload)\n3. Added support for Cloud Formation templates in JSON\n\n\n**v0.2.3**\n1. Possibility to send port \u0026 host to start several instances in same time.\n\n\n**v0.2.2**\n1. README.md is updated\n2. Fixed Issue with lambdas in template, that does not have Events with Path (like S3 triggered lambdas)\n3. Fixed issue with status code 204 - now it returns correct answer with no failes.\n4. Added some tests\n\n**v0.2.1**\n1. Now LoF do not try/except lambdas errors\n\n**v0.2.0**\n1. Fixed status_code resend from lambda \u0026 JSON body response\n\n**v0.1.0**\n1. First version of Lambdas on FastApi. \nBased on AWS CloudFormation template it's serve lambdas as FastAPI endpoints for local testing.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxnuinside%2Flof","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fxnuinside%2Flof","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxnuinside%2Flof/lists"}