Skip to main content

Decorators for sound reproduction.

Project description

SnakeJazz

SnakeJazz provides decorators to let you listen to the running status of your Snake Python functions. Most definitly inspired by Rick and Morty ;)

These are the decorators:

  • snakejazz.zzz: You can choose to reproduce a sound at the moment your function starts to excecute, when it finishes or when an error occurs. A different sound for each event can be given.

  • snakejazz.www: Exactly the same as zzz, but you can specify youtube links and the audio will be downloaded.

  • snakejazz.rattle: Rattle from start to finish. This will loop the sound until your function ends. You can either give a local path or a youtube link.

All three of them can be used directly to run with the default configuration. But you can also give some custom sounds for a more enjoyable moment.

Examples

Let's say you have a function that takes some time to compute. Just plug in the decorator of your preference and you're good to go!

import time
import snakejazz

@snakejazz.rattle
def wait(t):
    """Some function to simulate computing time."""
    time.sleep(t)
    return

# Put on your headphones and run it!
wait(22)

The rattle decorator will play a sound in loop until your function ends.

Now let's say you want to be notified if an error occurs during the execution of your function.

import time
import snakejazz

@snakejazz.zzz(when_error=True)
def wait(t):
    """Some function to simulate computing time."""
    time.sleep(t)
    raise ValueError('Something went wrong')
    return

# Put on your headphones and run it!
wait(3)

Sounds

For the moment SnakeJazz comes with one pack of 33 free sounds called Rhodesmas (available here: link). You can listen to them with the function snakejazz.play_sound. Just run this code:

import snakejazz

for sound, path in snakejazz.sounds.RHODESMAS.items():
    print(f'Playing {sound}')
    snakejazz.play_sound(path)

Documentation

You can read the full documentation here: https://snakejazz.readthedocs.io/

Author

Martin Chalela (E-mail: tinchochalela@gmail.com)

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

snakejazz-0.1.0.tar.gz (6.2 MB view details)

Uploaded Source

File details

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

File metadata

  • Download URL: snakejazz-0.1.0.tar.gz
  • Upload date:
  • Size: 6.2 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.4.2 requests/2.22.0 setuptools/45.2.0 requests-toolbelt/0.8.0 tqdm/4.30.0 CPython/3.8.5

File hashes

Hashes for snakejazz-0.1.0.tar.gz
Algorithm Hash digest
SHA256 412fad663ad331b1dce0f76768b2064fe84d06fc479a162d9ebc3e0fb6176826
MD5 5dc6186b06c4bca266baf2dc02052052
BLAKE2b-256 c0066fe83737f386db5ea32a65c175ecf580796951b1f41c364cb063d987d43d

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