auto-fastapi


Nameauto-fastapi JSON
Version 0.1.3 PyPI version JSON
download
home_pagehttps://github.com/Shahaf-F-S/auto-fastapi
SummaryA pythonic functional way to construct FastAPI applications be declaring endpoints in separation of their functional definition, enabeling to separate, replicate, and reuse functions in different APIs at the same time, and also run multiple of them.
upload_time2024-05-07 10:33:23
maintainerNone
docs_urlNone
authorShahaf Frank-Shapir
requires_pythonNone
licenseMIT
keywords
VCS
bugtrack_url
requirements fastapi uvicorn data-place
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # auto-fastapi

> A pythonic functional way to construct FastAPI applications be declaring endpoints in separation of their functional definition, enabeling to separate, replicate, and reuse functions in different APIs at the same time, and also run multiple of them.

## Installation
```
pip install autl-fastapi
```

## example

```python
from fastapi import FastAPI

from auto_fastapi import Method, AutoFastAPI, Builder, Server, Config


def startup() -> None:
    print("startup")


def login(username: str, password: str) -> dict[str, str | dict[str, str]]:
    return {
        "response": "success",
        "request": dict(username=username, password=password)
    }


app = FastAPI()

auto = AutoFastAPI(app)
auto.push((startup, Builder.event("startup")))
auto.push((login, Builder.endpoint("/login", [Method.GET])))

server = Server(Config(app, host="127.0.0.1", port=5555))
server.run()
```

to stop the server
```python
server.exit()
```

to run again
```python
server.run()
```

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/Shahaf-F-S/auto-fastapi",
    "name": "auto-fastapi",
    "maintainer": null,
    "docs_url": null,
    "requires_python": null,
    "maintainer_email": null,
    "keywords": null,
    "author": "Shahaf Frank-Shapir",
    "author_email": "shahaffrs@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/d6/41/87078daeaf784c8d954806c6f1b3ca47036aca2d87e029f30c4722d8f13a/auto-fastapi-0.1.3.tar.gz",
    "platform": null,
    "description": "# auto-fastapi\r\n\r\n> A pythonic functional way to construct FastAPI applications be declaring endpoints in separation of their functional definition, enabeling to separate, replicate, and reuse functions in different APIs at the same time, and also run multiple of them.\r\n\r\n## Installation\r\n```\r\npip install autl-fastapi\r\n```\r\n\r\n## example\r\n\r\n```python\r\nfrom fastapi import FastAPI\r\n\r\nfrom auto_fastapi import Method, AutoFastAPI, Builder, Server, Config\r\n\r\n\r\ndef startup() -> None:\r\n    print(\"startup\")\r\n\r\n\r\ndef login(username: str, password: str) -> dict[str, str | dict[str, str]]:\r\n    return {\r\n        \"response\": \"success\",\r\n        \"request\": dict(username=username, password=password)\r\n    }\r\n\r\n\r\napp = FastAPI()\r\n\r\nauto = AutoFastAPI(app)\r\nauto.push((startup, Builder.event(\"startup\")))\r\nauto.push((login, Builder.endpoint(\"/login\", [Method.GET])))\r\n\r\nserver = Server(Config(app, host=\"127.0.0.1\", port=5555))\r\nserver.run()\r\n```\r\n\r\nto stop the server\r\n```python\r\nserver.exit()\r\n```\r\n\r\nto run again\r\n```python\r\nserver.run()\r\n```\r\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "A pythonic functional way to construct FastAPI applications be declaring endpoints in separation of their functional definition, enabeling to separate, replicate, and reuse functions in different APIs at the same time, and also run multiple of them.",
    "version": "0.1.3",
    "project_urls": {
        "Homepage": "https://github.com/Shahaf-F-S/auto-fastapi"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "d64187078daeaf784c8d954806c6f1b3ca47036aca2d87e029f30c4722d8f13a",
                "md5": "4d4cb4a6ccc87ec7f2bf60aeaabcff49",
                "sha256": "bc4eb85826a42448ead733bd39bccffc220234f35172a8ccb1619cc552642424"
            },
            "downloads": -1,
            "filename": "auto-fastapi-0.1.3.tar.gz",
            "has_sig": false,
            "md5_digest": "4d4cb4a6ccc87ec7f2bf60aeaabcff49",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 10465,
            "upload_time": "2024-05-07T10:33:23",
            "upload_time_iso_8601": "2024-05-07T10:33:23.325546Z",
            "url": "https://files.pythonhosted.org/packages/d6/41/87078daeaf784c8d954806c6f1b3ca47036aca2d87e029f30c4722d8f13a/auto-fastapi-0.1.3.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-05-07 10:33:23",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "Shahaf-F-S",
    "github_project": "auto-fastapi",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "requirements": [
        {
            "name": "fastapi",
            "specs": []
        },
        {
            "name": "uvicorn",
            "specs": []
        },
        {
            "name": "data-place",
            "specs": []
        }
    ],
    "lcname": "auto-fastapi"
}
        
Elapsed time: 0.27560s