Skip to main content

Lazy Ninja

Lazy Ninja is a Django library that simplifies the generation of API endpoints using Django Ninja. It dynamically scans your Django models and generates Pydantic schemas for listing, retrieving, creating, and updating records. The library also allows you to customize behavior through hook functions (controllers) and schema configurations.

By leveraging Django Ninja, Lazy Ninja provides automatic, interactive API documentation via OpenAPI, making it easy to visualize and interact with your endpoints.


Installation

Install Lazy Ninja with either pip or uv:

# Option 1: pip
pip install lazy-ninja

# Option 2: uv
uv add lazy-ninja

For contributors, the project now uses uv as the default package manager and runner:

git clone https://github.com/AghastyGD/lazy-ninja.git
cd lazy-ninja
uv sync --group dev --all-extras
uv run pytest

uv Quick Setup

# Install uv (one-time)
curl -LsSf https://astral.sh/uv/install.sh | sh

# Create/sync local environment from lockfile
uv sync --group dev --all-extras

# Run commands inside the managed environment
uv run pytest
uv run mkdocs serve -f docs/mkdocs.yml

The repository includes uv.lock to provide deterministic, reproducible environments.


Quick Start

Here’s a simple example of integrating Lazy Ninja into your Django project:

from ninja import NinjaAPI
from lazy_ninja.builder import DynamicAPI 

api = NinjaAPI()
auto_api = DynamicAPI(api)
auto_api.init()

Add api.urls to your urls.py to expose the endpoints.


Features

  • Automatic Endpoints: Instantly generate API routes for your Django models.
  • Dynamic Schema Generation: Automatically create Pydantic schemas for your models.
  • Custom Controllers: Customize route behavior with hooks like before_create and after_update.
  • Built-in Filtering, Sorting, and Pagination: Simplify data handling with query parameters.
  • Interactive Documentation: Swagger UI and ReDoc support out of the box.

Roadmap

  • Basic CRUD operations
  • Asynchronous support
  • Filtering, sorting, and pagination
  • File upload support
  • JWT authentication, including bearer and cookie flows
  • Opt-in role-based authorization for generated CRUD routes (guide)
  • Forward many-to-many and one-to-one relationships (guide)
  • Generated reverse and custom-through relationship workflows

The next release should include authentication security fixes, opt-in CRUD authorization, and forward relationship support. Reverse and custom-through relationship workflows remain future work; no release date is scheduled.


Contributing

Contributions are welcome! Feel free to fork the repository and submit a pull request with any improvements or bug fixes.


License

This project is licensed under the MIT License.
See the LICENSE file for details and full license text.


Learn More

For complete documentation, including advanced usage, configuration options, and examples, visit the Lazy Ninja Documentation.

Metadata

Release files for lazy-ninja 0.8.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for lazy-ninja 0.8.0
File Size Uploaded Provenance Actions
lazy_ninja-0.8.0.tar.gz 1.2 MB With provenance Details for lazy_ninja-0.8.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for lazy-ninja 0.8.0
File Interpreter ABI Platform Actions
lazy_ninja-0.8.0-py3-none-any.whl Python 3 none any Details for lazy_ninja-0.8.0-py3-none-any.whl

Total release size: 1.2 MB

Release files / lazy_ninja-0.8.0.tar.gz

Download URL lazy_ninja-0.8.0.tar.gz
Size 1.2 MB
Tags Source
SHA-256 checksum
How to use checksums
a7e5074afd87188cce6a36761871c2a5c20c37a4792d4cf06a66e6640ae61b02
BLAKE2b-256 checksum
How to use checksums
cf6d77258fc12fc069bbecf7d010a06b673a68f887c5292a20a6935bb5d8ae07
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 1, 2026.

Transparency log

Release files / lazy_ninja-0.8.0-py3-none-any.whl

Download URL lazy_ninja-0.8.0-py3-none-any.whl
Size 51.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
df00788e08df130c631dce295501cd89e40a4e8aecd1ef7258fb666aea99e2fd
BLAKE2b-256 checksum
How to use checksums
557adfc79146aab06bdb942abae83fe8bcc542ca2e20ae4766139d56c4a139e3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 1, 2026.

Transparency log

Security for lazy-ninja 0.8.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for lazy_ninja-0.8.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 1, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page