{"id":13565932,"url":"https://github.com/amcat/progressmonitor","last_synced_at":"2026-01-14T09:52:21.444Z","repository":{"id":57454992,"uuid":"76167619","full_name":"amcat/progressmonitor","owner":"amcat","description":"Python classes for tracking (sub)task progress (inspired by Eclipse ProgressMonitor, but more pythonic)","archived":false,"fork":false,"pushed_at":"2016-12-11T21:59:39.000Z","size":12,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-09-29T03:11:03.850Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/amcat.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-12-11T10:30:05.000Z","updated_at":"2022-12-09T11:02:05.000Z","dependencies_parsed_at":"2022-09-04T10:11:17.844Z","dependency_job_id":null,"html_url":"https://github.com/amcat/progressmonitor","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/amcat/progressmonitor","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/amcat%2Fprogressmonitor","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/amcat%2Fprogressmonitor/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/amcat%2Fprogressmonitor/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/amcat%2Fprogressmonitor/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/amcat","download_url":"https://codeload.github.com/amcat/progressmonitor/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/amcat%2Fprogressmonitor/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28416120,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-14T08:38:59.149Z","status":"ssl_error","status_checked_at":"2026-01-14T08:38:43.588Z","response_time":107,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-01T13:01:58.155Z","updated_at":"2026-01-14T09:52:21.427Z","avatar_url":"https://github.com/amcat.png","language":"Python","funding_links":[],"categories":["Python"],"sub_categories":[],"readme":"# Progress Monitor\n\nPython classes for tracking (sub)task progress (inspired by Eclipse ProgressMonitor, but more pythonic)\n\n## Installation\n\nInstall directly from pypi:\n\n```{sh}\npip install progressmonitor\n```\n\n## Usage\n\n(See also [example.py](example.py))\n\n### Initialization and task updates\n\nA monitor keeps track of progress in units specified by the task.\nA progress monitor is initialized with .begin(), which sets the total amount of work to be done.\nCalls to update() (and optionally, done()) increment the amount of work done\n\nNote that task name and total work is set on .begin(), not on construction, because normally\nthe task will receive a monitor from the code calling it.  \n\n```{py}\nm = ProgressMonitor()\nm.begin(\"task name\", total_units[, message])\nm.update(units[, message])\n[m.done()]\n```\n\n### Adding listeners\n\nYou can query progress and message directly with m.progress and m.message,\nbut in many cases you want to add a listener, which is called with the monitor as argument for every update.\nA listener that outputs to the python logging facility is included:\n\n```{py}\nfrom progressmonitor import log_listener\nm.add_listener(log_listener(mylog, logging.DEBUG))\n```\n\n### Submonitors\n\nIn most cases, a task will call various other tasks as part of its work.\nThese subtasks can report progress to the monitor.\nSince the task and subtasks don't know how much total work the other has, two pieces of information are given:\nThe weight (amount of units) of the subtask for the main task and the total amount of units in the subtask.\nThe first is given on creating the sub monitor (in the main task), the second on calling .begin (in the subtask):\n\n```{py}\n# in the main task:\nm = ProgressMonitor()\nm.begin(100)\nsm = m.submonitor(50)  # this submonitor will count for 50 out of the main monitor's 100 units\n\n# in the subtask:\nsm.begin(10, \"subtask name\")  # this submonitor has 10 units of work in total\nsm.update(1)  # this will count as 1/10 * 50 = 5 out of 100 units of the main task monitor\nsm.done()     # this will 'update' the remainig units of m's work, i.e. main progress will now be 50%\n```\n### Context Managers and Decorators\n\nTo reduce the boilerplate in working with progress monitors, two context managers and a decorator are provided:\n\n```{py}\n@monitored(100)\ndef supertask(monitor):\n    ...\n    with monitor.submonitor(50) as sm:\n        subtask(sm)\n\n@monitored(10, name=\"My first subtask\")\ndef subtask(monitor):\n    monitor.update(5)  # this will update 5/10 * 50/100 = 25% of supertask's work\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Famcat%2Fprogressmonitor","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Famcat%2Fprogressmonitor","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Famcat%2Fprogressmonitor/lists"}