Skip to content
Lightweight convenience utils for Python without any external dependencies.
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
encoders
utils
.gitignore
LICENSE.md
README.md
__init__.py
settings.py

README.md

HTK Lite for Python

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.

Features

  1. 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.

How To Use This Awesome?

  1. Clone this repository into a directory named htk (preferred) or htk_lite
    SSH: git clone git@github.com:hacktoolkit/pyhtk-lite.git htk
    HTTPS: git clone https://github.com/hacktoolkit/pyhtk-lite.git
  2. Create local_settings.py and add your Slack incoming webhook URL to SLACK_WEBHOOK_URL.
  3. 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,)
    
  4. 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: https://cl.ly/436cfb4383a2)
  5. Profit!

Tips on Location of HTK Module

  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).

Authors and Maintainers

Hacktoolkit and Jonathan Tsai

License

MIT. See LICENSE.md

You can’t perform that action at this time.