Fast, Extensible Progress Meter (tqdm) For Django.
Use tqdm in Django management commands seamlessly.
It provides simple universal commands for Django management command to output
text using standard command functions and tqdm.
Currently supported versions of Django 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)
Development
Use clean.sh to automatically prettify your code.
Use tox for testing and linting.
Metadata
Release files for django-tqdm 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| django_tqdm-1.0.0.tar.gz | 5.0 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| django_tqdm-1.0.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 13.2 kB
Release files / django_tqdm-1.0.0.tar.gz
| Download URL | django_tqdm-1.0.0.tar.gz |
|---|---|
| Size | 5.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c7fa0aadbe512fb7bff83f1d800094313b044eed9ac0552e1c22da49d84b2121
|
|
BLAKE2b-256 checksum How to use checksums |
a0c1df3b7ea2d01d4fbd449359a7517e27d67015219b8c1580e732b64f3c6f9c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.10.0 pkginfo/1.2.1 requests/2.18.4 setuptools/41.0.1 requests-toolbelt/0.8.0 tqdm/4.19.5 CPython/3.6.7
|
Release files / django_tqdm-1.0.0-py3-none-any.whl
| Download URL | django_tqdm-1.0.0-py3-none-any.whl |
|---|---|
| Size | 8.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
39db30b64f1177e666cfb77e5769e572bbfe6de6bebcd382beaf8a7b4f335401
|
|
BLAKE2b-256 checksum How to use checksums |
6fd9e9d73b18942b4d9bc7492715e052d28f6261e18b8da4ffce1614d649d912
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.10.0 pkginfo/1.2.1 requests/2.18.4 setuptools/41.0.1 requests-toolbelt/0.8.0 tqdm/4.19.5 CPython/3.6.7
|