Coder Social home page Coder Social logo

jazzit's Introduction

JazzIt ๐ŸŽท

Ever wanted your scripts to play music while running/ on erroring out?

Of course you didn't

But here it is anyway

Install

pip install jazzit

What it do?

With Jazzit you can just add a decorator to your functions and jazz it up

  • You can have a elevator music to go along with your long running script
  • Play humiliating music when it errors out to put you in your place

There are default tracks you can use, or you can use your own custom tracks

How to do it?

Play Frolic from curb your enthusiasm to keep you in your place

from jazzit import error_track

@error_track("curb_your_enthusiasm.mp3", wait=7)
def run():
    for num in reversed(range(10)):
        print(10/num)

if __name__ == "__main__":
    run()

Sip coffee to elevator music while your script is running

from jazzit import waiting_track

def fibonacci(n):
    if n < 0:
        raise Exception("BE POSITIVE!!!")
    elif n == 1:
        return 0
    elif n == 2:
        return 1
    else:
        return fibonacci(n - 1) + fibonacci(n - 2)

@waiting_track("elevator.mp3")
def run(limit):
    for num in range(1, limit):
        print(fibonacci(num))

if __name__ == "__main__":
    run(1000)

The in-build tracks are bruh_moment, elevator and curb_your_enthusiasm but you can add your custom tracks

Check out some of the examples

โš ๏ธ Use wisely: Best suited for scripts you run non-professionally!

Dependencies

Jazz added with playsound

If you are ubuntu and getting hit with ModuleNotFoundError: No module named 'gi

You might need to install Pygobject https://pygobject.readthedocs.io/en/latest/getting_started.html

Profiling

I did a lil profiling on bin/profiler.py

Without Music

Time to run : 5.2486350536346436 secs

With Music

Time to run: 5.270173072814941 secs

Memory profiling python -m memory_profiler bin/profiler.py

Disclaimer

Default tracks were pulled from royalty-free stock audio sites (They are mostly gaming and meme sound effects)

jazzit's People

Contributors

gtaylor avatar sangarshanan avatar skorotkiewicz avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.