rsalmei/alive-progress 源码下载与部署教程

项目概述

A new kind of Progress Bar, with real-time throughput, ETA, and very cool animations!

项目地址

https://github.com/rsalmei/alive-progress

项目页面预览

rsalmei/alive-progress preview

关键指标

  • Stars:6216
  • 主要语言:Python
  • License:MIT License
  • 最近更新:2025-10-10T00:39:31Z
  • 默认分支:main

本站高速下载(国内可用)

点击下载(本站镜像)
– SHA256:682d434e5ad967869fd2288fdccc57f575baa0d4762cc3cf810a1fd6e641e1bc

安装部署要点(README 精选)

Configuration

There are several options to customize both appearance and behavior!

All of them can be set both directly in the alive_bar or globally in the config_handler!

These are the options – default values in brackets:

  • title: an optional, always visible bar title
  • length: [40] the number of cols to render the animated progress bar
  • max_cols: [80] the maximum cols to use if not possible to fetch it, like in jupyter
  • spinner: the spinner style to be rendered next to the bar

    ↳ accepts a predefined spinner name, a custom spinner factory, or None
  • bar: the bar style to be rendered in known modes

    ↳ accepts a predefined bar name, a custom bar factory, or None
  • unknown: the bar style to be rendered in the unknown mode

    ↳ accepts a predefined spinner name, or a custom spinner factory (cannot be None)
  • theme: ['smooth'] a set of matching spinner, bar, and unknown

    ↳ accepts a predefined theme name
  • force_tty: [None] forces animations to be on, off, or according to the tty (more details here)

    ↳ None -> auto select, according to the terminal/Jupyter

    ↳ True -> unconditionally enables animations, but still auto-detects Jupyter Notebooks

    ↳ False -> unconditionally disables animations, keeping only the final receipt
  • file: [sys.stdout] the file object to use: sys.stdout, sys.stderr, or a similar TextIOWrapper
  • disable: [False] if True, completely disables all output, do not install hooks
  • manual: [False] set to manually control the bar position
  • enrich_print: [True] enriches print() and logging messages with the bar position
  • enrich_offset: [0] the offset to apply to enrich_print
  • receipt: [True] prints the nice final receipt, disables if False
  • receipt_text: [False] set to repeat the last text message in the final receipt
  • monitor (bool|str): [True] configures the monitor widget 152/200 [76%]

    ↳ send a string with {count}, {total} and {percent} to customize it
  • elapsed (bool|str): [True] configures the elapsed time widget in 12s

    ↳ send a string with {elapsed} to customize it
  • stats (bool|str): [True] configures the stats widget (123.4/s, eta: 12s)

    ↳ send a string with {rate} and {eta} to customize it
  • monitor_end (bool|str): [True] configures the monitor widget within final receipt

    ↳ same as monitor, the default format is dynamic, it inherits monitor‘s one
  • elapsed_end (bool|str): [True] configures the elapsed time widget within final receipt

    ↳ same as elapsed, the default format is dynamic, it inherits elapsed‘s one
  • stats_end (bool|str): [True] configures the stats widget within final receipt

    ↳ send a string with {rate} to customize it (no relation to stats)
  • title_length: [0] fixes the length of titles, or 0 for unlimited

    ↳ title will be truncated if longer, and a cool ellipsis “…” will appear at the end
  • spinner_length: [0] forces the spinner length, or 0 for its natural one
  • refresh_secs: [0] forces the refresh period to this, 0 is the reactive visual feedback
  • ctrl_c: [True] if False, disables CTRL+C (captures it)
  • dual_line: [False] if True, places the text below the bar
  • unit: any text that labels your entities
  • scale: the scaling to apply to units: None, SI, IEC, or SI2

    ↳ supports aliases: False or '' -> None, True -> SI, 10 or '10' -> SI, 2 or '2' -> IEC
  • precision: [1] how many decimals do display when scaling

And there’s also one that can only be set locally in the alive_bar context:

  • calibrate: maximum theoretical throughput to calibrate the animation speed (more details here)

To set them locally, just send them as keyword arguments to alive_bar:

with alive_bar(total, title='Processing', length=20, bar='halloween') as bar:
    ...

To use them globally, send them to config_handler, and any alive_bar created after that will include those options! And you can mix and match them, local options always have precedence over global ones:

from alive_progress import config_handler

config_handler.set_global(length=20, spinner='wait')

with alive_bar(total, bar='blocks', spinner='twirls') as bar:
    # the length is 20, the bar is 'blocks' and the spinner is 'twirls'.
    ...

常用命令(从 README 提取)

on 7: fail "H", retry later
on 10: fail "K", retry later
Alphabet |███████████████████████████▊            | ▃▅▇ 18/26 [69%] in 6s (3.2/s, eta: 3s)
-> Teaching the letter: S, please wait...

Download |██████████████████⚠︎                     | (!) 45/100 [45%] in 4.8s (9.43/s)

Download 0 |████████▊⚠︎                              | (!) 22/100 [22%] in 0.6s (36.40/s)
Download 1 |████████████████▊⚠︎                      | (!) 42/100 [42%] in 1.0s (41.43/s)
Download 2 |██████▍⚠︎                                | (!) 16/100 [16%] in 0.4s (39.29/s)
Download 3 |█████▋⚠︎                                 | (!) 14/100 [14%] in 0.4s (33.68/s)
Download 4 |█████████████▎⚠︎                         | (!) 33/100 [33%] in 0.8s (39.48/s)
Download 5 |███████▎⚠︎                               | (!) 18/100 [18%] in 0.5s (37.69/s)
Download 6 |█████▎⚠︎                                 | (!) 13/100 [13%] in 0.3s (37.28/s)
Download 7 |████████████⚠︎                           | (!) 30/100 [30%] in 0.8s (38.43/s)
Download 8 |██████⚠︎                                 | (!) 15/100 [15%] in 0.4s (36.26/s)
...

通用部署说明

  1. 下载源码并阅读 README
  2. 安装依赖(pip/npm/yarn 等)
  3. 配置环境变量(API Key、模型路径、数据库等)
  4. 启动服务并测试访问
  5. 上线建议:Nginx 反代 + HTTPS + 进程守护(systemd / pm2)

免责声明与版权说明

本文仅做开源项目整理与教程索引,源码版权归原作者所有,请遵循对应 License 合规使用。

© 版权声明
THE END
喜欢就支持一下吧
点赞15 分享
评论 抢沙发

请登录后发表评论

    暂无评论内容