Skip to main content

Python Threads - from Dreadful to Threadful

Project description

Threaded Python

Threadful

Python Threads - from Dreadful to Threadful

Installation

pip install threadful

Usage

from threadful import thread

@thread # with or without ()
def some_function():
  time.sleep(10)
  return " done "

# when ready, it sill call these callback functions.
some_function().then(lambda result: result.strip().then(lambda result: print(result)) # prints: "done"

promise = some_function() # ThreadWithResult[str] object
promise.result() # Err(None)
time.sleep(15) # after the thread is done:
promise.result() # Ok(" done ")

# alternative to sleep:
result = promise.join() # Ok(" done ") if success, Err(Exception) if the thread raised an exception

License

threadful is distributed under the terms of the MIT license.

Changelog

See CHANGELOG.md

Project details


Download files

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

Source Distribution

threadful-0.1.0.tar.gz (36.0 kB view details)

Uploaded Source

Built Distribution

threadful-0.1.0-py3-none-any.whl (4.8 kB view details)

Uploaded Python 3

File details

Details for the file threadful-0.1.0.tar.gz.

File metadata

  • Download URL: threadful-0.1.0.tar.gz
  • Upload date:
  • Size: 36.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-httpx/0.26.0

File hashes

Hashes for threadful-0.1.0.tar.gz
Algorithm Hash digest
SHA256 56d82961ff830a72157819e3122c639c2f95bbeb408232460957ccacd7c04b95
MD5 b65d5778c8ef33ba23de1ee658449822
BLAKE2b-256 9eef95b91481f125787959e7c741a9161a3ecd67bec44298267bf5c015ba37d8

See more details on using hashes here.

File details

Details for the file threadful-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: threadful-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 4.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-httpx/0.26.0

File hashes

Hashes for threadful-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b3ab863e733953d5dcdf7b054f379f6c080fd5577fae258bd4c814ad86f01f4b
MD5 4a728ac07aaa3567b0a2ab72407b8a32
BLAKE2b-256 200b441736d944a1e2084da050f7d831a88321eb36c55f599398a30061226624

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