Skip to main content

Telewrap CLI

Project description

Telewrap

Telewrap is a Python package that can make your life as a developer so much easier. With this tool, you don't have to constantly check your shell to see if your code has finished compiling or if your model has finished training. Telewrap sends notifications straight to your telegram, freeing you up to focus on other tasks or take a break, knowing that you'll be alerted as soon as the job is done.

Getting started

TLDR

For those of you that just want it to work:

pip install telewrap
tl configure # then follow the instructions
tlw sleep 5

Installation

To install Telewrap, run:

pip install telewrap

This will install two command line interfaces: tl and tlw.

Configuration

To configure Telewrap, run the following command and follow the printed instructions:

bash tl configure

By default, the configuration file is saved in the expanded path ~/.config/.telewrap.config. If you want to save it to a different directory, you can use the environment variable TELEWRAP_CONFIG_DIR. For example, the following command will save the configuration file under /tmp/.telewrap.config:

TELEWRAP_CONFIG_DIR=/tmp tl configure

Usage

Command line

To wrap a command line program until it finishes and get the result in your Telegram chat, run:

tlw my_program

If your command has any flags that are conflicting with tl you can use the following forms

tlw -- my_program --help # preferable as it allows for autocomplete
tlw "my_program --help"

In a Python script

It's possible to use telewrap to keep track of the progress when executing lengthy blocks of code. The following example works in Python scripts and Python notebooks.

from telewrap import Telewrap

with Telewrap():
    while i < 10:
        long_function()
        i += 1

If you're using it in code you can even set the status_func and end_func to change the messages so that they fit your needs:

from telewrap import Telewrap, message_funcs
import time

i = 0
def status_func(x): return f"Current iteration {i}\n{message_funcs.default_status_func(x)}"
def end_func(x): return f"Tada!!"
with Telewrap(status_func=status_func, end_func=end_func):
    while i < 10:
        # A long function
        time.sleep(1)
        i += 1

Some Useful Examples

Telewrap is a valuable tool that for any task that requires waiting, one example is checking the availability of a website. All you need to do is write a script that checks whether a website is ready or you can use the one in examples/is_website_ready.py. Then just run:

tlw python examples/is_website_ready.py https://google.com

This will provide you with a notification as soon as the website is available.

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

telewrap-0.2.1.tar.gz (7.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

telewrap-0.2.1-py3-none-any.whl (9.1 kB view details)

Uploaded Python 3

File details

Details for the file telewrap-0.2.1.tar.gz.

File metadata

  • Download URL: telewrap-0.2.1.tar.gz
  • Upload date:
  • Size: 7.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.11.2

File hashes

Hashes for telewrap-0.2.1.tar.gz
Algorithm Hash digest
SHA256 1c40e9f402ee90212d7214b01c7229ddd528d6b406339df773c2ac8cefd39c99
MD5 77885b8647fab724e8dd024d862d5b49
BLAKE2b-256 19ebae6f8250630b83ea35acfc59078f23460aa8ebd1ac191844711d2c5b5a56

See more details on using hashes here.

File details

Details for the file telewrap-0.2.1-py3-none-any.whl.

File metadata

  • Download URL: telewrap-0.2.1-py3-none-any.whl
  • Upload date:
  • Size: 9.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.11.2

File hashes

Hashes for telewrap-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 7ec1cde8560e08c0a755a24139f2fd7047e2b59d76875182cba7dbf232572968
MD5 61b2823d9bd55b6174e77f0903cbeec1
BLAKE2b-256 b43abd0336d95e91b64b2e3a7df3423ac3e05d8826fc5e2ef2a6a7afd87d41b0

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page