holdon


Nameholdon JSON
Version 0.1 PyPI version JSON
download
home_page
SummaryA lightweight Python progress bar library with a simple API.
upload_time2024-02-25 06:50:46
maintainer
docs_urlNone
author
requires_python>=3
licenseMIT License Copyright (c) 2024 AWeirdScratcher 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 holdon progress-bar progress bar loading loader
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # holdon

Holdon, pronounced "hold'n," is a lightweight Python progress bar library with a simple API.

```haskell
$ pip install holdon
```

## Get Started

Holdon is like [tqdm](https://pypi.org/project/tqdm), just wrap `progress()` around an iterator and we're good to go.

```python
import time
from holdon import progress

for i in progress(range(100)):
    time.sleep(0.1)
```

```python
 23.0% ━━━╸━━━━━━━━━━━━━━━━  23 / 100 (9.9it/s)
```

<br />

If you do not have any iterator, you can use <kbd>class</kbd> `RawProgress()` and update everything manually. To learn more, refer to the documentation below.

## Documentation

Minimal, lol.

### <kbd>def</kbd> progress()

```python
progress(
    iterator: Iterator, 
    *, 
    width: Optional[int] = None, 
    size: Optional[int] = None,
    unit: Literal["it", "bytes"] = "it"
) -> Iterator[Any]
```

Creates a progress bar.

**Example:**

You can wrap `progress()` around any iterator:

```python
for i in progress(range(100)):
    ... # do your work here
```

You can also wrap it around a custom iterator, but you'll need to specify its total iterations.

```python
words = ["cheese", "is", "good", "but", "i'm", "lactose", "intolerant"]

def word_it():
    for word in words:
        yield word + " "

for word in progress(word_it(), size=len(words)):
    ... # do your work here
```

**Args:**

- iterator (`Iterator`): The iterator. For instance, `range` or `list`.
- width (`int`, *optional*): Width of the progress bar. Defaults to 50.
- size (`int`, *optional*): Size of the iterator or the `len()` of the iterator.
- unit (`Literal["it", "bytes"]`): Unit. Could be one of: "it" (iterations) or "bytes" (bytes).


### <kbd>class</kbd> RawProgress

<details>
    <summary><b>Attributes</b></summary>
<div>

- <kbd>const</kbd> fmt (`str`): Progress bar format.
- <kbd>slots</kbd> width (`int`): Progress bar width.
- <kbd>slots</kbd> size (`int`): Total iterations as "size."
- <kbd>slots</kbd> unit (`Literal["it", "bytes"]`): Unit. Could be one of: "it" (iterations) or "bytes" (bytes).

</p>
</details>

<br />

```python
__init__(
    self, 
    width: int = 50, 
    size: int = 100,
    unit: Literal["it", "bytes"] = "it"
)
```

The progress bar.

**Example:**

A minimal example:

```python
rp = RawProgress()

for i in range(500):
    rp.advance(1)
```

You can also change the `unit` parameter to `"bytes"` and specify the total content length (see [`requests`](https://pypi.org/project/requests)) to indicate download progress:

```python
rp = RawProgress(
    unit="bytes",
    size=int(http_response.headers['Content-Length'])
)

for chunk in http_response.iter_content():
    rp.advance(len(chunk))
```

**Args:**

- width (`int`): Progress bar width.
- size (`int`): Total iterations as "size."
- unit (`Literal["it", "bytes"]`): Unit. Could be one of: "it" (iterations) or "bytes" (bytes).


#### <kbd>def</kbd> RawProgress.advance()

```python
advance(self, i: int = 1) -> None
```

Advance.

**Args:**

- i (`int`): Advance size.

#### <kbd>def</kbd> RawProgress.render()

```python
render(self) -> None
```

Renders the progress bar.

***

(c) 2024 AWeirdDev

            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "holdon",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3",
    "maintainer_email": "",
    "keywords": "holdon,progress-bar,progress,bar,loading,loader",
    "author": "",
    "author_email": "AWeirdDev <aweirdscratcher@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/a8/c9/d8b65f9580fee4077a93a0f515f5e282d3d16691aa8187c6e8f76ad72d86/holdon-0.1.tar.gz",
    "platform": null,
    "description": "# holdon\r\n\r\nHoldon, pronounced \"hold'n,\" is a lightweight Python progress bar library with a simple API.\r\n\r\n```haskell\r\n$ pip install holdon\r\n```\r\n\r\n## Get Started\r\n\r\nHoldon is like [tqdm](https://pypi.org/project/tqdm), just wrap `progress()` around an iterator and we're good to go.\r\n\r\n```python\r\nimport time\r\nfrom holdon import progress\r\n\r\nfor i in progress(range(100)):\r\n    time.sleep(0.1)\r\n```\r\n\r\n```python\r\n 23.0% \u2501\u2501\u2501\u2578\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501  23 / 100 (9.9it/s)\r\n```\r\n\r\n<br />\r\n\r\nIf you do not have any iterator, you can use <kbd>class</kbd> `RawProgress()` and update everything manually. To learn more, refer to the documentation below.\r\n\r\n## Documentation\r\n\r\nMinimal, lol.\r\n\r\n### <kbd>def</kbd> progress()\r\n\r\n```python\r\nprogress(\r\n    iterator: Iterator, \r\n    *, \r\n    width: Optional[int] = None, \r\n    size: Optional[int] = None,\r\n    unit: Literal[\"it\", \"bytes\"] = \"it\"\r\n) -> Iterator[Any]\r\n```\r\n\r\nCreates a progress bar.\r\n\r\n**Example:**\r\n\r\nYou can wrap `progress()` around any iterator:\r\n\r\n```python\r\nfor i in progress(range(100)):\r\n    ... # do your work here\r\n```\r\n\r\nYou can also wrap it around a custom iterator, but you'll need to specify its total iterations.\r\n\r\n```python\r\nwords = [\"cheese\", \"is\", \"good\", \"but\", \"i'm\", \"lactose\", \"intolerant\"]\r\n\r\ndef word_it():\r\n    for word in words:\r\n        yield word + \" \"\r\n\r\nfor word in progress(word_it(), size=len(words)):\r\n    ... # do your work here\r\n```\r\n\r\n**Args:**\r\n\r\n- iterator (`Iterator`): The iterator. For instance, `range` or `list`.\r\n- width (`int`, *optional*): Width of the progress bar. Defaults to 50.\r\n- size (`int`, *optional*): Size of the iterator or the `len()` of the iterator.\r\n- unit (`Literal[\"it\", \"bytes\"]`): Unit. Could be one of: \"it\" (iterations) or \"bytes\" (bytes).\r\n\r\n\r\n### <kbd>class</kbd> RawProgress\r\n\r\n<details>\r\n    <summary><b>Attributes</b></summary>\r\n<div>\r\n\r\n- <kbd>const</kbd> fmt (`str`): Progress bar format.\r\n- <kbd>slots</kbd> width (`int`): Progress bar width.\r\n- <kbd>slots</kbd> size (`int`): Total iterations as \"size.\"\r\n- <kbd>slots</kbd> unit (`Literal[\"it\", \"bytes\"]`): Unit. Could be one of: \"it\" (iterations) or \"bytes\" (bytes).\r\n\r\n</p>\r\n</details>\r\n\r\n<br />\r\n\r\n```python\r\n__init__(\r\n    self, \r\n    width: int = 50, \r\n    size: int = 100,\r\n    unit: Literal[\"it\", \"bytes\"] = \"it\"\r\n)\r\n```\r\n\r\nThe progress bar.\r\n\r\n**Example:**\r\n\r\nA minimal example:\r\n\r\n```python\r\nrp = RawProgress()\r\n\r\nfor i in range(500):\r\n    rp.advance(1)\r\n```\r\n\r\nYou can also change the `unit` parameter to `\"bytes\"` and specify the total content length (see [`requests`](https://pypi.org/project/requests)) to indicate download progress:\r\n\r\n```python\r\nrp = RawProgress(\r\n    unit=\"bytes\",\r\n    size=int(http_response.headers['Content-Length'])\r\n)\r\n\r\nfor chunk in http_response.iter_content():\r\n    rp.advance(len(chunk))\r\n```\r\n\r\n**Args:**\r\n\r\n- width (`int`): Progress bar width.\r\n- size (`int`): Total iterations as \"size.\"\r\n- unit (`Literal[\"it\", \"bytes\"]`): Unit. Could be one of: \"it\" (iterations) or \"bytes\" (bytes).\r\n\r\n\r\n#### <kbd>def</kbd> RawProgress.advance()\r\n\r\n```python\r\nadvance(self, i: int = 1) -> None\r\n```\r\n\r\nAdvance.\r\n\r\n**Args:**\r\n\r\n- i (`int`): Advance size.\r\n\r\n#### <kbd>def</kbd> RawProgress.render()\r\n\r\n```python\r\nrender(self) -> None\r\n```\r\n\r\nRenders the progress bar.\r\n\r\n***\r\n\r\n(c) 2024 AWeirdDev\r\n",
    "bugtrack_url": null,
    "license": "MIT License  Copyright (c) 2024 AWeirdScratcher  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.",
    "summary": "A lightweight Python progress bar library with a simple API.",
    "version": "0.1",
    "project_urls": {
        "Bug Tracker": "https://github.com/AWeirdScratcher/holdon/issues",
        "Homepage": "https://github.com/AWeirdScratcher/holdon"
    },
    "split_keywords": [
        "holdon",
        "progress-bar",
        "progress",
        "bar",
        "loading",
        "loader"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "a8c9d8b65f9580fee4077a93a0f515f5e282d3d16691aa8187c6e8f76ad72d86",
                "md5": "e95fc33f47255bacd9fe96779ab95f42",
                "sha256": "07f3b6ba589f8034850350bdcbc0dc74f9198473f1744045b5651ddad479c8ae"
            },
            "downloads": -1,
            "filename": "holdon-0.1.tar.gz",
            "has_sig": false,
            "md5_digest": "e95fc33f47255bacd9fe96779ab95f42",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3",
            "size": 5396,
            "upload_time": "2024-02-25T06:50:46",
            "upload_time_iso_8601": "2024-02-25T06:50:46.686317Z",
            "url": "https://files.pythonhosted.org/packages/a8/c9/d8b65f9580fee4077a93a0f515f5e282d3d16691aa8187c6e8f76ad72d86/holdon-0.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-02-25 06:50:46",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "AWeirdScratcher",
    "github_project": "holdon",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "holdon"
}
        
Elapsed time: 4.53153s