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.2.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.2-py3-none-any.whl (2.4 MB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: django_shinobi-1.4.2.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.2.tar.gz
Algorithm Hash digest
SHA256 2a6299fc07bcf70e5c462028dc673876b53101d49d7cbf3e30e02274305a22c6
MD5 e08529ca42e4b030f8a35fc152a33c86
BLAKE2b-256 7c9c7d2696117521875d95ab24a4e60408b4508a86f49b76947621cf61a52a2d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for django_shinobi-1.4.2-py3-none-any.whl
Algorithm Hash digest
SHA256 4a5e6a8bbb7bd216d8047402ffbb1610792cc4d9830e1810ee456f6fe6309150
MD5 87143e1b1dfcdd6c083cf6102cecf4c2
BLAKE2b-256 2226e97c89d227069de3f027d95ba7f7726a86e54d23117c193aca0183f2ef5d

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