Skip to main content

Several greenlet subclasses

Project description

Several gevent.Greenlet subclasses.

  • Processlet

  • Transparentlet

import bcrypt
import gevent
from lets import Processlet

# bcrypt.hashpw is very heavy cpu-bound task. it can spend a few seconds.
def hash_password(password, salt=bcrypt.gensalt()):
    return bcrypt.hashpw(str(password), salt)

def tictoc(delay=0.1):
    while True:
        print '.'
        gevent.sleep(delay)

gevent.spawn(tictoc)

# Greenlet, tictoc pauses for a few seconds
greenlet = gevent.spawn(hash_password, 'my_password')
hash = greenlet.get()

# Processlet, tictoc never pauses
processlet = Processlet.spawn(hash_password, 'my_password')
hash = processlet.get()

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

lets-0.0.8.tar.gz (4.8 kB view details)

Uploaded Source

File details

Details for the file lets-0.0.8.tar.gz.

File metadata

  • Download URL: lets-0.0.8.tar.gz
  • Upload date:
  • Size: 4.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for lets-0.0.8.tar.gz
Algorithm Hash digest
SHA256 1267860d9ad5e98aaf1197d3b2a773338184a8bc77ad7f2d322f15e844e86008
MD5 7f537a0cc4ad35e8ccb3f9d90e704d64
BLAKE2b-256 90a99cd59fbe962053ef97482f13802e0a0edcde20a8e615c599f77cd9f105dd

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