Skip to main content

It does what it says it does.

Project description

https://img.shields.io/pypi/pyversions/background.svg https://github.com/ParthS007/background/workflows/CI/badge.svg

Background

It runs stuff in the background.

“An elegant decorator-based abstraction around Python 3’s concurrent.futures ThreadPoolExecutor class”

—Simon Willison

This module makes it stupidly simple to run things in the background of your application, be it a CLI app, or a web app.

Basic Usage

import time

import background


@background.task
def work():
    # Do something expensive here.
    time.sleep(10)


for _ in range(100):
    work()

Advanced Usage

import time

import background

# Use 40 background threads.
background.n = 40


@background.task
def work():
    time.sleep(10)
    return "Done!"

@background.callback
def work_callback(future):
    print(future.result())


for _ in range(100):
    work()

Installation

$ pipenv install background
✨🍰✨

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for background, version 0.2.1
Filename, size File type Python version Upload date Hashes
Filename, size background-0.2.1-py3-none-any.whl (2.2 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size background-0.2.1.tar.gz (3.1 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page