Nestipy is a Python framework built on top of BlackSheep that follows the modular architecture of NestJS
Project description
Description
Nestipy is a Python framework built on top of FastAPI that follows the modular architecture of NestJS
Under the hood, Nestipy makes use of FastAPI, but also provides compatibility with a wide range of other libraries, like Blacksheep, allowing for easy use of the myriad of third-party plugins which are available.
Getting started
pip install nestipy-cli
nestipy new my_app
cd my_app
nestipy start --dev
├── src
│ ├── __init__.py
├── app_module.py
├── app_controller.py
├── app_service.py
├── main.py
├── cli.py
├── pyproject.yml
├── uv.lock
├── README.md
The main.py file contains an instance of application and bootstrapping it with uvicorn.
import uvicorn
from nestipy.core import NestipyFactory
from app_module import AppModule
app = NestipyFactory.create(AppModule)
if __name__ == '__main__':
uvicorn.run('main:app', reload=True)
Inside module, we got,
from app_command import AppCommand
from app_controller import AppController
from app_service import AppService
from nestipy.common import Module
@Module(
controllers=[AppController],
providers=[AppService, AppCommand]
)
class AppModule: ...
For controller, we got something like
from typing import Annotated
from nestipy.common import Controller, Get, Post, Put, Delete
from nestipy.ioc import Inject, Body, Param
from app_service import AppService
@Controller()
class AppController:
service: Annotated[AppService, Inject()]
@Get()
async def get(self) -> str:
return await self.service.get()
@Post()
async def post(self, data: Annotated[dict, Body()]) -> str:
return await self.service.post(data=data)
@Put("/{app_id}")
async def put(
self, app_id: Annotated[int, Param("app_id")], data: Annotated[dict, Body()]
) -> str:
return await self.service.put(id_=app_id, data=data)
@Delete("/{app_id}")
async def delete(self, app_id: Annotated[int, Param("app_id")]) -> None:
await self.service.delete(id_=app_id)
And, for app_service.py
from nestipy.common import Injectable
@Injectable()
class AppService:
@classmethod
async def get(cls):
return "test"
@classmethod
async def post(cls, data: dict):
return "test"
@classmethod
async def put(cls, id_: int, data: dict):
return "test"
@classmethod
async def delete(cls, id_: int):
return "test"
Documentation
View full documentation from here.
Support
Nestipy is an MIT-licensed open source project. It can grow thanks to the sponsors and support from the amazing backers. If you'd like to join them, please [read more here].
Stay in touch
- Author - Tsiresy Mila
License
Nestipy is MIT licensed.
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 nestipy-0.8.0.tar.gz.
File metadata
- Download URL: nestipy-0.8.0.tar.gz
- Upload date:
- Size: 4.8 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.7.21
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cd7a60679d4aa6c0d3f9dde8168317b260ec50758a07f5d36b5481235f549332
|
|
| MD5 |
616fdfec41fdc242a0a783b29b0e91d7
|
|
| BLAKE2b-256 |
6c26eb4c7dbb10b5f441ac65e671f2394f4d84b3d26cf904b066c47f0b15b586
|
File details
Details for the file nestipy-0.8.0-py3-none-any.whl.
File metadata
- Download URL: nestipy-0.8.0-py3-none-any.whl
- Upload date:
- Size: 4.9 MB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.7.21
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b36f49d4034ce790db4bf7d6048a0bbdbd4a697bac7aa2e4c6b8637bab41760d
|
|
| MD5 |
4d15601fae7d3343cbb25cd2d2c874fd
|
|
| BLAKE2b-256 |
fdd5445ed570bb1799ac57badbd00fb094cc0626682e3dec2693838915e22af0
|