LightApi


NameLightApi JSON
Version 0.1.0 PyPI version JSON
download
home_pagehttps://github.com/henriqueblobato/LightApi
SummaryA lightweight framework for building API endpoints using Python's native libraries.
upload_time2024-05-28 18:56:05
maintainerNone
docs_urlNone
authoriklobato
requires_python>=3.11
licenseNone
keywords api rest restful endpoint lightweight framework
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            
[![Upload Python Package](https://github.com/henriqueblobato/LightAPI/actions/workflows/python-publish.yml/badge.svg)](https://github.com/henriqueblobato/LightAPI/actions/workflows/python-publish.yml)

# LightApi

## What is LightApi?

LightApi is a lightweight API framework designed for rapid development of RESTful APIs in Python. It provides a simple and intuitive interface for defining endpoints and handling HTTP requests without the need for complex configuration or dependencies.
This project dont use any external library to create the API, it uses the built-in `http.server` to create a minimalistic yet powerful API framework.

## How does it work?

LightApi leverages Python's built-in `http.server` module to create a minimalistic yet powerful API framework. It allows you to define endpoints using familiar Python classes and methods, making it easy to map HTTP requests to Python code.

## Key Features:

- Lightweight and easy to use.
- Minimal dependencies.
- Automatic generation of CRUD endpoints for data models.
- Designed for rapid development and prototyping.

## Why use LightApi?

### Simplicity:

LightApi provides a simple and straightforward API for defining endpoints and handling HTTP requests. You can get started with just a few lines of code, without the need for complex configuration or setup.

### Flexibility:

With LightApi, you have full control over how your API endpoints are defined and how requests are processed. You can easily customize middleware, error handling, and request/response processing to suit your specific requirements.

### Performance:

LightApi is designed to be lightweight and efficient, with minimal overhead. It leverages Python's built-in `http.server` module for request handling, ensuring optimal performance and scalability.

### Rapid Development:

LightApi is perfect for rapid development and prototyping of RESTful APIs. It allows you to quickly define endpoints, test them locally, and iterate on your API design without getting bogged down in unnecessary complexity.

## Caveats:

- LightApi is intended for use in development and prototyping environments only. The built-in `http.server` module used by LightApi is not suitable for production use, as it lacks features such as concurrency, scalability, and security.

## Getting Started:

To get started with LightApi, simply install the package using pip:

```
pip install lightapi
```

Then, define your API endpoints using Python classes and methods, and run your API using the `LightApi` class:

```python
from lightapi import LightApi

# Define your API endpoints here...

app = LightApi()
# Register your endpoints with the app...
app.run()
```

## Example:
Registering a person endpoint:

```python
from dataclasses import dataclass
from typing import Optional
from lightapi import LightApi
from lightapi.handlers import BaseModel

@dataclass
class Person(BaseModel):
    name: str
    age: int
    email: Optional[str] = None
    
app = LightApi()
app.endpoint(Person)
app.run()

```

This will create all REST endpoints:
```http request
GET /person
GET /person/{id}
POST /person
DELETE /person/{id}
PUT /person/{id}
```
with all CRUD operations.

## Contributing:

This project is currently in the early stages of development, and contributions are welcome!
If you find any issues or have suggestions for improvement, please feel free to open an issue or submit a pull request on GitHub. Your contributions are greatly appreciated!

## GOAL
The goal of the project is to develop a python minimal api interface that can be used to create RESTful APIs with minimal effort and dependencies.
This library will install as minimum third party libraries as possible in order to keep it lightweight and easy to use.

## License:

LightApi is licensed under the MIT License. See the [LICENSE](https://github.com/example/lightapi/blob/main/LICENSE) file for details.

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/henriqueblobato/LightApi",
    "name": "LightApi",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.11",
    "maintainer_email": null,
    "keywords": "api, rest, restful, endpoint, lightweight, framework",
    "author": "iklobato",
    "author_email": "iklobato1@gmail.com",
    "download_url": null,
    "platform": null,
    "description": "\n[![Upload Python Package](https://github.com/henriqueblobato/LightAPI/actions/workflows/python-publish.yml/badge.svg)](https://github.com/henriqueblobato/LightAPI/actions/workflows/python-publish.yml)\n\n# LightApi\n\n## What is LightApi?\n\nLightApi is a lightweight API framework designed for rapid development of RESTful APIs in Python. It provides a simple and intuitive interface for defining endpoints and handling HTTP requests without the need for complex configuration or dependencies.\nThis project dont use any external library to create the API, it uses the built-in `http.server` to create a minimalistic yet powerful API framework.\n\n## How does it work?\n\nLightApi leverages Python's built-in `http.server` module to create a minimalistic yet powerful API framework. It allows you to define endpoints using familiar Python classes and methods, making it easy to map HTTP requests to Python code.\n\n## Key Features:\n\n- Lightweight and easy to use.\n- Minimal dependencies.\n- Automatic generation of CRUD endpoints for data models.\n- Designed for rapid development and prototyping.\n\n## Why use LightApi?\n\n### Simplicity:\n\nLightApi provides a simple and straightforward API for defining endpoints and handling HTTP requests. You can get started with just a few lines of code, without the need for complex configuration or setup.\n\n### Flexibility:\n\nWith LightApi, you have full control over how your API endpoints are defined and how requests are processed. You can easily customize middleware, error handling, and request/response processing to suit your specific requirements.\n\n### Performance:\n\nLightApi is designed to be lightweight and efficient, with minimal overhead. It leverages Python's built-in `http.server` module for request handling, ensuring optimal performance and scalability.\n\n### Rapid Development:\n\nLightApi is perfect for rapid development and prototyping of RESTful APIs. It allows you to quickly define endpoints, test them locally, and iterate on your API design without getting bogged down in unnecessary complexity.\n\n## Caveats:\n\n- LightApi is intended for use in development and prototyping environments only. The built-in `http.server` module used by LightApi is not suitable for production use, as it lacks features such as concurrency, scalability, and security.\n\n## Getting Started:\n\nTo get started with LightApi, simply install the package using pip:\n\n```\npip install lightapi\n```\n\nThen, define your API endpoints using Python classes and methods, and run your API using the `LightApi` class:\n\n```python\nfrom lightapi import LightApi\n\n# Define your API endpoints here...\n\napp = LightApi()\n# Register your endpoints with the app...\napp.run()\n```\n\n## Example:\nRegistering a person endpoint:\n\n```python\nfrom dataclasses import dataclass\nfrom typing import Optional\nfrom lightapi import LightApi\nfrom lightapi.handlers import BaseModel\n\n@dataclass\nclass Person(BaseModel):\n    name: str\n    age: int\n    email: Optional[str] = None\n    \napp = LightApi()\napp.endpoint(Person)\napp.run()\n\n```\n\nThis will create all REST endpoints:\n```http request\nGET /person\nGET /person/{id}\nPOST /person\nDELETE /person/{id}\nPUT /person/{id}\n```\nwith all CRUD operations.\n\n## Contributing:\n\nThis project is currently in the early stages of development, and contributions are welcome!\nIf you find any issues or have suggestions for improvement, please feel free to open an issue or submit a pull request on GitHub. Your contributions are greatly appreciated!\n\n## GOAL\nThe goal of the project is to develop a python minimal api interface that can be used to create RESTful APIs with minimal effort and dependencies.\nThis library will install as minimum third party libraries as possible in order to keep it lightweight and easy to use.\n\n## License:\n\nLightApi is licensed under the MIT License. See the [LICENSE](https://github.com/example/lightapi/blob/main/LICENSE) file for details.\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "A lightweight framework for building API endpoints using Python's native libraries.",
    "version": "0.1.0",
    "project_urls": {
        "Homepage": "https://github.com/henriqueblobato/LightApi"
    },
    "split_keywords": [
        "api",
        " rest",
        " restful",
        " endpoint",
        " lightweight",
        " framework"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "f2680659d52926f6e4db18bb57032c2159f76695a3f6c7c15e87192594ddc710",
                "md5": "3f14c929eaae09236e843d3b818143b6",
                "sha256": "776490358c88962ef76bca32254ab38886a4d8250b2fbdf75d2197366d34c209"
            },
            "downloads": -1,
            "filename": "LightApi-0.1.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "3f14c929eaae09236e843d3b818143b6",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.11",
            "size": 6064,
            "upload_time": "2024-05-28T18:56:05",
            "upload_time_iso_8601": "2024-05-28T18:56:05.925094Z",
            "url": "https://files.pythonhosted.org/packages/f2/68/0659d52926f6e4db18bb57032c2159f76695a3f6c7c15e87192594ddc710/LightApi-0.1.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-05-28 18:56:05",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "henriqueblobato",
    "github_project": "LightApi",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "lightapi"
}
        
Elapsed time: 0.33820s