Skip to main content
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
✨🍰✨

Release files for background 0.2.1

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

Source distribution (sdist)

Source distribution for background 0.2.1
File Size Uploaded
background-0.2.1.tar.gz 3.1 kB Details

Built distribution (wheel)

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

Total release size: 5.3 kB

Release files / background-0.2.1.tar.gz

Download URL background-0.2.1.tar.gz
Size 3.1 kB
Tags Source
SHA-256 checksum
How to use checksums
4a5ed40b4a2a9f3340b1402862725d35016dc2490f95d89a2de47c3ddf215b91
BLAKE2b-256 checksum
How to use checksums
b141d6122c8e4bb280b2182098d77554d00016b6ffe54201cd3fac7f52fe9df2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/52.0.0 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.8.7

Release files / background-0.2.1-py3-none-any.whl

Download URL background-0.2.1-py3-none-any.whl
Size 2.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c230e2813c773f93ecae54281ce6b1b425c895c24599cc203b7f137e4d7c4802
BLAKE2b-256 checksum
How to use checksums
c74501a33c692ce9f22214cad440f34704ed74e56b6f21d90e71aa595b3c2b72
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/52.0.0 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.8.7

Release history Release notifications | RSS feed

This release

0.2.1 This release

2 release files

0.1.1

2 release files

0.1.0

2 release files

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