Skip to main content

progress-updater

Documentation Status License-MIT GitHub Actions PyPI version

Writing the progress of a task to a backend!

Installation

Install it using pip

pip install progress-updater

Basic usage

from progress_updater import ProgressUpdater
from progress_updater.backends.mongo import MongoSettings

settings = MongoSettings(
    mongo_connection="mongodb://user:pass@mongo:27017",
    mongo_db="db",
    mongo_collection="logs",
)

updater = ProgressUpdater(task_name="My Task", settings=settings)

with updater(block_name="First part"):
    # doing things
    updater.notify("doing first block...")
    # doing more things

with updater(block_name="Second part"):
    # doing things
    updater.notify("doing second block...")
    # doing more things

updater.raise_latest_exception()  # if exists

The output is:

- Task: My task

- Entering First part
  doing first block...
	Time spent: 0h0m
	Successfully completed

- Entering Second part
  doing second block...
	Time spent: 0h0m
	Successfully completed

Backends

The available backends to store logs are Mongo, Redis and SQL. Please read the docs for further information.

Setting your backend with environment variables

You can set your backend by defining env vars. The PU__ prefix indicates that it belongs to ProgressUpdater.

# SQL
PU__SQL_DSN='postgresql+psycopg2://user:pass@postgres:5432/db'
PU__SQL_TABLE='logs'
...

# Redis
PU__REDIS_HOST='redis'
PU__REDIS_DB='1'
PU__REDIS_PASSWORD='pass'
...

# Mongo
PU__MONGO_CONNECTION='mongodb://user:pass@mongo:27017'
PU__MONGO_DB='db'
PU__MONGO_COLLECTION='logs'
...

And then when creating a ProgressUpdater object, the backend will be automatically configured.

from progress_updater import ProgressUpdater

with ProgressUpdater(task_name="My Task") as updater:
    pass

Documentation

Please visit this link for documentation.

Metadata

Release files for progress-updater 0.1.9

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

Source distribution (sdist)

Source distribution for progress-updater 0.1.9
File Size Uploaded
progress_updater-0.1.9.tar.gz 9.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for progress-updater 0.1.9
File Interpreter ABI Platform
progress_updater-0.1.9-py3-none-any.whl Python 3 none any Details

Total release size: 21.4 kB

Release files / progress_updater-0.1.9.tar.gz

Download URL progress_updater-0.1.9.tar.gz
Size 9.1 kB
Tags Source
SHA-256 checksum
How to use checksums
bea3bb989e078defc07085b0d9920d1fbcbf8d53a6904071dbb0db335162fb84
BLAKE2b-256 checksum
How to use checksums
33059b46925c3e7f76885edcadfe285c8a007bcc1fcd17c3f686d4ee7dc4cb53
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.1.13 CPython/3.10.2 Linux/5.10.104-linuxkit

Release files / progress_updater-0.1.9-py3-none-any.whl

Download URL progress_updater-0.1.9-py3-none-any.whl
Size 12.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ee5bdcd4703df0061371f944de80fdf38fc33484aa9087240b689ca7ef910895
BLAKE2b-256 checksum
How to use checksums
b824a7385236bb47608cb21954a8515cbd83be8a4c421e15ead014f5951ef889
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.1.13 CPython/3.10.2 Linux/5.10.104-linuxkit

Release history Release notifications | RSS feed

This release

0.1.9 This release

2 release files

0.1.8

2 release files

0.1.7

2 release files

0.1.6

2 release files

0.1.5

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

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