consolio


Nameconsolio JSON
Version 0.1.15 PyPI version JSON
download
home_pageNone
SummaryA simple terminal I/O utility with spinner animation
upload_time2025-10-08 22:35:40
maintainerNone
docs_urlNone
authorNone
requires_python>=3.9
licenseMIT License Copyright (c) 2024 Ioannis D. (devcoons) Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
keywords consolio terminal color
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Consolio

[![PyPI - Version](https://img.shields.io/pypi/v/consolio?style=for-the-badge)](https://pypi.org/project/consolio)
![PyPI - Python Version](https://img.shields.io/pypi/pyversions/consolio?style=for-the-badge)
![GitHub License](https://img.shields.io/github/license/devcoons/consolio?style=for-the-badge)
![PyPI - Wheel](https://img.shields.io/pypi/wheel/consolio?style=for-the-badge&color=%23F0F)

`Consolio` is a lightweight, dependency-free Python library that provides an elegant way to display progress updates, warnings, errors, and other status messages in the console with color-coded indicators, spinners, and progress bars.

Perfect for CLI tools that need clean, structured feedback without complex dependencies.

---

## Installation

Consolio has **no external dependencies** and works out of the box.

```bash
pip install consolio
```

If you’re using it directly from source (e.g., cloned repository), add the `src/` folder to your `PYTHONPATH` or `sys.path`:

```python
import sys, os
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), 'src')))
from consolio import Consolio
```

---

## Features

- βœ… Color-coded messages for info, warning, error, success, and more.  
- πŸ” Built-in progress **spinners** (`dots`, `braille`, `default`).  
- πŸ“ˆ Context-managed **progress bars**.  
- 🧩 Thread-safe and clean terminal rendering (no output corruption).  
- βš™οΈ Works gracefully in both **TTY** and **non-TTY** (plain/CI) modes.  
- πŸ”„ Indentation helpers (`increase_indent`, `decrease_indent`, etc.) for hierarchical output.  

---

## Basic Usage

```python
from consolio import Consolio

console = Consolio(spinner_type='dots')

console.print("inf", "Starting process")
console.print("wip", "Loading configuration...")
console.print("wrn", "Warning: Low memory detected")
console.print("err", "Error: Invalid input detected")
console.print("cmp", "All done!")
```

---

## Indentation Control

You can now manage indentation dynamically without passing it every time.

```python
console.increase_indent()
console.print("wip", "Setting up environment...")

console.increase_indent()
console.print("inf", "Fetching dependencies...")

console.decrease_indent()
console.print("cmp", "Setup complete.")
```

Explicit indentation still works:

```python
console.print(2, "inf", "Manual indentation works too.")
```

---

## Spinners

Use the spinner as a **context manager**:

```python
import time

with console.spinner("Working hard...", inline=True):
    time.sleep(2)

console.print("cmp", "Task complete!")
```

Or manually start and stop it:

```python
console.start_animate()
time.sleep(3)
console.stop_animate()
```

---

## Progress Bars

```python
import time

with console.progress(initial_percentage=0) as update:
    for i in range(0, 101, 20):
        time.sleep(0.3)
        update(i)

console.print("cmp", "Progress complete!")
```

---

## Input Handling

```python
user = console.input("qst", "Enter your name:")
console.print("cmp", f"Hello, {user}!")
```

---

##  Customization

| Option | Description | Example |
|---------|-------------|----------|
| `spinner_type` | Type of spinner (`dots`, `braille`, `default`) | `Consolio(spinner_type='braille')` |
| `no_colors` | Disable ANSI colors | `Consolio(no_colors=True)` |
| `no_animation` | Disable spinners/progress bars | `Consolio(no_animation=True)` |
| `replace=True` | Overwrite previous message line | `console.print("inf", "Updating...", replace=True)` |
| `plain()` | Force plain output (no color/animation) | `console.plain()` |
| `rich()` | Re-enable color/animation if supported | `console.rich()` |


## Example Structure

Example scripts are located in the [`examples/`](examples/) folder:
- `example_basic_usage.py` β€” Interactive demo with spinner and progress bar.  
- `example_plain_mode.py` β€” CI-friendly non-interactive demo.

Run them directly:

```bash
python examples/example_basic_usage.py
```


## License

This project is licensed under the **MIT License** β€” see the [LICENSE](LICENSE) file for details.

---

Made with ❀️ by [devcoons](https://github.com/devcoons)

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "consolio",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.9",
    "maintainer_email": null,
    "keywords": "consolio, terminal, color",
    "author": null,
    "author_email": "\"Ioannis D (devcoons)\" <support@devcoons.com>",
    "download_url": "https://files.pythonhosted.org/packages/20/38/2605162816a9172fe7f46dba9fd17916978913834406f1844b3e9c5ea8ba/consolio-0.1.15.tar.gz",
    "platform": null,
    "description": "# Consolio\n\n[![PyPI - Version](https://img.shields.io/pypi/v/consolio?style=for-the-badge)](https://pypi.org/project/consolio)\n![PyPI - Python Version](https://img.shields.io/pypi/pyversions/consolio?style=for-the-badge)\n![GitHub License](https://img.shields.io/github/license/devcoons/consolio?style=for-the-badge)\n![PyPI - Wheel](https://img.shields.io/pypi/wheel/consolio?style=for-the-badge&color=%23F0F)\n\n`Consolio` is a lightweight, dependency-free Python library that provides an elegant way to display progress updates, warnings, errors, and other status messages in the console with color-coded indicators, spinners, and progress bars.\n\nPerfect for CLI tools that need clean, structured feedback without complex dependencies.\n\n---\n\n## Installation\n\nConsolio has **no external dependencies** and works out of the box.\n\n```bash\npip install consolio\n```\n\nIf you\u2019re using it directly from source (e.g., cloned repository), add the `src/` folder to your `PYTHONPATH` or `sys.path`:\n\n```python\nimport sys, os\nsys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), 'src')))\nfrom consolio import Consolio\n```\n\n---\n\n## Features\n\n- \u2705 Color-coded messages for info, warning, error, success, and more.  \n- \ud83d\udd01 Built-in progress **spinners** (`dots`, `braille`, `default`).  \n- \ud83d\udcc8 Context-managed **progress bars**.  \n- \ud83e\udde9 Thread-safe and clean terminal rendering (no output corruption).  \n- \u2699\ufe0f Works gracefully in both **TTY** and **non-TTY** (plain/CI) modes.  \n- \ud83d\udd04 Indentation helpers (`increase_indent`, `decrease_indent`, etc.) for hierarchical output.  \n\n---\n\n## Basic Usage\n\n```python\nfrom consolio import Consolio\n\nconsole = Consolio(spinner_type='dots')\n\nconsole.print(\"inf\", \"Starting process\")\nconsole.print(\"wip\", \"Loading configuration...\")\nconsole.print(\"wrn\", \"Warning: Low memory detected\")\nconsole.print(\"err\", \"Error: Invalid input detected\")\nconsole.print(\"cmp\", \"All done!\")\n```\n\n---\n\n## Indentation Control\n\nYou can now manage indentation dynamically without passing it every time.\n\n```python\nconsole.increase_indent()\nconsole.print(\"wip\", \"Setting up environment...\")\n\nconsole.increase_indent()\nconsole.print(\"inf\", \"Fetching dependencies...\")\n\nconsole.decrease_indent()\nconsole.print(\"cmp\", \"Setup complete.\")\n```\n\nExplicit indentation still works:\n\n```python\nconsole.print(2, \"inf\", \"Manual indentation works too.\")\n```\n\n---\n\n## Spinners\n\nUse the spinner as a **context manager**:\n\n```python\nimport time\n\nwith console.spinner(\"Working hard...\", inline=True):\n    time.sleep(2)\n\nconsole.print(\"cmp\", \"Task complete!\")\n```\n\nOr manually start and stop it:\n\n```python\nconsole.start_animate()\ntime.sleep(3)\nconsole.stop_animate()\n```\n\n---\n\n## Progress Bars\n\n```python\nimport time\n\nwith console.progress(initial_percentage=0) as update:\n    for i in range(0, 101, 20):\n        time.sleep(0.3)\n        update(i)\n\nconsole.print(\"cmp\", \"Progress complete!\")\n```\n\n---\n\n## Input Handling\n\n```python\nuser = console.input(\"qst\", \"Enter your name:\")\nconsole.print(\"cmp\", f\"Hello, {user}!\")\n```\n\n---\n\n##  Customization\n\n| Option | Description | Example |\n|---------|-------------|----------|\n| `spinner_type` | Type of spinner (`dots`, `braille`, `default`) | `Consolio(spinner_type='braille')` |\n| `no_colors` | Disable ANSI colors | `Consolio(no_colors=True)` |\n| `no_animation` | Disable spinners/progress bars | `Consolio(no_animation=True)` |\n| `replace=True` | Overwrite previous message line | `console.print(\"inf\", \"Updating...\", replace=True)` |\n| `plain()` | Force plain output (no color/animation) | `console.plain()` |\n| `rich()` | Re-enable color/animation if supported | `console.rich()` |\n\n\n## Example Structure\n\nExample scripts are located in the [`examples/`](examples/) folder:\n- `example_basic_usage.py` \u2014 Interactive demo with spinner and progress bar.  \n- `example_plain_mode.py` \u2014 CI-friendly non-interactive demo.\n\nRun them directly:\n\n```bash\npython examples/example_basic_usage.py\n```\n\n\n## License\n\nThis project is licensed under the **MIT License** \u2014 see the [LICENSE](LICENSE) file for details.\n\n---\n\nMade with \u2764\ufe0f by [devcoons](https://github.com/devcoons)\n",
    "bugtrack_url": null,
    "license": "MIT License\n        \n        Copyright (c) 2024 Ioannis D. (devcoons)\n        \n        Permission is hereby granted, free of charge, to any person obtaining a copy\n        of this software and associated documentation files (the \"Software\"), to deal\n        in the Software without restriction, including without limitation the rights\n        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n        copies of the Software, and to permit persons to whom the Software is\n        furnished to do so, subject to the following conditions:\n        \n        The above copyright notice and this permission notice shall be included in all\n        copies or substantial portions of the Software.\n        \n        THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n        SOFTWARE.",
    "summary": "A simple terminal I/O utility with spinner animation",
    "version": "0.1.15",
    "project_urls": {
        "Homepage": "https://github.com/devcoons/consolio",
        "Issues": "https://github.com/devcoons/consolio/issues"
    },
    "split_keywords": [
        "consolio",
        " terminal",
        " color"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "4ea8e089e0d5a112a9a3f9b8da77eeda269ad939ea75962df0d6ac4efbe22144",
                "md5": "d6d92547862819e9d655115e8051741b",
                "sha256": "70910195cf61dec564e08564dc02c61b733e86b82f3f37aa9783d95e88c0a158"
            },
            "downloads": -1,
            "filename": "consolio-0.1.15-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "d6d92547862819e9d655115e8051741b",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.9",
            "size": 9601,
            "upload_time": "2025-10-08T22:35:39",
            "upload_time_iso_8601": "2025-10-08T22:35:39.750662Z",
            "url": "https://files.pythonhosted.org/packages/4e/a8/e089e0d5a112a9a3f9b8da77eeda269ad939ea75962df0d6ac4efbe22144/consolio-0.1.15-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "20382605162816a9172fe7f46dba9fd17916978913834406f1844b3e9c5ea8ba",
                "md5": "e762198ec4022adf95c221f41b60e6f1",
                "sha256": "17d723468e4f8545d06fd8e1ae21c752549fb0e99c27c20429fd692b8b28c7aa"
            },
            "downloads": -1,
            "filename": "consolio-0.1.15.tar.gz",
            "has_sig": false,
            "md5_digest": "e762198ec4022adf95c221f41b60e6f1",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.9",
            "size": 10443,
            "upload_time": "2025-10-08T22:35:40",
            "upload_time_iso_8601": "2025-10-08T22:35:40.997398Z",
            "url": "https://files.pythonhosted.org/packages/20/38/2605162816a9172fe7f46dba9fd17916978913834406f1844b3e9c5ea8ba/consolio-0.1.15.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-10-08 22:35:40",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "devcoons",
    "github_project": "consolio",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "consolio"
}
        
Elapsed time: 2.72340s