Skip to main content

docbrown

docbrown is an empirical progress library. It determines the overall duration and progression of a process by looking at the time it took in the past.

docbrown might be an option for you, if you have one long running task which parts take very different amounts of time. It is also helpful when used in environments where you can’t inform consumers about the progress of a task out-of-band (like a WSGI request/response cycle vs a WebSocket).

Installation

pip install docbrown

This repository allows you to create a deb Package for Debian and derivatives if you’re into that kind of thing. Just run make dist-deb.

Example Usage

Record progress:

import time
from docbrown import record_progress

with record_progress('process_name', ident='my_ident') as record:
    # ident normally is random and unique, but you can override it with
    # your own id. Just make sure it is not used more than once at a time.
    print(record.ident)
    # do some stuff that takes time
    record('loading_data')
    time.sleep(4)
    record('calculating_matrices')
    time.sleep(9)
    record('rendering_structures')
    time.sleep(23)
    record('uploading_models')
    time.sleep(15)

As docbrown determines progression by looking at the past every process needs to run at least once before get_progress can return any meaningful data. This is why get_progress will just return None on the first run of the code above.

Get the progression of our process:

from docbrown import get_progress
print(get_progress('my_ident'))

Future

There are some things that would be nice, but have not been implemented yet.

  • additional storage backends apart from SQLite
  • code path detection that takes optional phases into account and updates the expected duration and progress on-the-fly

Metadata

Release files for docbrown 0.5.0

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

Source distribution (sdist)

Source distribution for docbrown 0.5.0
File Size Uploaded
docbrown-0.5.0.tar.gz 18.6 kB Details

Release files / docbrown-0.5.0.tar.gz

Download URL docbrown-0.5.0.tar.gz
Size 18.6 kB
Tags Source
SHA-256 checksum
How to use checksums
ccb33e2b18c691beba12e150de8b1871c5db82d69ec5dcf126736b14ec194192
BLAKE2b-256 checksum
How to use checksums
1929db60c8f0db56978439bf20cf4eaab4a22afa6393d3cd9f733be4d48d4367
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/2.0.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.2.0 requests-toolbelt/0.9.1 tqdm/4.48.0 CPython/3.8.3

Release history Release notifications | RSS feed

This release

0.5.0 This release

1 release file

0.4.0

1 release file

0.3.0

1 release file

0.2.0

1 release file

0.1.1

1 release file

0.1.0

1 release file

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