Skip to main content

A progress tracker with methods for throughput, ETA and update notification.

Latest release 20200520: OverProgress: throughput and eta implementations.

Class BaseProgress

The base class for Progress and OverProcess with various common methods.

Note that durations are in seconds and that absolute time is in seconds since the UNIX epoch (the basis of time.time()).

Class CheckPoint(builtins.tuple)

CheckPoint(time, position)

Class OverProgress(BaseProgress)

A Progress-like class computed from a set of subsidiary Progresses.

Example:

>>> P = OverProgress(name="over")
>>> P1 = Progress(name="progress1", position=12)
>>> P1.total = 100
>>> P1.advance(7)
>>> P2 = Progress(name="progress2", position=20)
>>> P2.total = 50
>>> P2.advance(9)
>>> P.add(P1)
>>> P.add(P2)
>>> P1.total
100
>>> P2.total
50
>>> P.total
150
>>> P1.start
12
>>> P2.start
20
>>> P.start
0
>>> P1.position
19
>>> P2.position
29
>>> P.position
16

Class Progress(BaseProgress)

A progress counter to track task completion with various utility methods.

Example:

>>> P = Progress(name="example")
>>> P                         #doctest: +ELLIPSIS
Progress(name='example',start=0,position=0,start_time=...,throughput_window=None,total=None):[CheckPoint(time=..., position=0)]
>>> P.advance(5)
>>> P                         #doctest: +ELLIPSIS
Progress(name='example',start=0,position=5,start_time=...,throughput_window=None,total=None):[CheckPoint(time=..., position=0), CheckPoint(time=..., position=5)]
>>> P.total = 100
>>> P                         #doctest: +ELLIPSIS
Progress(name='example',start=0,position=5,start_time=...,throughput_window=None,total=100):[CheckPoint(time=..., position=0), CheckPoint(time=..., position=5)]

A Progress instance has an attribute notify_update which is a set of callables. Whenever the position is updated, each of these will be called with the Progress instance and the latest CheckPoint.

Progress objects also make a small pretense of being an integer. The expression int(progress) returns the current position, and += and -= adjust the position.

This is convenient for coding, but importantly it is also useful for discretionary use of a Progress with some other object. If you want to make a lightweight Progress capable class you can set a position attribute to an int and manipulate it carefully using += and -= entirely. If you decide to incur the cost of maintaining a Progress object you can slot it in:

# initial setup with just an int
my_thing.amount = 0

# later, or on some option, use a Progress instance
my_thing.amount = Progress(my_thing.amount)

Method Progress.__init__(self, position=None, name=None, start=None, start_time=None, throughput_window=None, total=None)

Initialise the Progesss object.

Parameters:

  • position: initial position, default 0.
  • name: optional name for this instance.
  • start: starting position of progress range, default from position.
  • start_time: start time of the process, default now.
  • throughput_window: length of throughput time window in seconds, default None.
  • total: expected completion value, default None.

Release Log

Release 20200520: OverProgress: throughput and eta implementations.

Release 20200129.3: Test version machinery again.

Release 20200129.2: set version to '20200129.2'

Release 20200129.1: Dummy release to test new version.

Release 20200129: New Progress.count_of_total_bytes_text property presenting "3kB/40MB" style text.

Release 20190812:

  • New OverProgress class which is a composite of a set of subsidiary Progress instances.
  • Assorted other small updates.

Release 20190220:

  • Progress: be somewhat like an int.
  • New status() method returning a convenient one line progress status report.

Release 20180703.2: Progress: make .total into a property in order to fire the update notifications.

Release 20180703.1: Progress: additions and changes to API: new .ratio, .elapsed_time, rename .projected to .remaining_time.

Release 20180703: Initial release of cs.progress.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cs.progress-20200520.tar.gz (8.1 kB view details)

Uploaded Source

File details

Details for the file cs.progress-20200520.tar.gz.

File metadata

  • Download URL: cs.progress-20200520.tar.gz
  • Upload date:
  • Size: 8.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.7.7

File hashes

Hashes for cs.progress-20200520.tar.gz
Algorithm Hash digest
SHA256 5fb3bf69e5af24a165f2ef666168102574d527d015d6e66454f8f05f86039f0a
MD5 6f5c42cff084be12bb3b3900bdfb3b00
BLAKE2b-256 5a62cfd84e8f15cdb46b3843a75ba583d0ed736f568f03650eb47b8e10868d98

See more details on using hashes here.

Release history Release notifications | RSS feed

20260531

2 files

20250530

2 files

20250528

2 files

20250412

2 files

20250325

2 files

20250306

2 files

20241122

2 files

20240412

2 files

20230401

2 files

20230212

2 files

20221207

2 files

20220918

2 files

20211208

1 file

20210803

1 file

20210730

1 file

20210717

1 file

20210316

1 file

20210306

1 file

20201102.1

1 file

20201102

1 file

20201025

1 file

20200718.3

1 file

20200718.2

1 file

20200718.1

1 file

20200718

1 file

20200716.1

1 file

20200716

1 file

20200627

1 file

20200626

1 file

20200613

1 file

This release

20200520 This release

1 file

20200129.3

1 file

20200129

1 file

20190812

1 file

20190220

1 file

20180703.2

1 file

20180703.1

1 file

20180703

1 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