{"id":21743306,"url":"https://github.com/answerdotai/fastprogress","last_synced_at":"2025-12-29T05:33:10.705Z","repository":{"id":33073868,"uuid":"145069949","full_name":"AnswerDotAI/fastprogress","owner":"AnswerDotAI","description":"Simple and flexible progress bar for Jupyter Notebook and console","archived":false,"fork":false,"pushed_at":"2024-08-20T15:56:03.000Z","size":13061,"stargazers_count":1100,"open_issues_count":22,"forks_count":104,"subscribers_count":21,"default_branch":"master","last_synced_at":"2025-11-12T01:39:02.340Z","etag":null,"topics":["developer-tools","jupyter-notebook","plots","python"],"latest_commit_sha":null,"homepage":"","language":"Jupyter Notebook","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/AnswerDotAI.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE-OF-CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-08-17T04:01:23.000Z","updated_at":"2025-09-15T03:17:58.000Z","dependencies_parsed_at":"2024-11-15T04:49:05.990Z","dependency_job_id":"4e9844ed-0094-4f12-b417-378a46073a21","html_url":"https://github.com/AnswerDotAI/fastprogress","commit_stats":{"total_commits":188,"total_committers":25,"mean_commits":7.52,"dds":0.7180851063829787,"last_synced_commit":"3264b4da7edd7b0061b0ace0d44e8fabc29652f3"},"previous_names":["answerdotai/fastprogress","fastai/fastprogress"],"tags_count":21,"template":false,"template_full_name":null,"purl":"pkg:github/AnswerDotAI/fastprogress","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AnswerDotAI%2Ffastprogress","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AnswerDotAI%2Ffastprogress/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AnswerDotAI%2Ffastprogress/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AnswerDotAI%2Ffastprogress/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/AnswerDotAI","download_url":"https://codeload.github.com/AnswerDotAI/fastprogress/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AnswerDotAI%2Ffastprogress/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":284725595,"owners_count":27053255,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-11-16T02:00:05.974Z","response_time":65,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["developer-tools","jupyter-notebook","plots","python"],"created_at":"2024-11-26T07:04:04.845Z","updated_at":"2025-12-29T05:33:10.698Z","avatar_url":"https://github.com/AnswerDotAI.png","language":"Jupyter Notebook","readme":"# fastprogress\n\nA fast and simple progress bar for Jupyter Notebook and console.\n\n\u003cimg src=\"https://github.com/fastai/fastprogress/raw/master/images/cifar_train.gif\" width=\"600\"\u003e\n\n## Install\n\nTo install simply use\n```\npip install fastprogress\n```\n\n## Usage\n\n### Example 1\n\nHere is a simple example. Each bar takes an iterator as a main argument, and we can specify the second bar is nested with the first by adding the argument `parent=mb`. We can then:\n- add a comment in the first bar by changing the value of `mb.main_bar.comment`\n- add a comment in the second bar by changing the value of `mb.child.comment`\n- write a line between the two bars with `mb.write('message')`\n\n``` python\nfrom fastprogress.fastprogress import *\nfrom time import sleep\n\nfor i in (mb:=master_bar(range(10))):\n    for j in mb.progress(range(100)):\n        sleep(0.01)\n        mb.child.comment = f'second bar stat'\n    mb.main_bar.comment = f'first bar stat'\n    mb.write(f'Finished loop {i}.')\n```\n\n\u003cimg src=\"https://github.com/fastai/fastprogress/raw/master/images/pb_basic.gif\" width=\"600\"\u003e\n\n### Example 2\n\nTo add a graph that get plots as the training goes, just use the command `mb.update_graphs`. It will create the figure on its first use. Arguments are:\n- `graphs`: a list of graphs to be plotted (each of the form `[x,y]`)\n- `x_bounds`: the min and max values of the x axis (if `None`, it will those given by the graphs)\n- `y_bounds`: the min and max values of the y axis (if `None`, it will those given by the graphs)\n\nNote that it's best to specify `x_bounds` and `y_bounds`, otherwise the box will change as the loop progresses.\n\nAdditionally, we can give the label of each graph via the command `mb.names` (should have as many elements as the graphs argument).\n\n``` python\nimport numpy as np\nfor i in mb:=master_bar(range(10), names=['cos', 'sin']):\n    for j in mb.progress(range(100)):\n        if j%10 == 0:\n            k = 100 * i + j\n            x = np.arange(0, 2*k*np.pi/1000, 0.01)\n            y1, y2 = np.cos(x), np.sin(x)\n            graphs = [[x,y1], [x,y2]]\n            x_bounds = [0, 2*np.pi]\n            y_bounds = [-1,1]\n            mb.update_graph(graphs, x_bounds, y_bounds)\n            mb.child.comment = f'second bar stat'\n    mb.main_bar.comment = f'first bar stat'\n    mb.write(f'Finished loop {i}.')\n```\n\n\u003cimg src=\"https://github.com/fastai/fastprogress/raw/master/images/pb_cos.gif\" width=\"600\"\u003e\n\nHere is the rendering in console:\n\n\u003cimg src=\"https://github.com/fastai/fastprogress/raw/master/images/pb_console.gif\" width=\"800\"\u003e\n\nIf the script using this is executed with a redirect to a file, only the results of the `.write` method will be printed in that file.\n\n### Example 3\n\nHere is an example that a typical machine learning training loop can use. It also demonstrates how to set `y_bounds` dynamically.\n\n```\ndef plot_loss_update(epoch, epochs, mb, train_loss, valid_loss):\n    \"\"\" dynamically print the loss plot during the training/validation loop.\n        expects epoch to start from 1.\n    \"\"\"\n    x = range(1, epoch+1)\n    y = np.concatenate((train_loss, valid_loss))\n    graphs = [[x,train_loss], [x,valid_loss]]\n    x_margin = 0.2\n    y_margin = 0.05\n    x_bounds = [1-x_margin, epochs+x_margin]\n    y_bounds = [np.min(y)-y_margin, np.max(y)+y_margin]\n\n    mb.update_graph(graphs, x_bounds, y_bounds)\n```\n\nAnd here is an emulation of a training loop that uses this function:\n\n```\nimport random\n\nepochs = 5\ntrain_loss, valid_loss = [], []\nfor epoch in (mb:=master_bar(range(1, epochs+1))):\n    # emulate train sub-loop\n    for batch in progress_bar(range(2), parent=mb): sleep(0.2)\n    train_loss.append(0.5 - 0.06 * epoch + random.uniform(0, 0.04))\n\n    # emulate validation sub-loop\n    for batch in progress_bar(range(2), parent=mb): sleep(0.2)\n    valid_loss.append(0.5 - 0.03 * epoch + random.uniform(0, 0.04))\n\n    plot_loss_update(epoch, epochs, mb, train_loss, valid_loss)\n```\n\nAnd the output:\n\n\u003cimg src=\"https://github.com/fastai/fastprogress/raw/master/images/pb_graph.gif\" alt=\"Output\"\u003e\n\n----\n\nCopyright 2017 onwards, fast.ai.\n\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fanswerdotai%2Ffastprogress","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fanswerdotai%2Ffastprogress","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fanswerdotai%2Ffastprogress/lists"}