Skip to main content

django-tqdm

PyPI-Status PyPI-Versions LICENSE Travis Codecov Codacy Requirements Status

Fast, Extensible Progress Meter (tqdm) For Django.

Use tqdm in django management commands seamlessly. It uses tqdm and it is meant to be used with Django. It provides simple universal commands for Django management command to output text using standard command functions and tqdm.

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')

Demo1

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')

Demo2

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)

Demo3

Metadata

Release files for django-tqdm 0.0.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for django-tqdm 0.0.3
File Size Uploaded Provenance Actions
django_tqdm-0.0.3.tar.gz 4.6 kB Without provenance Details for django_tqdm-0.0.3.tar.gz

Release files / django_tqdm-0.0.3.tar.gz

Download URL django_tqdm-0.0.3.tar.gz
Size 4.6 kB
Tags Source
SHA-256 checksum
How to use checksums
b1fa79ad9ac3d90059ce4891cb6fc5c34559b44620c5e30455e072c55773a1cb
BLAKE2b-256 checksum
How to use checksums
4fc3878cda9f304e9a11a72bb71597ad40a9d2600f98316ab5dcd5a2f6221199
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for django-tqdm 0.0.3

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page