Skip to main content

Django Shinobi - Fast Django REST framework

Project description

Fast to learn, fast to code, fast to run

Test Coverage PyPI version Downloads Discord

Django Shinobi - Fast Django REST Framework

Documentation

Django Shinobi is a web framework for building APIs with Django and Python 3.6+ type hints.

It's a fork of the fantastic Django Ninja library focused on community-desired features and fixes. Check out the list of differences if you're coming from Ninja, as well as the roadmap!

Key features:

  • Easy: Designed to be easy to use and intuitive.
  • FAST execution: Very high performance thanks to Pydantic and async support.
  • Fast to code: Type hints and automatic docs lets you focus only on business logic.
  • Standards-based: Based on the open standards for APIs: OpenAPI (previously known as Swagger) and JSON Schema.
  • Django friendly: (obviously) has good integration with the Django core and ORM.
  • Production ready: The original Ninja project is used by multiple companies on live projects.

Django Shinobi REST Framework

Documentation: https://pmdevita.github.io/django-shinobi


Installation

In your Django project, add Django Shinobi.

pip install django-shinobi

or start a new project.

pip install django django-shinobi
django-admin startproject apidemo

Usage

In your Django project, next to urls.py, create a new file called api.py.

from ninja import NinjaAPI

api = NinjaAPI()


@api.get("/add")
def add(request, a: int, b: int):
    return {"result": a + b}

Now go to urls.py and add the following:

...
from .api import api

urlpatterns = [
    path("admin/", admin.site.urls),
    path("api/", api.urls),  # <---------- !
]

That's it !

Now you've just created an API that:

  • receives an HTTP GET request at /api/add
  • takes, validates and type-casts GET parameters a and b
  • decodes the result to JSON
  • generates an OpenAPI schema for defined operation

Interactive API docs

Run your Django project

python manage.py runsever

Now go to http://127.0.0.1:8000/api/docs

You will see the automatic interactive API documentation (provided by Swagger UI or Redoc):

Swagger UI

What next?

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

django_shinobi-1.4.1.tar.gz (3.7 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

django_shinobi-1.4.1-py3-none-any.whl (2.4 MB view details)

Uploaded Python 3

File details

Details for the file django_shinobi-1.4.1.tar.gz.

File metadata

  • Download URL: django_shinobi-1.4.1.tar.gz
  • Upload date:
  • Size: 3.7 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: python-requests/2.31.0

File hashes

Hashes for django_shinobi-1.4.1.tar.gz
Algorithm Hash digest
SHA256 4fde936f08b500cd6535b06067b3303d5d875cb3397f8bb948118517c6a64f2b
MD5 95558fe9622a62b22930de445730cc00
BLAKE2b-256 352a9cf56f16f8ea21fdd29b39deadd95291d04de3c151ad6fef70bb4bf1873e

See more details on using hashes here.

File details

Details for the file django_shinobi-1.4.1-py3-none-any.whl.

File metadata

File hashes

Hashes for django_shinobi-1.4.1-py3-none-any.whl
Algorithm Hash digest
SHA256 b7ed93b155e5eb04a05e1bc1099d1a7b8698405f4b84145c2038c8361531f2a7
MD5 d9850c7cbf0d93eab420be148be2ff47
BLAKE2b-256 6431ff1cebb324a186a9a4844b250965b9224be69b378cc3aa8cb702c7238ab8

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page