bumbag


Namebumbag JSON
Version 5.2.1 PyPI version JSON
download
home_pagehttps://github.com/estripling/bumbag
SummaryA package for Python utility functions.
upload_time2023-09-24 15:53:29
maintainer
docs_urlNone
authorBumBag Developers
requires_python>=3.8,<4.0
licenseBSD-3-Clause
keywords utility functions bumbag
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            <p align="center">
<img src="https://raw.githubusercontent.com/estripling/bumbag/main/docs/source/_static/logo.png" width="180" alt="The BumBag logo.">
</p>

<p align="center">
<a href="https://pypi.org/project/bumbag"><img alt="pypi" src="https://img.shields.io/pypi/v/bumbag"></a>
<a href="https://readthedocs.org/projects/bumbag/?badge=latest"><img alt="docs" src="https://readthedocs.org/projects/bumbag/badge/?version=latest"></a>
<a href="https://github.com/estripling/bumbag/actions/workflows/ci.yml"><img alt="ci status" src="https://github.com/estripling/bumbag/actions/workflows/ci.yml/badge.svg?branch=main"></a>
<a href="https://codecov.io/gh/estripling/bumbag"><img alt="coverage" src="https://codecov.io/github/estripling/bumbag/coverage.svg?branch=main"></a>
<a href="https://github.com/estripling/bumbag/blob/main/LICENSE"><img alt="license" src="https://img.shields.io/pypi/l/bumbag"></a>
</p>

## About

BumBag is a collection of Python utility functions:

