Fast, Extensible Progress Meter (tqdm) For Django
Project description
Fast, Extensible Progress Meter (tqdm) For Django.
It provides simple universal commands for Django management command to output
text using standard command functions and tqdm.
Only currently supported versions of Django and Python are supported.
Usage
from django_tqdm import BaseCommand
from time import sleep
class Command(BaseCommand):
def handle(self, *args, **options):
# Output directly
self.error("Error")
self.info("Info")
# Output through tqdm
t = self.tqdm(total=50)
for x in range(50):
sleep(0.03)
t.update(1)
if x == 10:
t.info("X = 10")
if x == 20:
t.error("X = 20")
Advanced:
info(text, ending="\n", fatal=False)
error(text, ending="\n", fatal=False)
write(text, ending="\n", fatal=False, error=False)
If you set fatal to True it will terminate the command after printing the message.
For documentation on tqdm see tqdm.
Comparison
In django-tqdm:
self.info("info")
self.error("error")
In vanilla Django:
self.stdout.write("info")
self.stderr.write("error")
Demos
Demo 1 - Simple usage
self.info("info")
self.error("error")
Demo 2 - tqdm usage
t = self.tqdm(total=50)
for x in range(50):
sleep(0.02)
t.update(1)
if x == 10:
t.info("info")
if x == 40:
t.error("error")
Demo 3 - Vanilla tqdm with default settings for comparison
t = tqdm(total=50)
for x in range(50):
sleep(0.02)
t.update(1)
if x == 25:
t.write("info")
if x == 40:
t.write("error", file=sys.stderr)
Developer documentation
Read developer documentation.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
No source distribution files available for this release.See tutorial on generating distribution archives.
Built Distribution
File details
Details for the file django_tqdm-1.3.1-py3-none-any.whl
.
File metadata
- Download URL: django_tqdm-1.3.1-py3-none-any.whl
- Upload date:
- Size: 6.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.8.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 571a68d50050667d6b8e0c1f284542d372801a0ac3e3e9f817f1b854e043c3f4 |
|
MD5 | 0bd9f77a8409519eff32eb05f1befde8 |
|
BLAKE2b-256 | a9ef84d90cc6b5c328475398fbf312c601902445218e02010ad912d48d365227 |