Skip to main content

Quick Looper

A simple polling style loop, run in a separate thread.

Installation

Install from PyPI:

pip install quicklooper

How to use

Make a class that inherits from the Looper class, and override the main method with code to be run each loop. The loop period may be set by assigning a float value to the class variable _interval or by passing the interval keyword arg to the Looper.__init__ method.

Override the on_start_up and on_shut_down methods to add any code to be run before the first loop, and after the final loop when stop is called.

Example of a basic app which polls the /printfiles directory for new files to print:

from quicklooper import Looper


class PrintMonitor(Looper):
    _interval = 10.0

    def __init__(self, directory: str):
        self.directory: str = directory
        self._printed_files: Set[str] = set()

    def on_start_up():
        self._printed_files = {file for file in os.listdir(self.directory)}

    def main():
        for file in os.listdir(self.directory):
            send_to_printer(file)  # implementation not shown
            self._printed_files.add(file)


if __name__ == '__main__':
    print_monitor = PrintMonitor('/printfiles')
    print_monitor.start()

When print_montitor.start() is called, the app runs on_start_up method, and then calls main every ten seconds to scan for new files to print.

Call stop to exit the loop immediately.

Metadata

Release files for quicklooper 1.0.0

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

Source distribution (sdist)

Source distribution for quicklooper 1.0.0
File Size Uploaded Provenance Actions
quicklooper-1.0.0.tar.gz 3.6 kB Without provenance Details for quicklooper-1.0.0.tar.gz

Built distribution (wheel)

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

Total release size: 7.9 kB

Release files / quicklooper-1.0.0.tar.gz

Download URL quicklooper-1.0.0.tar.gz
Size 3.6 kB
Tags Source
SHA-256 checksum
How to use checksums
d8259bff7af8603d7b47343a3f204650bf9c60e67420a8f371013cb9f5aa4096
BLAKE2b-256 checksum
How to use checksums
87f5c70966faba51cf98aa89b0a48bb34c58e90498997dba29d14d9dcc2b8fbc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.8.0 pkginfo/1.8.2 readme-renderer/34.0 requests/2.26.0 requests-toolbelt/0.9.1 urllib3/1.26.7 tqdm/4.63.1 importlib-metadata/4.11.3 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.10.1

Release files / quicklooper-1.0.0-py3-none-any.whl

Download URL quicklooper-1.0.0-py3-none-any.whl
Size 4.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b2e71faddaffa09b66e78402b382b8193de7c8c3823335da407a0c5eaaa46c17
BLAKE2b-256 checksum
How to use checksums
2d62239fce41b06534bfdfc95aa4144fdcb16e92af5865ef7e6d01902216b04c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.8.0 pkginfo/1.8.2 readme-renderer/34.0 requests/2.26.0 requests-toolbelt/0.9.1 urllib3/1.26.7 tqdm/4.63.1 importlib-metadata/4.11.3 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.10.1

Security for quicklooper 1.0.0

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.

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 release files No provenance

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