- [Documentation](https://bumbag.readthedocs.io/en/stable/index.html)
- [Example usage](https://bumbag.readthedocs.io/en/stable/example.html)
- [API Reference](https://bumbag.readthedocs.io/en/stable/autoapi/bumbag/index.html)

## Installation

`bumbag` is available on [PyPI](https://pypi.org/project/bumbag/) for Python 3.8+:

```shell
pip install bumbag
```

## Examples

Measure elapsed wall-clock time and compute total elapsed time with [`stopwatch`](https://bumbag.readthedocs.io/en/stable/autoapi/bumbag/index.html#bumbag.stopwatch):

```python
>>> import bumbag
>>> import time
>>> with bumbag.stopwatch(1) as sw1:
...     time.sleep(1)
...
2023-01-01 12:00:00 -> 2023-01-01 12:00:01 = 1.00124s - 1
>>> with bumbag.stopwatch(2) as sw2:
...     time.sleep(1)
...
2023-01-01 12:01:00 -> 2023-01-01 12:01:01 = 1.00168s - 2
>>> sw1 + sw2
2.00291s - total elapsed time
```

Easily [`flatten`](https://bumbag.readthedocs.io/en/stable/autoapi/bumbag/index.html#bumbag.flatten) an irregular list:

```python
>>> import bumbag
>>> irregular_list = [
...     ["one", 2],
...     3,
...     [(4, "five")],
...     [[["six"]]],
...     "seven",
...     [],
... ]
>>> list(bumbag.flatten(irregular_list, 8, [9, ("ten",)]))
['one', 2, 3, 4, 'five', 'six', 'seven', 8, 9, 'ten']
```

Use [`highlight_string_differences`](https://bumbag.readthedocs.io/en/stable/autoapi/bumbag/index.html#bumbag.highlight_string_differences) to see differences between two strings easily:

```python
>>> import bumbag
>>> print(bumbag.highlight_string_differences("hello", "hall"))
hello
 |  |
hall
```

Quickly compare two Python sets with [`two_set_summary`](https://bumbag.readthedocs.io/en/stable/autoapi/bumbag/index.html#bumbag.two_set_summary):

```python
>>> import bumbag
>>> x = {"a", "c", "b", "g", "h"}
>>> y = {"c", "d", "e", "f", "g"}
>>> summary = bumbag.two_set_summary(x, y)
>>> print(summary["report"])
    x (n=5): {'a', 'b', 'c', ...}
    y (n=5): {'c', 'd', 'e', ...}
x | y (n=8): {'a', 'b', 'c', ...}
x & y (n=2): {'c', 'g'}
x - y (n=3): {'a', 'b', 'h'}
y - x (n=3): {'d', 'e', 'f'}
x ^ y (n=6): {'a', 'b', 'd', ...}
jaccard = 0.25
overlap = 0.4
dice = 0.4
disjoint?: False
x == y: False
x <= y: False
x <  y: False
y <= x: False
y <  x: False
```

## Contributing to BumBag

Your contribution is greatly appreciated!
See the following links to help you get started:

- [Contributing Guide](https://bumbag.readthedocs.io/en/latest/contributing.html)
- [Developer Guide](https://bumbag.readthedocs.io/en/latest/developers.html)
- [Contributor Code of Conduct](https://bumbag.readthedocs.io/en/latest/conduct.html)

## License

`bumbag` was created by the BumBag Developers.
It is licensed under the terms of the BSD 3-Clause license.

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/estripling/bumbag",
    "name": "bumbag",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.8,<4.0",
    "maintainer_email": "",
    "keywords": "utility functions,bumbag",
    "author": "BumBag Developers",
    "author_email": "",
    "download_url": "https://files.pythonhosted.org/packages/b2/b6/8149b55f182a3f4a3d65510b824a041bf745a0178cd1f0a9a90e6c4eb2e1/bumbag-5.2.1.tar.gz",
    "platform": null,
    "description": "<p align=\"center\">\n<img src=\"https://raw.githubusercontent.com/estripling/bumbag/main/docs/source/_static/logo.png\" width=\"180\" alt=\"The BumBag logo.\">\n</p>\n\n<p align=\"center\">\n<a href=\"https://pypi.org/project/bumbag\"><img alt=\"pypi\" src=\"https://img.shields.io/pypi/v/bumbag\"></a>\n<a href=\"https://readthedocs.org/projects/bumbag/?badge=latest\"><img alt=\"docs\" src=\"https://readthedocs.org/projects/bumbag/badge/?version=latest\"></a>\n<a href=\"https://github.com/estripling/bumbag/actions/workflows/ci.yml\"><img alt=\"ci status\" src=\"https://github.com/estripling/bumbag/actions/workflows/ci.yml/badge.svg?branch=main\"></a>\n<a href=\"https://codecov.io/gh/estripling/bumbag\"><img alt=\"coverage\" src=\"https://codecov.io/github/estripling/bumbag/coverage.svg?branch=main\"></a>\n<a href=\"https://github.com/estripling/bumbag/blob/main/LICENSE\"><img alt=\"license\" src=\"https://img.shields.io/pypi/l/bumbag\"></a>\n</p>\n\n## About\n\nBumBag is a collection of Python utility functions:\n\n- [Documentation](https://bumbag.readthedocs.io/en/stable/index.html)\n- [Example usage](https://bumbag.readthedocs.io/en/stable/example.html)\n- [API Reference](https://bumbag.readthedocs.io/en/stable/autoapi/bumbag/index.html)\n\n## Installation\n\n`bumbag` is available on [PyPI](https://pypi.org/project/bumbag/) for Python 3.8+:\n\n```shell\npip install bumbag\n```\n\n## Examples\n\nMeasure elapsed wall-clock time and compute total elapsed time with [`stopwatch`](https://bumbag.readthedocs.io/en/stable/autoapi/bumbag/index.html#bumbag.stopwatch):\n\n```python\n>>> import bumbag\n>>> import time\n>>> with bumbag.stopwatch(1) as sw1:\n...     time.sleep(1)\n...\n2023-01-01 12:00:00 -> 2023-01-01 12:00:01 = 1.00124s - 1\n>>> with bumbag.stopwatch(2) as sw2:\n...     time.sleep(1)\n...\n2023-01-01 12:01:00 -> 2023-01-01 12:01:01 = 1.00168s - 2\n>>> sw1 + sw2\n2.00291s - total elapsed time\n```\n\nEasily [`flatten`](https://bumbag.readthedocs.io/en/stable/autoapi/bumbag/index.html#bumbag.flatten) an irregular list:\n\n```python\n>>> import bumbag\n>>> irregular_list = [\n...     [\"one\", 2],\n...     3,\n...     [(4, \"five\")],\n...     [[[\"six\"]]],\n...     \"seven\",\n...     [],\n... ]\n>>> list(bumbag.flatten(irregular_list, 8, [9, (\"ten\",)]))\n['one', 2, 3, 4, 'five', 'six', 'seven', 8, 9, 'ten']\n```\n\nUse [`highlight_string_differences`](https://bumbag.readthedocs.io/en/stable/autoapi/bumbag/index.html#bumbag.highlight_string_differences) to see differences between two strings easily:\n\n```python\n>>> import bumbag\n>>> print(bumbag.highlight_string_differences(\"hello\", \"hall\"))\nhello\n |  |\nhall\n```\n\nQuickly compare two Python sets with [`two_set_summary`](https://bumbag.readthedocs.io/en/stable/autoapi/bumbag/index.html#bumbag.two_set_summary):\n\n```python\n>>> import bumbag\n>>> x = {\"a\", \"c\", \"b\", \"g\", \"h\"}\n>>> y = {\"c\", \"d\", \"e\", \"f\", \"g\"}\n>>> summary = bumbag.two_set_summary(x, y)\n>>> print(summary[\"report\"])\n    x (n=5): {'a', 'b', 'c', ...}\n    y (n=5): {'c', 'd', 'e', ...}\nx | y (n=8): {'a', 'b', 'c', ...}\nx & y (n=2): {'c', 'g'}\nx - y (n=3): {'a', 'b', 'h'}\ny - x (n=3): {'d', 'e', 'f'}\nx ^ y (n=6): {'a', 'b', 'd', ...}\njaccard = 0.25\noverlap = 0.4\ndice = 0.4\ndisjoint?: False\nx == y: False\nx <= y: False\nx <  y: False\ny <= x: False\ny <  x: False\n```\n\n## Contributing to BumBag\n\nYour contribution is greatly appreciated!\nSee the following links to help you get started:\n\n- [Contributing Guide](https://bumbag.readthedocs.io/en/latest/contributing.html)\n- [Developer Guide](https://bumbag.readthedocs.io/en/latest/developers.html)\n- [Contributor Code of Conduct](https://bumbag.readthedocs.io/en/latest/conduct.html)\n\n## License\n\n`bumbag` was created by the BumBag Developers.\nIt is licensed under the terms of the BSD 3-Clause license.\n",
    "bugtrack_url": null,
    "license": "BSD-3-Clause",
    "summary": "A package for Python utility functions.",
    "version": "5.2.1",
    "project_urls": {
        "Documentation": "https://bumbag.readthedocs.io/en/stable/",
        "Homepage": "https://github.com/estripling/bumbag",
        "Repository": "https://github.com/estripling/bumbag"
    },
    "split_keywords": [
        "utility functions",
        "bumbag"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "67e8760276f1f26ff1fbe94ffebf60e55dc03d2a783298bea77edc52121ded13",
                "md5": "d931e1e7532c920f00696c8f95fb217d",
                "sha256": "a7d8e113b6d1713e95b76587de1d4fd8d4a05d22c973668fb6950670a7c1b579"
            },
            "downloads": -1,
            "filename": "bumbag-5.2.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "d931e1e7532c920f00696c8f95fb217d",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8,<4.0",
            "size": 21213,
            "upload_time": "2023-09-24T15:53:27",
            "upload_time_iso_8601": "2023-09-24T15:53:27.728298Z",
            "url": "https://files.pythonhosted.org/packages/67/e8/760276f1f26ff1fbe94ffebf60e55dc03d2a783298bea77edc52121ded13/bumbag-5.2.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "b2b68149b55f182a3f4a3d65510b824a041bf745a0178cd1f0a9a90e6c4eb2e1",
                "md5": "7d85a1164157a370a9ff00a091361ae9",
                "sha256": "4ef4db217deac4a57e75590ef8e9d79765f839e9c5615b16aabdeb07fcd88944"
            },
            "downloads": -1,
            "filename": "bumbag-5.2.1.tar.gz",
            "has_sig": false,
            "md5_digest": "7d85a1164157a370a9ff00a091361ae9",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8,<4.0",
            "size": 19012,
            "upload_time": "2023-09-24T15:53:29",
            "upload_time_iso_8601": "2023-09-24T15:53:29.386786Z",
            "url": "https://files.pythonhosted.org/packages/b2/b6/8149b55f182a3f4a3d65510b824a041bf745a0178cd1f0a9a90e6c4eb2e1/bumbag-5.2.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-09-24 15:53:29",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "estripling",
    "github_project": "bumbag",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "bumbag"
}
        
Elapsed time: 0.12543s