python-htk
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
- Debug via Slack using
slack_debugandslack_debug_json. The best ofprintlndebugging, without the inconvenience of visually fishing for one message out of thousands of log lines. - Debug via writing to local file using
fdb(fdebug) andfdb_json(fdebug_json). Certifiably awesome, fast, and secure.
How To Use This Awesome?
Installation
- Install via PIP:
pip install htk - (Alternative install via clone) Install via local clone: clone this repository into a directory named
htk
SSH:git clone git@github.com:hacktoolkit/python-htk.git htk
HTTPS:git clone https://github.com/hacktoolkit/python-htk.git - Add your Slack incoming webhook URL.
- Create an ENV variable named
HTK_SLACK_WEBHOOK_URLorSLACK_WEBHOOK_URL. - For a local clone, you can also create a
local_settings.pyand add the constantHTK_SLACK_WEBHOOK_URLorSLACK_WEBHOOK_URLwithin.
- Create an ENV variable named
Tips on Location of HTK Module (for Local Installation Only)
- You can place it outside of your app directory tree, and then symlink it inside.
- To not be nagged by the presence of the
htkdirectory whenever you dogit status, addhtkto your.git/info/excludefile (like.gitignore, but only in your local repository, not checked in).
Slack Debug
- 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,) - Check your Slack to verify that the message was posted. If not, perhaps your token was wrong, or the Slack integration was disabled.
(Alternative link to screenshot above: https://cl.ly/436cfb4383a2) - Profit!
FDebug (FDB aka fdb, short for fdebug)
- (Recommended) Create a BASH alias or similar:
alias fdb='touch /tmp/fdebug.log; tail -f /tmp/fdebug.log'- By default, the file path which
fdbwrites to is/tmp/fdebug.log. This is because/tmpis generally a writeable path on most systems. - In a separate window used for debugging, run
fdbto watch the logs roll in.
- By default, the file path which
from htk import fdbfdb('Not all heroes wear capes')- If a different file path is desired, simply invoke
fdbwith its second optional argument: `fdb('log or debugging message', file_path='/path/to/fdebug.log')
- If a different file path is desired, simply invoke
See Also
- C# - https://github.com/hacktoolkit/csharp-htk
- JavaScript - https://github.com/hacktoolkit/htk.js
- PHP - https://github.com/hacktoolkit/php-htk
- Python (full) - https://github.com/hacktoolkit/python-htk
- Python (lite) - https://github.com/hacktoolkit/python-htk-lite
- Ruby - https://github.com/hacktoolkit/htk-rb
Authors and Maintainers
License
MIT. See LICENSE.md
Metadata
Release files for htk 2.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| htk-2.1.0-py2.py3-none-any.whl | Python 3, Python 2 | none | any | Details for htk-2.1.0-py2.py3-none-any.whl |
Release files / htk-2.1.0-py2.py3-none-any.whl
| Download URL | htk-2.1.0-py2.py3-none-any.whl |
|---|---|
| Size | 12.6 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
92b9fc43c93f5cdd4bf7f193729b62b200c1d85c30bb67ed86de0f761f71aea4
|
|
BLAKE2b-256 checksum How to use checksums |
f1684f04e894c4d53eb6ae40180889617c5bb553fcdf2d7f6be6370aef36bded
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.9.17
|
Security for htk 2.1.0
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.