Djapy is a Python framework for creating RESTful APIs within Django without boilerplate code, using Python and Pydantic. It offers zero boilerplate, type safety with Pydantic validation, async support, and modern authentication. Features include smart validation, auto documentation with OpenAPI/Swagger, Django-native integration, flexible pagination, customizable error handling, and IDE support. It requires Python 3.10+ and is installable via PyPI.
Build APIs with pure Python without the need for serializers, viewsets, or extra configuration.
Provides full Python type hints with Pydantic validation to ensure data integrity and type checking.
Allows writing high-performance async views using the '@async_djapyfy' decorator for better concurrency.
Offers simple session authentication with customizable mechanisms to enhance security.
Includes built-in request/response validation using Pydantic for robust data validation.
Integrates with OpenAPI/Swagger for automatic documentation generation, including dark mode support.
Seamlessly works with Django's decorators and features, ensuring compatibility and ease of use.
Supports built-in cursor, offset-limit, and page number pagination for efficient data retrieval.
Customizable error handling and validation messages to better manage exceptions.
Provides full IntelliSense and type checking support to improve development efficiency.
Allows you to define views as either synchronous with `@djaqify` or asynchronous with `@async_djaqify`, providing flexibility in API design.
The first argument is always the request object. Additional arguments are extracted from the request. Return type annotations have a specific format `{status_code: SchemaType}` to define response types.
Supports single and tuple return values, allowing you to define different responses including status code and message content.
Automatically validates and serializes return values according to predefined Django schemas. Use models and dictionaries validated against schemas, ensuring strong type checks.
Supports asynchronous operations using `@async_djaqify`, which allows you to await async ORM operations. Provides guidance on converting sync to async queries.
Handles JSON data (application/json) by structuring and validating it using schemas, ensuring robust data input handling.
Processes form data (application/x-www-form-urlencoded) for easy parsing and validation, especially useful for web form submissions.
Enables easy extraction and management of query parameters from URLs, useful for dynamic URL-driven applications.
Utilizes Pydantic models for strong type checking in data validation, providing clear feedback on invalid data inputs.
Generates clear and informative error messages when data validation fails, assisting in debugging and correcting input errors.
Allows basic types to be used in JSON bodies with Pydantic, enabling simplicity in input processing.
Implements Pydantic's powerful string validation constraints for high data integrity and error-proof input processing.
Automatically serializes responses to JSON using the Pydantic model. If the response is valid according to the model, it returns with a 200 status code.
Allows the use of Pydantic's field validator decorator to ensure that the fields of a schema adhere to specified rules.
Allows the definition of computed fields using the @computed_field decorator in a schema, creating fields that are computed from existing model fields.
Provides access to context in the computed field using the context parameter, enabling dynamic computation based on request context.
Accesses the source object in the computed field using the _obj attribute, useful for getting related information from Django model instances.
Enables the configuration of response schema for multiple status codes using the uni_schema function.
Facilitates returning many-to-many relationships or Django querysets using the QueryList type.
Utilizes ImageField type to manage image fields efficiently within schemas.
Supports both async and sync views with similar structure for consistent API handling.