halo


Namehalo JSON
Version 0.0.31 PyPI version JSON
download
home_pagehttps://github.com/manrajgrover/halo
SummaryBeautiful terminal spinners in Python
upload_time2020-11-10 02:36:48
maintainer
docs_urlNone
authorManraj Singh
requires_python>=3.4
licenseMIT
keywords console loading indicator progress cli spinner spinners terminal term busy wait idle
VCS
bugtrack_url
requirements backports.shutil_get_terminal_size log_symbols spinners termcolor colorama six
Travis-CI
coveralls test coverage
            <h1 align="center">
  <img src="https://raw.githubusercontent.com/manrajgrover/halo/master/art/halo.png" height="50px"/>
  <br>
  halo
</h1>

[![Build Status](https://travis-ci.com/manrajgrover/halo.svg?branch=master)](https://travis-ci.com/manrajgrover/halo) [![Build status](https://ci.appveyor.com/api/projects/status/wa6t414gltr403ff?svg=true)](https://ci.appveyor.com/project/manrajgrover/halo) [![Coverage Status](https://coveralls.io/repos/github/manrajgrover/halo/badge.svg?branch=master)](https://coveralls.io/github/manrajgrover/halo?branch=master)
 [![PyPI](https://img.shields.io/pypi/v/halo.svg)](https://github.com/manrajgrover/halo) ![awesome](https://img.shields.io/badge/awesome-yes-green.svg) [![Downloads](https://pepy.tech/badge/halo)](https://pepy.tech/project/halo) [![Downloads](https://pepy.tech/badge/halo/month)](https://pepy.tech/project/halo/month)
> Beautiful spinners for terminal, IPython and Jupyter

![halo](https://raw.github.com/manrajgrover/halo/master/art/doge_spin.svg?sanitize=true)

## Install

```shell
$ pip install halo
```

## Usage

```py
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:

```py
from halo import Halo

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

Finally, you can use halo as a decorator:

```py
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](https://github.com/sindresorhus/cli-spinners/blob/dac4fc6571059bb9e9bc204711e9dfe8f72e5c6f/spinners.json) file. If a dict is passed, it should define `interval` and `frames`. Something like:

```py
{
    '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](https://raw.github.com/manrajgrover/halo/master/art/persist_spin.svg?sanitize=true)

#### `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](https://github.com/manrajgrover/halo/blob/master/.github/CONTRIBUTING.md) for more information.

## Like it?

🌟 this repo to show support. Let me know you liked it on [Twitter](https://twitter.com/manrajsgrover).
Also, share the [project](https://twitter.com/intent/tweet?url=https%3A%2F%2Fgithub.com%2Fmanrajgrover%2Fhalo&via=manrajsgrover&text=Checkout%20%23halo%20-%20a%20beautiful%20%23terminal%20%23spinners%20library%20for%20%23python&hashtags=github%2C%20pypi).

## Related

* [py-spinners](https://github.com/manrajgrover/py-spinners) - Spinners in Python
* [py-log-symbols](https://github.com/manrajgrover/py-log-symbols) - Log Symbols in Python
* [ora](https://github.com/sindresorhus/ora) - Elegant terminal spinners in JavaScript (inspiration behind this project) 

## License
[MIT](https://github.com/manrajgrover/halo/blob/master/LICENSE) © Manraj Singh



            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/manrajgrover/halo",
    "name": "halo",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.4",
    "maintainer_email": "",
    "keywords": "console,loading,indicator,progress,cli,spinner,spinners,terminal,term,busy,wait,idle",
    "author": "Manraj Singh",
    "author_email": "manrajsinghgrover@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/ee/48/d53580d30b1fabf25d0d1fcc3f5b26d08d2ac75a1890ff6d262f9f027436/halo-0.0.31.tar.gz",
    "platform": "",
    "description": "<h1 align=\"center\">\n  <img src=\"https://raw.githubusercontent.com/manrajgrover/halo/master/art/halo.png\" height=\"50px\"/>\n  <br>\n  halo\n</h1>\n\n[![Build Status](https://travis-ci.com/manrajgrover/halo.svg?branch=master)](https://travis-ci.com/manrajgrover/halo) [![Build status](https://ci.appveyor.com/api/projects/status/wa6t414gltr403ff?svg=true)](https://ci.appveyor.com/project/manrajgrover/halo) [![Coverage Status](https://coveralls.io/repos/github/manrajgrover/halo/badge.svg?branch=master)](https://coveralls.io/github/manrajgrover/halo?branch=master)\n [![PyPI](https://img.shields.io/pypi/v/halo.svg)](https://github.com/manrajgrover/halo) ![awesome](https://img.shields.io/badge/awesome-yes-green.svg) [![Downloads](https://pepy.tech/badge/halo)](https://pepy.tech/project/halo) [![Downloads](https://pepy.tech/badge/halo/month)](https://pepy.tech/project/halo/month)\n> Beautiful spinners for terminal, IPython and Jupyter\n\n![halo](https://raw.github.com/manrajgrover/halo/master/art/doge_spin.svg?sanitize=true)\n\n## Install\n\n```shell\n$ pip install halo\n```\n\n## Usage\n\n```py\nfrom halo import Halo\n\nspinner = Halo(text='Loading', spinner='dots')\nspinner.start()\n\n# Run time consuming work here\n# You can also change properties for spinner as and when you want\n\nspinner.stop()\n```\n\nAlternatively, you can use halo with Python's `with` statement:\n\n```py\nfrom halo import Halo\n\nwith Halo(text='Loading', spinner='dots'):\n    # Run time consuming work here\n```\n\nFinally, you can use halo as a decorator:\n\n```py\nfrom halo import Halo\n\n@Halo(text='Loading', spinner='dots')\ndef long_running_function():\n    # Run time consuming work here\n    pass\n\nlong_running_function()\n```\n\n## API\n\n#### `Halo([text|text_color|spinner|animation|placement|color|interval|stream|enabled])`\n\n##### `text`\n*Type*: `str`\n\nText shown along with spinner.\n\n##### `text_color`\n*Type*: `str`\n*Values*: `grey`, `red`, `green`, `yellow`, `blue`, `magenta`, `cyan`, `white`\n\nColor of the spinner text. Defaults to `None`.\n\n##### `spinner`\n*Type*: `str|dict`\n\nIf string, it should be one of the spinners listed in the given [json](https://github.com/sindresorhus/cli-spinners/blob/dac4fc6571059bb9e9bc204711e9dfe8f72e5c6f/spinners.json) file. If a dict is passed, it should define `interval` and `frames`. Something like:\n\n```py\n{\n    'interval': 100,\n    'frames': ['-', '+', '*', '+', '-']\n}\n```\n\nDefaults to `dots` spinner. For Windows users, it defaults to `line` spinner.\n\n##### `animation`\n*Type*: `str`\n*Values*: `bounce`, `marquee`\n\nAnimation 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.\n\n##### `placement`\n*Type*: `str`\n*Values*: `left`, `right`\n\nWhich side of the text the spinner should be displayed. Defaults to `left`\n\n##### `color`\n*Type*: `str`\n*Values*: `grey`, `red`, `green`, `yellow`, `blue`, `magenta`, `cyan`, `white`\n\nColor of the spinner. Defaults to `cyan`.\n\n##### `interval`\n*Type*: `float`\n\nInterval between each frame. Defaults to spinner interval (recommended).\n\n##### `stream`\n*Type*: `file`\n\nStream to write the output. Defaults to `sys.stdout`.\n\n##### `enabled`\n*Type*: `bool`\n\nEnable or disable the spinner. Defaults to `True`.\n\n### Methods\n\nFollowing are the methods available:\n\n#### `spinner.start([text])`\n\nStarts the spinner. If `text` is passed, it is set as spinner text. Returns the instance.\n\n#### `spinner.stop()`\n\nStops and clears the spinner. Returns the instance.\n\n#### `spinner.clear()`\n\nClears the spinner. Returns the instance.\n\n#### `spinner.render()`\n\nManually renders a new frame. Returns the instance.\n\n#### `spinner.frame()`\n\nReturns next frame to be rendered.\n\n#### `spinner.succeed([text])`\n##### `text`: *Type*: `str`\n\nStops the spinner and changes symbol to `\u2714`. If text is provided, it is persisted else current text is persisted. Returns the instance.\n\n#### `spinner.fail([text])`\n##### `text`: *Type*: `str`\n\nStops the spinner and changes symbol to `\u2716`. If text is provided, it is persisted else current text is persisted. Returns the instance.\n\n#### `spinner.warn([text])`\n##### `text`: *Type*: `str`\n\nStops the spinner and changes symbol to `\u26a0`. If text is provided, it is persisted else current text is persisted. Returns the instance.\n\n#### `spinner.info([text])`\n##### `text`: *Type*: `str`\n\nStops the spinner and changes symbol to `\u2139`. If text is provided, it is persisted else current text is persisted. Returns the instance.\n\n#### `spinner.stop_and_persist([symbol|text])`\nStops the spinner and changes symbol and text. Returns the instance.\n\n##### `symbol`\n*Type*: `str`\n\nSymbol to replace the spinner with. Defaults to `' '`.\n\n##### `text`\n*Type*: `str`\n\nText to be persisted. Defaults to instance text.\n\n![Persist spin](https://raw.github.com/manrajgrover/halo/master/art/persist_spin.svg?sanitize=true)\n\n#### `spinner.text`\nChange the text of spinner.\n\n#### `spinner.color`\nChange the color of spinner\n\n#### `spinner.spinner`\nChange the spinner itself.\n\n#### `spinner.enabled`\nEnable or disable the spinner.\n\n## How to contribute?\n\nPlease see [Contributing guidelines](https://github.com/manrajgrover/halo/blob/master/.github/CONTRIBUTING.md) for more information.\n\n## Like it?\n\n\ud83c\udf1f this repo to show support. Let me know you liked it on [Twitter](https://twitter.com/manrajsgrover).\nAlso, share the [project](https://twitter.com/intent/tweet?url=https%3A%2F%2Fgithub.com%2Fmanrajgrover%2Fhalo&via=manrajsgrover&text=Checkout%20%23halo%20-%20a%20beautiful%20%23terminal%20%23spinners%20library%20for%20%23python&hashtags=github%2C%20pypi).\n\n## Related\n\n* [py-spinners](https://github.com/manrajgrover/py-spinners) - Spinners in Python\n* [py-log-symbols](https://github.com/manrajgrover/py-log-symbols) - Log Symbols in Python\n* [ora](https://github.com/sindresorhus/ora) - Elegant terminal spinners in JavaScript (inspiration behind this project) \n\n## License\n[MIT](https://github.com/manrajgrover/halo/blob/master/LICENSE) \u00a9 Manraj Singh\n\n\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Beautiful terminal spinners in Python",
    "version": "0.0.31",
    "split_keywords": [
        "console",
        "loading",
        "indicator",
        "progress",
        "cli",
        "spinner",
        "spinners",
        "terminal",
        "term",
        "busy",
        "wait",
        "idle"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "md5": "01a17c441bed37ffbd8600f41251a64a",
                "sha256": "5350488fb7d2aa7c31a1344120cee67a872901ce8858f60da7946cef96c208ab"
            },
            "downloads": -1,
            "filename": "halo-0.0.31-py2-none-any.whl",
            "has_sig": false,
            "md5_digest": "01a17c441bed37ffbd8600f41251a64a",
            "packagetype": "bdist_wheel",
            "python_version": "py2",
            "requires_python": ">=3.4",
            "size": 11250,
            "upload_time": "2020-11-10T02:36:46",
            "upload_time_iso_8601": "2020-11-10T02:36:46.291085Z",
            "url": "https://files.pythonhosted.org/packages/86/e3/065611830ffe8c859130eb99336d26045c477cf55162dd92065e9f1c2938/halo-0.0.31-py2-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "md5": "09bd04e94a021eed54c9efbfd8b36891",
                "sha256": "7b67a3521ee91d53b7152d4ee3452811e1d2a6321975137762eb3d70063cc9d6"
            },
            "downloads": -1,
            "filename": "halo-0.0.31.tar.gz",
            "has_sig": false,
            "md5_digest": "09bd04e94a021eed54c9efbfd8b36891",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.4",
            "size": 11666,
            "upload_time": "2020-11-10T02:36:48",
            "upload_time_iso_8601": "2020-11-10T02:36:48.335480Z",
            "url": "https://files.pythonhosted.org/packages/ee/48/d53580d30b1fabf25d0d1fcc3f5b26d08d2ac75a1890ff6d262f9f027436/halo-0.0.31.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2020-11-10 02:36:48",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "github_user": "manrajgrover",
    "github_project": "halo",
    "travis_ci": true,
    "coveralls": true,
    "github_actions": false,
    "appveyor": true,
    "requirements": [
        {
            "name": "backports.shutil_get_terminal_size",
            "specs": [
                [
                    ">=",
                    "1.0.0"
                ]
            ]
        },
        {
            "name": "log_symbols",
            "specs": [
                [
                    ">=",
                    "0.0.14"
                ]
            ]
        },
        {
            "name": "spinners",
            "specs": [
                [
                    ">=",
                    "0.0.24"
                ]
            ]
        },
        {
            "name": "termcolor",
            "specs": [
                [
                    ">=",
                    "1.1.0"
                ]
            ]
        },
        {
            "name": "colorama",
            "specs": [
                [
                    ">=",
                    "0.3.9"
                ]
            ]
        },
        {
            "name": "six",
            "specs": [
                [
                    ">=",
                    "1.12.0"
                ]
            ]
        }
    ],
    "tox": true,
    "lcname": "halo"
}
        
Elapsed time: 0.02573s