looplog


Namelooplog JSON
Version 0.0.14 PyPI version JSON
download
home_pageNone
SummaryA little helper to log warnings/errors for processed
upload_time2024-09-17 08:13:00
maintainerNone
docs_urlNone
authorNone
requires_python>=3.0
licenseMIT License
keywords logging warnings errors
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Looplog

Looplog is a simple helper to log processing done in a loop, catching errors and warnings to produce a readble
console output, both interactively and not.

Quickly see how it looks with the demo.

```bash
python -m looplog.demo
```

## Usage

Decorate you function with `@looplog(items)` like this.

```python
from looplog import SKIP, looplog

@looplog([1, 2, 3, 4, 5, 6, 7, 8, "9", 10, 11.5, 12, 0, 13, None, 15])
def func_basic(value):
    if value is None:
        return SKIP
    if isinstance(value, float) and not value.is_integer():
        warnings.warn("Input will be rounded !")
    10 // value

# [to stdout in realtime]
# Starting loop `func_basic`
# ..........!.X.-....X.

print(func_basic.details())

# ================================================================================
# WARNING step_11: Input will be rounded !
# ================================================================================
# ERROR step_13: integer division or modulo by zero
# ================================================================================
# ERROR step_20: unsupported operand type(s) for //: 'int' and 'str'
# ================================================================================

print(func_basic.summary())

# 17 ok / 1 warn / 2 err / 1 skip

print(func_basic.report())

# Errors:
#   1   TypeError
#   1   ZeroDivisionError
# Warnings:
#   1   UserWarning
```

Check the looplog docstring for some additional features (logging, limit, etc.).

## Contribute

```bash
# install pre-commit
pip install pre-commit mypy
pre-commit install

# run tests
python -m looplog.tests
```

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "looplog",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.0",
    "maintainer_email": null,
    "keywords": "logging, warnings, errors",
    "author": null,
    "author_email": "Olivier Dalang <olivier.dalang@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/11/1d/deddc60f645e976ec26a1ef67a80a25af8f436f59c88e295514d49a8949c/looplog-0.0.14.tar.gz",
    "platform": null,
    "description": "# Looplog\n\nLooplog is a simple helper to log processing done in a loop, catching errors and warnings to produce a readble\nconsole output, both interactively and not.\n\nQuickly see how it looks with the demo.\n\n```bash\npython -m looplog.demo\n```\n\n## Usage\n\nDecorate you function with `@looplog(items)` like this.\n\n```python\nfrom looplog import SKIP, looplog\n\n@looplog([1, 2, 3, 4, 5, 6, 7, 8, \"9\", 10, 11.5, 12, 0, 13, None, 15])\ndef func_basic(value):\n    if value is None:\n        return SKIP\n    if isinstance(value, float) and not value.is_integer():\n        warnings.warn(\"Input will be rounded !\")\n    10 // value\n\n# [to stdout in realtime]\n# Starting loop `func_basic`\n# ..........!.X.-....X.\n\nprint(func_basic.details())\n\n# ================================================================================\n# WARNING step_11: Input will be rounded !\n# ================================================================================\n# ERROR step_13: integer division or modulo by zero\n# ================================================================================\n# ERROR step_20: unsupported operand type(s) for //: 'int' and 'str'\n# ================================================================================\n\nprint(func_basic.summary())\n\n# 17 ok / 1 warn / 2 err / 1 skip\n\nprint(func_basic.report())\n\n# Errors:\n#   1   TypeError\n#   1   ZeroDivisionError\n# Warnings:\n#   1   UserWarning\n```\n\nCheck the looplog docstring for some additional features (logging, limit, etc.).\n\n## Contribute\n\n```bash\n# install pre-commit\npip install pre-commit mypy\npre-commit install\n\n# run tests\npython -m looplog.tests\n```\n",
    "bugtrack_url": null,
    "license": "MIT License",
    "summary": "A little helper to log warnings/errors for processed",
    "version": "0.0.14",
    "project_urls": {
        "homepage": "https://github.com/olivierdalang/looplog",
        "repository": "https://github.com/olivierdalang/looplog",
        "tracker": "https://github.com/olivierdalang/looplog/issues"
    },
    "split_keywords": [
        "logging",
        " warnings",
        " errors"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "7c6d4b1b9abdb897f0059d93c7499a399bdf6c0111b273851cc2f350193d1bea",
                "md5": "9df460fa7ec33c32557d7961b108beb7",
                "sha256": "8538fa9770eb823250ca6ceb211431092148f1931c9354dd9165585a929259f0"
            },
            "downloads": -1,
            "filename": "looplog-0.0.14-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "9df460fa7ec33c32557d7961b108beb7",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.0",
            "size": 8486,
            "upload_time": "2024-09-17T08:12:58",
            "upload_time_iso_8601": "2024-09-17T08:12:58.807592Z",
            "url": "https://files.pythonhosted.org/packages/7c/6d/4b1b9abdb897f0059d93c7499a399bdf6c0111b273851cc2f350193d1bea/looplog-0.0.14-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "111ddeddc60f645e976ec26a1ef67a80a25af8f436f59c88e295514d49a8949c",
                "md5": "8b6421329e29844f1bf2a040337c7b39",
                "sha256": "a07c068d09f0bf57599f0d36d821329af71600cc024bc83593f510379a432652"
            },
            "downloads": -1,
            "filename": "looplog-0.0.14.tar.gz",
            "has_sig": false,
            "md5_digest": "8b6421329e29844f1bf2a040337c7b39",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.0",
            "size": 8996,
            "upload_time": "2024-09-17T08:13:00",
            "upload_time_iso_8601": "2024-09-17T08:13:00.369879Z",
            "url": "https://files.pythonhosted.org/packages/11/1d/deddc60f645e976ec26a1ef67a80a25af8f436f59c88e295514d49a8949c/looplog-0.0.14.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-09-17 08:13:00",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "olivierdalang",
    "github_project": "looplog",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "looplog"
}
        
Elapsed time: 3.59172s