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.

Source Distribution

background-0.2.1.tar.gz (3.1 kB view details)

Uploaded Source

Built Distribution

background-0.2.1-py3-none-any.whl (2.2 kB view details)

Uploaded Python 3

File details

Details for the file background-0.2.1.tar.gz.

File metadata

  • Download URL: background-0.2.1.tar.gz
  • Upload date:
  • Size: 3.1 kB
  • Tags: Source
  • Uploaded using 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

File hashes

Hashes for background-0.2.1.tar.gz
Algorithm Hash digest
SHA256 4a5ed40b4a2a9f3340b1402862725d35016dc2490f95d89a2de47c3ddf215b91
MD5 1ec993ece0f015111243cec31fb791ae
BLAKE2b-256 b141d6122c8e4bb280b2182098d77554d00016b6ffe54201cd3fac7f52fe9df2

See more details on using hashes here.

File details

Details for the file background-0.2.1-py3-none-any.whl.

File metadata

  • Download URL: background-0.2.1-py3-none-any.whl
  • Upload date:
  • Size: 2.2 kB
  • Tags: Python 3
  • Uploaded using 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

File hashes

Hashes for background-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 c230e2813c773f93ecae54281ce6b1b425c895c24599cc203b7f137e4d7c4802
MD5 4fdd2e5df41cefd0609e2c4df79a3cb7
BLAKE2b-256 c74501a33c692ce9f22214cad440f34704ed74e56b6f21d90e71aa595b3c2b72

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page