Sleekify: A minimalistic, ASGI Python framework for building REST API's.
Project description
Sleekify
Sleekify is a minimalistic, highly-performant, asychronous Python REST API framework. It's been designed with simplicity as the main focus, aiming to provide a straightforward and efficient way to create robust Web API's, drawing inspiration from both Express.js and FastAPI.
Features
- Simple & Expressive: Sleekify is easy to write, with simple expressive syntax.
- Async-first: Built on the asynchronous server methodology, enabling high performance and speed in concurrency.
- Flexible: Supports a wide range of request handling features from simple routes to complex parameter parsing.
- Validated: Uses
typingto ensure your requests are properly validated and sanitised. - Easy Setup: You can get up and running in just a few lines of code!
Installation
Install using:
pip
pip install sleekify
conda
conda create --name my_env python=3.11 -y
conda activate sleekify
pip install sleekify
Quick Start
To get started with Sleekify, you can set up a basic web application with several routes as shown below:
from sleekify import App, Request
from pydantic import BaseModel
app = App()
class Item(BaseModel):
name: str
description: str
price: float
@app.get("/")
async def home():
return {"message": "Welcome to Sleekify!"}
@app.post("/")
async def create_item(request: Request):
data = await request.json()
return {"data": data}
@app.get("/item")
async def get_item(id: int):
return {"message": f"Item: {id}"}
@app.put("/item/{id}")
async def update_item(request: Request, id: int):
data = await request.json()
return {"id": id, "updated_data": data}
@app.delete("/item/{id}")
async def delete_item(id: int):
return {"message": f"Item {id} deleted successfully"}
@app.post("/items")
async def create_item(item: Item):
return {"item": item.model_dump(), "message": "Item created successfully"}
Running Your App
To run your Sleekify application, use an ASGI server such as Uvicorn:
pip install uvicorn
Then, replace module_name with the name of the Python file where your app is defined.
For example: If your app is in the root directory of your project, use: uvicorn app:app --reload --port 8080
uvicorn module_name:app --reload --port 8080
Running Tests
To run the Sleekify internal testing suite that uses pytest-asyncio and httpx, run the following command:
pytest test/__init__.py
Developer Start
pip install -r requirements.txtuvicorn app:app --reload --port 8080curl http://localhost:8080/hellopytest test/__init__.py
Documentation and Support
Documentation is currently being developed to better outline usage.
If you need support, please contact the developer directly: dev@mattjs.me / https://x.com/0mjs_
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file sleekify-0.0.21.tar.gz.
File metadata
- Download URL: sleekify-0.0.21.tar.gz
- Upload date:
- Size: 5.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
60949da6bc5542ee4d1790f64219d613affdb000680b7bbbac9580aca2b3ddf8
|
|
| MD5 |
ef7f0fbffd70c4211318146556ac3b2e
|
|
| BLAKE2b-256 |
9277dfbd16b85904640c071756a31ce4c6e85f1bf41f267aacbc40286c265d03
|
File details
Details for the file sleekify-0.0.21-py3-none-any.whl.
File metadata
- Download URL: sleekify-0.0.21-py3-none-any.whl
- Upload date:
- Size: 7.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
14bb6ca2b457586eac1eb0ab815bf7fe0d03350bd0b1fdb4dd9b0582128b37dd
|
|
| MD5 |
6df61c239a18b637d5091f78414215c3
|
|
| BLAKE2b-256 |
8190fe2190dd62beba3d95ef9566e347f7c48cdcc4467b4e63a45ba63e351ecf
|