Skip to main content

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.

python -m looplog.demo

Usage

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

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

# install pre-commit
pip install pre-commit mypy
pre-commit install

# run tests
python -m looplog.tests

Release files for looplog 0.0.16

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for looplog 0.0.16
File Size Uploaded
looplog-0.0.16.tar.gz 9.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for looplog 0.0.16
File Interpreter ABI Platform
looplog-0.0.16-py3-none-any.whl Python 3 none any Details

Total release size: 18.4 kB

Release files / looplog-0.0.16.tar.gz

Download URL looplog-0.0.16.tar.gz
Size 9.4 kB
Tags Source
SHA-256 checksum
How to use checksums
fa488987168b5b772c16babade414e452435dc45539e5708a4cfe7acc5a0375e
BLAKE2b-256 checksum
How to use checksums
426b2d1e18f9700a90a29a15debd953da3c323dac9b97ae1d84c928c7990adaa
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.3

Release files / looplog-0.0.16-py3-none-any.whl

Download URL looplog-0.0.16-py3-none-any.whl
Size 8.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9527e6718856c1c89ebca9524a78557822a21ee5d0d9771d36dccc0e2f985c8c
BLAKE2b-256 checksum
How to use checksums
d7baf8f914836f5aab344322fe78c33a58e2f959943b436ab4c5d362708d9729
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.3
Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page