Metadata-Version: 2.4
Name: lazy-ninja
Version: 0.7.0
Summary: Rapidly generate CRUD API endpoints for your Django models with Django Ninja. Includes dynamic schema generation and customizable hooks.
Author: Augusto Domingos
Project-URL: Homepage, https://github.com/AghastyGD/lazy-ninja
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Framework :: Django
Classifier: Framework :: Django :: 4.2
Classifier: Framework :: Django :: 5.0
Classifier: Framework :: Django :: 5.1
Requires-Python: >=3.11
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: django>=4.2
Requires-Dist: django-ninja>=0.22
Requires-Dist: pydantic>=2.0
Requires-Dist: inflect>=7.5
Requires-Dist: colorama>=0.4.6
Requires-Dist: pyjwt>=2.0
Provides-Extra: standard
Requires-Dist: openapi-generator-cli[jdk4py]>=7.14.0; extra == "standard"
Provides-Extra: no-jdk
Requires-Dist: openapi-generator-cli>=7.14.0; extra == "no-jdk"
Dynamic: license-file


# 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`:

```bash
# 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:

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

### uv Quick Setup

```bash
# 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:

```python
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

- [x] Basic CRUD operations  
- [x] Asynchronous support  
- [x] Filtering, sorting, and pagination  
- [X] 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](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](https://lazy-ninja.readthedocs.io).
