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_createandafter_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
- Authentication and RBAC
- Advanced model relationships
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.
Release files for lazy-ninja 0.7.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| lazy_ninja-0.7.0.tar.gz | 1.1 MB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| lazy_ninja-0.7.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 1.2 MB
Release files / lazy_ninja-0.7.0.tar.gz
| Download URL | lazy_ninja-0.7.0.tar.gz |
|---|---|
| Size | 1.1 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
5ce12845d02370663e568cbd3bd34a63e28044454651853f0747aa8a05c0220c
|
|
BLAKE2b-256 checksum How to use checksums |
bc159e42d1e295629eb2fa12b25946eaae550920891ca5ed36c17d7129238f73
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
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 Apr 16, 2026.
Transparency logRelease files / lazy_ninja-0.7.0-py3-none-any.whl
| Download URL | lazy_ninja-0.7.0-py3-none-any.whl |
|---|---|
| Size | 48.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
aeb6845641eda1fef59e4761817cdbc56d924fd1fb3137698989818fb8804d31
|
|
BLAKE2b-256 checksum How to use checksums |
f04f4855c4550d6d3dfe40c06f9a7df08d81e01126ec32816ff728bb578f53b2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
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 Apr 16, 2026.
Transparency log