warp-fastapi


Namewarp-fastapi JSON
Version 0.1.1a1 PyPI version JSON
download
home_pagehttps://github.com/frenki123/warp_fastapi
SummaryCreate fastapi in a warp speed
upload_time2023-10-20 20:13:36
maintainer
docs_urlNone
authorfrenki123
requires_python>=3.11,<4.0
licenseMIT
keywords fastapi code-generation sqlalchemy
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Warp FastApi Documentation

## Introduction

Warp-FastApi is a versatile Python library that serves as your navigational beacon through the intricate cosmos of FastAPI development. The library's core feature is the generation of well-structured, efficient code tailored to FastAPI, SQLAlchemy, and Pydantic. This means you can focus on crafting your application's unique logic, secure in the knowledge that the foundational code is expertly generated. Begin your FastAPI project with Warp-FastApi, where exploration and efficiency converge.

## Installation

Begin your journey by installing Warp-FastApi using pip:

```bash
pip install warp-fastapi
```

## Getting Started

Prepare for liftoff into the Warp-FastApi universe by following these simple steps:

### **Beam Up Your Crew:** 

Assemble the core components of Warp-FastApi.

```
from warp_fastapi import AppObject, AppProject, ProjectCreator
from warp_fastapi.attributes import StringAttribute, IntAttribute, NameAttribute
from warp_fastapi.app_object import BasicUser
```

### **Warp-Define Attributes:**
```
# Engage attributes
a1 = StringAttribute("planet_name")
a2 = IntAttribute("distance")
ship_name = StringAttribute("ship_name")
```
Define attributes with the precision of a star cartographer – each attribute corresponds to a specific celestial aspect. For more attribute types, refer to the SQL Types and Types documentation.

### **Launch Your App Spaceships:**
```
# Launch app spaceships
planet = AppObject("planet", a1, a2)
starship = AppObject("starship", ship_name)
```
Initiate AppObjects, the very vessels of your application – give them designations, program their functional cores (attributes), and propel them into the coding cosmos!

You can also establish an AppObject with attributes directly:
```
alien = AppObject(
    "alien",
    NameAttribute(),
    StringAttribute("species"),
    StringAttribute("status", optional=True),
)
gadget = AppObject("gadget", 
                   StringAttribute("name"))
```
And don't forget to pack the optional "status" attribute for those unpredictable extraterrestrial encounters.

### **Navigate the Star Systems – Add Starship Relations:**
```
planet.add_one_to_many_rel(starship, "inhabited_by", "planet")
starship.add_one_to_many_rel(alien, "crew", "starship")
```
Much like celestial systems gravitate towards one another, your app objects require meaningful connections. Forge these connections by signaling the objects, inputting coordinates, and assigning distinctive identifiers.

The function to add realtionship follows this structure:
```
main_obj.add_<side_of_main_obj>_to_<side_of_related_object>_rel(
    related_object, name_of_rel_in_main_obj, name_of_rel_in_related_object)
```
Potential relationship types encompass:

- one_to_one: A one-to-one relationship, present in both the main and related objects.
- one_to_many: A one-to-many relationship, with the main object as one and the related object as many. This configures the main object to hold a list of related objects. The foreign key is situated in the related object (typically the "many" side).
- many_to_one: The reverse of one_to_many, resulting in the main object as many and the related object as one. The related object is equipped with a list of main objects.
- many_to_many: A mutual relationship where both objects feature lists of the other. This intricate linkage is managed through an association table in SQLAlchemy.

### **Secure your mission:** 
```
mission = AppObject("mission", NameAttribute(), StringAttribute("desc"), secure=True)
user = BasicUser()
```
With secure=True we assign that this resource can only be accessed with authorized user. BasicUser ensures that we have simple user for authorization (user with username and password).

### **Commence Warp Drive:** 
```
# Set coordinates – AppObjects ready for warp
project = AppProject(
    "galactic_app", planet, starship, alien, gadget, mission, auth_object=user
)

# Engage the ProjectCreator, the command bridge of coding
creator = ProjectCreator(project, project_dir=".")
creator.create_project()
```

### **Explore New Discovery:**

In your shell go to the folder where your code was generated (folder "galactic_app" inside your curent working folder). You need to run startup script which will create virutal enviroment, install requirments, refactor code with black and ruff, run pytest and mypy check, create initial database migration with alembic and run your app.

