MIT License

项目介绍

manrajgrover/halo 是一个托管在 GitHub 上的开源项目,主要使用 Python 编写,采用 MIT License 许可证,目前获得 3.0k 个 Star、152 次 Fork。

仓库全名
manrajgrover/halo
开源许可证
MIT License
Star 数
3.0k
Fork 数
152
未关闭 Issue
56

README 摘要

halo Beautiful spinners for terminal, IPython and Jupyter Install Usage Alternatively, you can use halo with Python's with statement: Finally, you can use halo as a decorator: API Halo([text|textcolor|spinner|animation|placement|color|interval|stream|enabled]) text Type: str Text shown along with spinner. textcolor Type: str Values: grey, red, green, yellow, blue, magenta, cyan, white Color of the spinner text…

完整内容见 GitHub 原始 README 或本页 。

常见问题

halo 用什么语言开发?

主要使用 Python 编写,采用 MIT License 许可证,目前有 3.0k 个 Star。

halo 可以免费商用吗?

仓库采用 MIT License 许可证,可免费使用与修改,商业使用请遵守许可证条款(例如保留版权声明与许可声明)。

如何获取 halo 的源码?

可以直接克隆仓库:git clone https://github.com/manrajgrover/halo.git,默认分支为 master;安装与运行步骤见仓库 README。

halo 最近还在维护吗?

仓库最近一次更新为 2024年6月16日,当前有 56 个未关闭 Issue;Star 数为 3.0k,可作为社区活跃度的参考。

关于

GitHub 原始描述(英文)

💫 Beautiful spinners for terminal, IPython and Jupyter

描述取自 GitHub 官方 API,保持仓库作者书写的原文。

简要分析

热度分
3350
价值分
1859
活跃状态
活跃

语言占比

Python

README


halo

Build Status Build status Coverage Status PyPI awesome Downloads Downloads

Beautiful spinners for terminal, IPython and Jupyter

halo

Install

$ pip install halo

Usage

from halo import Halo

spinner = Halo(text='Loading', spinner='dots')
spinner.start()

# Run time consuming work here
# You can also change properties for spinner as and when you want

spinner.stop()

Alternatively, you can use halo with Python’s with statement:

from halo import Halo

with Halo(text='Loading', spinner='dots'):
    # Run time consuming work here

Finally, you can use halo as a decorator:

from halo import Halo

@Halo(text='Loading', spinner='dots')
def long_running_function():
    # Run time consuming work here
    pass

long_running_function()

API

Halo([text|text_color|spinner|animation|placement|color|interval|stream|enabled])
text

Type: str

Text shown along with spinner.

text_color

Type: str Values: grey, red, green, yellow, blue, magenta, cyan, white

Color of the spinner text. Defaults to None.

spinner

Type: str|dict

If string, it should be one of the spinners listed in the given json file. If a dict is passed, it should define interval and frames. Something like:

{
    'interval': 100,
    'frames': ['-', '+', '*', '+', '-']
}

Defaults to dots spinner. For Windows users, it defaults to line spinner.

animation

Type: str Values: bounce, marquee

Animation to apply to the text if it’s too large and doesn’t fit in the terminal. If no animation is defined, the text will be ellipsed.

placement

Type: str Values: left, right

Which side of the text the spinner should be displayed. Defaults to left

color

Type: str Values: grey, red, green, yellow, blue, magenta, cyan, white

Color of the spinner. Defaults to cyan.

interval

Type: float

Interval between each frame. Defaults to spinner interval (recommended).

stream

Type: file

Stream to write the output. Defaults to sys.stdout.

enabled

Type: bool

Enable or disable the spinner. Defaults to True.

Methods

Following are the methods available:

spinner.start([text])

Starts the spinner. If text is passed, it is set as spinner text. Returns the instance.

spinner.stop()

Stops and clears the spinner. Returns the instance.

spinner.clear()

Clears the spinner. Returns the instance.

spinner.render()

Manually renders a new frame. Returns the instance.

spinner.frame()

Returns next frame to be rendered.

spinner.succeed([text])
text: Type: str

Stops the spinner and changes symbol to ✔. If text is provided, it is persisted else current text is persisted. Returns the instance.

spinner.fail([text])
text: Type: str

Stops the spinner and changes symbol to ✖. If text is provided, it is persisted else current text is persisted. Returns the instance.

spinner.warn([text])
text: Type: str

Stops the spinner and changes symbol to ⚠. If text is provided, it is persisted else current text is persisted. Returns the instance.

spinner.info([text])
text: Type: str

Stops the spinner and changes symbol to ℹ. If text is provided, it is persisted else current text is persisted. Returns the instance.

spinner.stop_and_persist([symbol|text])

Stops the spinner and changes symbol and text. Returns the instance.

symbol

Type: str

Symbol to replace the spinner with. Defaults to ' '.

text

Type: str

Text to be persisted. Defaults to instance text.

Persist spin

spinner.text

Change the text of spinner.

spinner.color

Change the color of spinner

spinner.spinner

Change the spinner itself.

spinner.enabled

Enable or disable the spinner.

How to contribute?

Please see Contributing guidelines for more information.

Like it?

🌟 this repo to show support. Let me know you liked it on Twitter. Also, share the project.

  • py-spinners - Spinners in Python
  • py-log-symbols - Log Symbols in Python
  • ora - Elegant terminal spinners in JavaScript (inspiration behind this project)

License

MIT © Manraj Singh

评论

暂无评论