python-django-rich
Port variant v11
Summary Extensions for using Rich with Django (3.11)
BROKEN
Package version 1.11.0
Homepage No known homepage
Keywords python
Maintainer Python Automaton
License Not yet specified
Other variants v12
Ravenports Buildsheet | History
Ravensource Port Directory | History
Last modified 07 SEP 2024, 17:00:23 UTC
Port created 01 JAN 2023, 17:21:46 UTC
Subpackage Descriptions
single =========== django-rich =========== :alt: pre-commit Extensions for using [Rich] with Django. ---- **Work smarter and faster** with my book [Boost Your Django DX] which covers many ways to improve your development experience. I wrote django-rich whilst working on the book! ---- Requirements ------------ Python 3.8 to 3.12 supported. Django 3.2 to 5.1 supported. Installation ------------ 1. Install with **pip**: .. code-block:: sh python -m pip install django-rich None of django-rich’s features are activated by default. Follow the documentation below to use them. Reference --------- shell command integration ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ django-rich has an extended version of Django’s built-in |shell command|__ that enables `Rich’s pretty-printing `__. To activate this feature, add django_rich to your INSTALLED_APPS setting: .. |shell command| replace:: shell command __ https://docs.djangoproject.com/en/stable/ref/django-admin/#shell .. code-block:: python INSTALLED_APPS = [ ..., "django_rich", ..., ] This feature only affects the Python and bypthon interpreters, not IPython. For IPython support, see [the Rich documentation]. ``django_rich.management.RichCommand`` ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ A subclass of Django’s |BaseCommand|__ class that sets its ``self.console`` to a Rich |Console|__. The Console uses the command’s stdout argument, which defaults to ``sys.stdout``. Colourization is enabled or disabled according to Django’s ``--no-color and --force-color`` flags. .. |BaseCommand| replace:: BaseCommand __ https://docs.djangoproject.com/en/stable/howto/custom-management-commands/#django.core.management.BaseCommand .. |Console| replace:: Console __ https://rich.readthedocs.io/en/stable/console.html Use the features of ``self.console`` as you like: .. code-block:: python from time import sleep from django_rich.management import RichCommand class Command(RichCommand): def handle(self, *args, **options): self.console.print("[bold blue]Frobnicating widgets:[/bold blue]") with self.console.status("Starting...") as status: for i in range(1, 11): status.update(f"Widget {i}...") sleep(1) self.console.log(f"Widget {i} frobnicated.") You can customize the construction of the Console by overriding the make_rich_console class attribute. This should be a callable that returns a Console, such as a |functools.partial|__.
Configuration Switches (platform-specific settings discarded)
PY311 ON Build using Python 3.11 PY312 OFF Build using Python 3.12
Package Dependencies by Type
Build (only) python-pip:single:v11
autoselect-python:single:std
Build and Runtime python311:single:std
Runtime (only) python-Django:single:v11
python-rich:single:v11
Download groups
main mirror://PYPIWHL/f8/49/5c6bd561e7cd82d2036990265a45d5ba8fbbf195e7e0e2d96ac1ffe1241e
Distribution File Information
7e25f97c3b072df96f58bb76bdc0a7c40001315c3644da33a390efc95cd6cbdc 8784 django_rich-1.11.0-py3-none-any.whl
Ports that require python-django-rich:v11
No other ports depend on this one.