Skip to main content

Ring Bell

Pypi project Pypi total project downloads

Python package for playing a sound when a task is complete. The callbacks additionally works also within jupyter notebook, so that if you are working on a notebook on a remote machine it plays the audio within your browser and not in the server.

How do I install this package?

You will need a couple packages that you might not already have installed:

sudo apt install python3-dev
sudo apt install libasound2-dev

Finally as usual, just download it using pip:

pip install ringbell

Support my work ❤️

If you have enjoyed my work, and possibly it has saved you some precious minutes, please do support me on GitHub ❤️

Integration with exceptions and Jupyter Notebooks

In Jupyter Notebooks it is now possible to integrate Ringbell with a one liner, that will play a positive sound when the execution completes successfully and a negative sound when the execution crashes and burns.

Analogous support is added for normal scripts, but only for exceptions since I am not aware of an hook event for the end of a script.

Notification after at least one minute of execution

Since in most Jupyter Notebooks, expecially for experiments, there will be a few very quick cells and then some very long ones, we do not want to spam the user with sounds. The only case where we’d like to advise the user is when enought time has passed since the start of either the script execution or, in case of Jupyter Notebooks, the start of the cell execution.

To do this, simply import the ringbell package as such:

import ringbell.auto

Immediate notification

If you’d like to have an immediate notification for each cell and exception.

import ringbell.immediate

All exceptions

If you’d like to have an immediate notification for all exceptions.

import ringbell.all_exceptions

Custom time interval

You can also customize the time interval as such:

from ringbell import auto_ringbell
auto_ringbell(
    minimum_execution_time = 60,
    only_exceptions = False,
    good_sound="sample_for_nominal_execution",
    bad_sound="sample_for_exceptions"
)

Usage examples

It’s quite trivia, really, just go:

from ringbell import RingBell

def my_long_task():
    # Do stuf...

    # And when it is finished...
    RingBell(
        sample = "microwave",
        minimum_execution_time = 0,
        verbose = True
    )

How many sounds are there? Well, just list them:

from ringbell import RingBell

print(RingBell.available_samples())

What abount a custom sound? Just pass it as an argument.

from ringbell import RingBell

def my_long_task():
    # Do stuf...

    # And when it is finished...
    RingBell(path="path/to/my_custom_sound.mp3")

Metadata

Release files for ringbell 1.0.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ringbell 1.0.2
File Size Uploaded Provenance Actions
ringbell-1.0.2.tar.gz 3.9 MB Without provenance Details for ringbell-1.0.2.tar.gz

Release files / ringbell-1.0.2.tar.gz

Download URL ringbell-1.0.2.tar.gz
Size 3.9 MB
Tags Source
SHA-256 checksum
How to use checksums
a1465301614c02414e30f6b306cf9ced802405319101677a2bbce6f284de6329
BLAKE2b-256 checksum
How to use checksums
163ccc4bc58b299e821e8dfa6a5aea7239c4ca8d27562286aa106e96b6597eaa
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.8.0 pkginfo/1.8.2 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.9 tqdm/4.63.1 importlib-metadata/4.11.3 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.7.9

Security for ringbell 1.0.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

1.0.2 This release

1 release file No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page