Pagify is a Python package that provides a robust and flexible pagination system suitable for both simple and complex applications. Whether you need pagination for raw Python projects or integration into Django or similar frameworks, pagify
delivers straightforward and adaptable solutions.
- Multiple Pagination Types:
- Offset Pagination: Ideal for classic numbered offset and limit scenarios.
- Cursor Pagination: Efficiently handles large datasets by using cursor-based navigation.
- Page Number Pagination: Simple page-based pagination for easy implementation.
- Framework-Agnostic: Can be used in any Python project, from minimal scripts to complex web frameworks.
- Detailed Pagination Info: Includes next, previous, and current page indicators.
- JSON Response Formatting: Consistent output formatting with built-in JSON helpers.
- Customizable and Extensible: Easily extend with custom serializers or formatters.
For detailed guides and examples, please refer to the Complete Documentation.
Here's a quick example of how to use pagify
in your Python application:
from pagify.adapters.paginate import paginate_with_page_number
queryset = [{'id': i} for i in range(1, 101)] # Example dataset
result = paginate_with_page_number(queryset, page=2, page_size=10)
print(result)
We welcome contributions! If you'd like to report issues, suggest new features, or contribute code, feel free to open an issue or submit a pull request.
pagify
is licensed under the MIT License. Check the LICENSE file for more details.