Run the startup script from bash command line (use gitbash or linuxbash).

```bash
source startup.sh
```

You can go on and open your project at [http://127.0.0.1:8000/docs](http://127.0.0.1:8000/docs). Also check input in your shell to see coverage of the tests and passing of the mypy lint test.

## Conclusion

Warp-FastApi: Embark on a voyage of FastAPI exploration, akin to the most exhilarating space odysseys. Bid farewell to repetitive code warp cores and allow Warp-FastApi to be your steadfast warp drive. Set your course now and let your code traverse new frontiers!
            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/frenki123/warp_fastapi",
    "name": "warp-fastapi",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.11,<4.0",
    "maintainer_email": "",
    "keywords": "fastapi,code-generation,SQLAlchemy",
    "author": "frenki123",
    "author_email": "marko.frankola@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/12/4e/05b03bdf3cb1022f0addd9374a40698b20ebbd6f18a9f1e71461a8d851d3/warp_fastapi-0.1.1a1.tar.gz",
    "platform": null,
    "description": "# Warp FastApi Documentation\n\n## Introduction\n\nWarp-FastApi is a versatile Python library that serves as your navigational beacon through the intricate cosmos of FastAPI development. The library's core feature is the generation of well-structured, efficient code tailored to FastAPI, SQLAlchemy, and Pydantic. This means you can focus on crafting your application's unique logic, secure in the knowledge that the foundational code is expertly generated. Begin your FastAPI project with Warp-FastApi, where exploration and efficiency converge.\n\n## Installation\n\nBegin your journey by installing Warp-FastApi using pip:\n\n```bash\npip install warp-fastapi\n```\n\n## Getting Started\n\nPrepare for liftoff into the Warp-FastApi universe by following these simple steps:\n\n### **Beam Up Your Crew:** \n\nAssemble the core components of Warp-FastApi.\n\n```\nfrom warp_fastapi import AppObject, AppProject, ProjectCreator\nfrom warp_fastapi.attributes import StringAttribute, IntAttribute, NameAttribute\nfrom warp_fastapi.app_object import BasicUser\n```\n\n### **Warp-Define Attributes:**\n```\n# Engage attributes\na1 = StringAttribute(\"planet_name\")\na2 = IntAttribute(\"distance\")\nship_name = StringAttribute(\"ship_name\")\n```\nDefine attributes with the precision of a star cartographer \u2013 each attribute corresponds to a specific celestial aspect. For more attribute types, refer to the SQL Types and Types documentation.\n\n### **Launch Your App Spaceships:**\n```\n# Launch app spaceships\nplanet = AppObject(\"planet\", a1, a2)\nstarship = AppObject(\"starship\", ship_name)\n```\nInitiate AppObjects, the very vessels of your application \u2013 give them designations, program their functional cores (attributes), and propel them into the coding cosmos!\n\nYou can also establish an AppObject with attributes directly:\n```\nalien = AppObject(\n    \"alien\",\n    NameAttribute(),\n    StringAttribute(\"species\"),\n    StringAttribute(\"status\", optional=True),\n)\ngadget = AppObject(\"gadget\", \n                   StringAttribute(\"name\"))\n```\nAnd don't forget to pack the optional \"status\" attribute for those unpredictable extraterrestrial encounters.\n\n### **Navigate the Star Systems \u2013 Add Starship Relations:**\n```\nplanet.add_one_to_many_rel(starship, \"inhabited_by\", \"planet\")\nstarship.add_one_to_many_rel(alien, \"crew\", \"starship\")\n```\nMuch like celestial systems gravitate towards one another, your app objects require meaningful connections. Forge these connections by signaling the objects, inputting coordinates, and assigning distinctive identifiers.\n\nThe function to add realtionship follows this structure:\n```\nmain_obj.add_<side_of_main_obj>_to_<side_of_related_object>_rel(\n    related_object, name_of_rel_in_main_obj, name_of_rel_in_related_object)\n```\nPotential relationship types encompass:\n\n- one_to_one: A one-to-one relationship, present in both the main and related objects.\n- one_to_many: A one-to-many relationship, with the main object as one and the related object as many. This configures the main object to hold a list of related objects. The foreign key is situated in the related object (typically the \"many\" side).\n- many_to_one: The reverse of one_to_many, resulting in the main object as many and the related object as one. The related object is equipped with a list of main objects.\n- many_to_many: A mutual relationship where both objects feature lists of the other. This intricate linkage is managed through an association table in SQLAlchemy.\n\n### **Secure your mission:** \n```\nmission = AppObject(\"mission\", NameAttribute(), StringAttribute(\"desc\"), secure=True)\nuser = BasicUser()\n```\nWith secure=True we assign that this resource can only be accessed with authorized user. BasicUser ensures that we have simple user for authorization (user with username and password).\n\n### **Commence Warp Drive:** \n```\n# Set coordinates \u2013 AppObjects ready for warp\nproject = AppProject(\n    \"galactic_app\", planet, starship, alien, gadget, mission, auth_object=user\n)\n\n# Engage the ProjectCreator, the command bridge of coding\ncreator = ProjectCreator(project, project_dir=\".\")\ncreator.create_project()\n```\n\n### **Explore New Discovery:**\n\nIn your shell go to the folder where your code was generated (folder \"galactic_app\" inside your curent working folder). You need to run startup script which will create virutal enviroment, install requirments, refactor code with black and ruff, run pytest and mypy check, create initial database migration with alembic and run your app.\n\nRun the startup script from bash command line (use gitbash or linuxbash).\n\n```bash\nsource startup.sh\n```\n\nYou can go on and open your project at [http://127.0.0.1:8000/docs](http://127.0.0.1:8000/docs). Also check input in your shell to see coverage of the tests and passing of the mypy lint test.\n\n## Conclusion\n\nWarp-FastApi: Embark on a voyage of FastAPI exploration, akin to the most exhilarating space odysseys. Bid farewell to repetitive code warp cores and allow Warp-FastApi to be your steadfast warp drive. Set your course now and let your code traverse new frontiers!",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Create fastapi in a warp speed",
    "version": "0.1.1a1",
    "project_urls": {
        "Documentation": "https://frenki123.github.io/warp_fastapi",
        "Homepage": "https://github.com/frenki123/warp_fastapi",
        "Repository": "https://github.com/frenki123/warp_fastapi"
    },
    "split_keywords": [
        "fastapi",
        "code-generation",
        "sqlalchemy"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "6502dfca92d85fb2d70a9107aeed6c1e2673461d6f7802c981be95a15479c539",
                "md5": "0b58ccc688356df8dbff6313794d2a84",
                "sha256": "9ca34a577f9db1f28b050b4ce2e65bf1f3b3b9dec1a1713489df79c8601c6c11"
            },
            "downloads": -1,
            "filename": "warp_fastapi-0.1.1a1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "0b58ccc688356df8dbff6313794d2a84",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.11,<4.0",
            "size": 41907,
            "upload_time": "2023-10-20T20:13:34",
            "upload_time_iso_8601": "2023-10-20T20:13:34.903979Z",
            "url": "https://files.pythonhosted.org/packages/65/02/dfca92d85fb2d70a9107aeed6c1e2673461d6f7802c981be95a15479c539/warp_fastapi-0.1.1a1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "124e05b03bdf3cb1022f0addd9374a40698b20ebbd6f18a9f1e71461a8d851d3",
                "md5": "52951b91e7353e211ae93c4c722416dc",
                "sha256": "7afb71add233756c49dbb23d5161ffe6fa8923c1d79d9887a2732bc99ed0cf1f"
            },
            "downloads": -1,
            "filename": "warp_fastapi-0.1.1a1.tar.gz",
            "has_sig": false,
            "md5_digest": "52951b91e7353e211ae93c4c722416dc",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.11,<4.0",
            "size": 33754,
            "upload_time": "2023-10-20T20:13:36",
            "upload_time_iso_8601": "2023-10-20T20:13:36.316236Z",
            "url": "https://files.pythonhosted.org/packages/12/4e/05b03bdf3cb1022f0addd9374a40698b20ebbd6f18a9f1e71461a8d851d3/warp_fastapi-0.1.1a1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-10-20 20:13:36",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "frenki123",
    "github_project": "warp_fastapi",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "warp-fastapi"
}
        
Elapsed time: 0.13465s