Skip to main content

Takes the hassle away from threading functions and gettting their results

Project description

Python Threadit

Running functions in threads with no effort

PyPI - Format PyPI - Status Downloads PyPI - Python Version

A nice package to help you run functions in threads and get their result.

Installation

pip install threadit

Usage

from threadit import Threadit, thredit_result


@thredit_result
def get_company_name():
    # Do work in thread
    return 'Adapted'


def do_some_work():
    get_name = Threadit(get_company_name)
    # do stuff or run a while loop to wait for result
    while get_name.doing_working():
        print('Waiting for thread to finnish')

    # You can also call .get() and the system will wait for the thread to return your result.

    company_name = get_name.get()
    print(company_name) # Outputs -> Adapted

Remember to add the @thredit_result decorator to the function you want to run in a thread, else you get back a SyntaxWarning.

Testing

Use the following command to run tests.

python -m unittest threadit.tests.test_threadit

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

threadit-0.1.1.tar.gz (2.5 kB view details)

Uploaded Source

Built Distribution

threadit-0.1.1-py3-none-any.whl (3.2 kB view details)

Uploaded Python 3

File details

Details for the file threadit-0.1.1.tar.gz.

File metadata

  • Download URL: threadit-0.1.1.tar.gz
  • Upload date:
  • Size: 2.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.24.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.8.3

File hashes

Hashes for threadit-0.1.1.tar.gz
Algorithm Hash digest
SHA256 8a63edc420adc7b63cd251d56ae6b345ab83fdcde94dce8a2482fdee65748711
MD5 8139e5ed3d21469aac49dc5be79dbb27
BLAKE2b-256 3dbfbfe35538afeb30a4ea310a3e6377538abd3625701f6457e87a52f7d7ddfe

See more details on using hashes here.

File details

Details for the file threadit-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: threadit-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 3.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.24.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.8.3

File hashes

Hashes for threadit-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 b4c72203fe3a0042e4ae6e19c11f9bdc3dcd0db2c88035cfd1f58ab77001aaa0
MD5 a17181c6a58625105cd337e573d3cb8f
BLAKE2b-256 7a08e544e45e6664789572b0bc87fc3a93ecf25feca25eef36bec5419f3fae5b

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