Skip to main content

Lackadaisical

codecov

adjective: lacking spirit or liveliness.

Lackadaisical is a Python package for keeping an eye on slow code.

Usage

To assert that a block of code should execute and return within a number of seconds, use lackadaisical.assert_faster_than as either a decorator or a context manager.

For example, assert_faster_than will raise lackadaisical.TooSlow if this test doesn't finish within 30 seconds of starting:

from lackadaisical import assert_faster_than

@assert_faster_than(30)
def test_my_slow_function() -> None:
    my_slow_function()

In this example, the test's setup is free to take as long as it needs and only the slow function is monitored:

from lackadaisical import assert_faster_than

def test_my_slow_function() -> None:
    data = my_slow_preparation()

    with assert_faster_than(30):
        my_slow_function(data)

assert_faster_than will not interrupt your code's execution after its time has elapsed, but lackadaisical.TooSlow will report the difference between the actual and expected execution times to help you diagnose the problem.

Operation took 2.6 seconds (expected 2.0 at most)

Installation

Lackadaisical requires Python 3.9 or later and can be installed from PyPI.

pip install lackadaisical

Support

Please submit all your questions, feature requests and bug reports at github.com/cariad/lackadaisical/issues. Thank you!

Licence

Lackadaisical is open-source and released under the MIT License.

You don't have to give attribution in your project, but -- as a freelance developer with rent to pay -- I appreciate it!

Author

Hello! 👋 I'm Cariad Eccleston, and I'm a freelance Amazon Web Services architect, DevOps evangelist, CI/CD pipeline engineer and backend developer.

You can find me at cariad.earth, github/cariad, linkedin/cariad and on Mastodon at @cariad@tech.lgbt.

Metadata

Release files for lackadaisical 1.0.1

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

Built distribution (wheel)

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

Release files / lackadaisical-1.0.1-py3-none-any.whl

Download URL lackadaisical-1.0.1-py3-none-any.whl
Size 5.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
99d4260730c24585279b97923300fb0860f1aa5e3178ef5076a664017ec7dd2e
BLAKE2b-256 checksum
How to use checksums
cffa2bf99d312e724c79be94c803607bb830d132eb0e48658937309dadd85b72
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.9.16

Security for lackadaisical 1.0.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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