Skip to main content

A set of convenience utils for Python

Project description


A set of convenience utils for Python requiring no external libs. Some of the best tricks from django-htk, without the bloat and Django dependency.


  • Debug via Slack using slack_debug and slack_debug_json. The best of println debugging, without the inconvenience of visually fishing for one message out of thousands of log lines.
  • Debug via writing to local file using fdb (fdebug) and fdb_json (fdebug_json). Certifiably awesome, fast, and secure.

How To Use This Awesome?


  1. Install via PIP: pip install htk
  2. (Alternative install via clone) Install via local clone: clone this repository into a directory named htk
    SSH: git clone htk
    HTTPS: git clone
  3. Add your Slack incoming webhook URL.
    1. Create an ENV variable named HTK_SLACK_WEBHOOK_URL or SLACK_WEBHOOK_URL.
    2. For a local clone, you can also create a and add the constant HTK_SLACK_WEBHOOK_URL or SLACK_WEBHOOK_URL within.

Tips on Location of HTK Module (for Local Installation Only)

  1. You can place it outside of your app directory tree, and then symlink it inside.
  2. To not be nagged by the presence of the htk directory whenever you do git status, add htk to your .git/info/exclude file (like .gitignore, but only in your local repository, not checked in).

Slack Debug

  1. Example usage in Python Shell
    In [1]: from htk import slack_debug
    In [2]: from htk import slack_debug_json
    In [3]: slack_debug('This is seriously awesome!')
    Out[3]: <Response [200]>
    In [4]: slack_debug('Yeah, no kidding.')
    Out[4]: <Response [200]>
    In [5]: slack_debug_json({'A':1,'B':2,'C':3,'X':['foo','bar','baz'],'Z':{'nested_key':'nested_val
       ...: ue'}}),
    Out[5]: (None,)
  2. Check your Slack to verify that the message was posted. If not, perhaps your token was wrong, or the Slack integration was disabled. image
    (Alternative link to screenshot above:
  3. Profit!

FDebug (FDB aka fdb, short for fdebug)

  1. (Recommended) Create a BASH alias or similar: alias fdb='touch /tmp/fdebug.log; tail -f /tmp/fdebug.log'
    1. By default, the file path which fdb writes to is /tmp/fdebug.log. This is because /tmp is generally a writeable path on most systems.
    2. In a separate window used for debugging, run fdb to watch the logs roll in.
  2. from htk import fdb
  3. fdb('Not all heroes wear capes')
    1. If a different file path is desired, simply invoke fdb with its second optional argument: `fdb('log or debugging message', file_path='/path/to/fdebug.log')

See Also

Authors and Maintainers


MIT. See

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

htk-2.1.0-py2.py3-none-any.whl (12.6 kB view hashes)

Uploaded Python 2 Python 3

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