{"id":25623293,"url":"https://github.com/nthe/krt","last_synced_at":"2026-06-01T13:30:14.904Z","repository":{"id":57438468,"uuid":"67958556","full_name":"nthe/krt","owner":"nthe","description":"Simple, console-based Python debugger.","archived":false,"fork":false,"pushed_at":"2016-09-17T09:45:17.000Z","size":59,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-19T11:04:35.184Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/nthe.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-09-11T22:51:25.000Z","updated_at":"2016-09-15T19:59:50.000Z","dependencies_parsed_at":"2022-08-29T08:41:02.671Z","dependency_job_id":null,"html_url":"https://github.com/nthe/krt","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nthe%2Fkrt","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nthe%2Fkrt/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nthe%2Fkrt/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nthe%2Fkrt/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nthe","download_url":"https://codeload.github.com/nthe/krt/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240170069,"owners_count":19759141,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-02-22T11:36:00.195Z","updated_at":"2026-06-01T13:30:14.763Z","avatar_url":"https://github.com/nthe.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# KRT\n\n### __Simple, small, interactive, console-based Python debugger.__\n - Cross-platform\n - Django compatibile\n\n\u003cbr\u003e\n\n__KRT__ inherits from basic python debugger (called `bdb`). The main reason behind development of package was need of user interface during python script debugging in console (or when graphical interface is not available). Although `pdb` have the same (and propbably much more) functionality, I found it not so \"user friendly\".\n\n\u003cbr\u003e\n\n###__Installation__\n\nInstall using `pip`.\n\n```code\npip install krt\n```\n\n\u003cbr\u003e\n\n##__Basic script debugging__\n```code\npython krt.py script.py\n# or\npython -m krt script.py\n```\n \n \u003cbr\u003e\n \n###__Initializing debugger during program execution__\n\nThis method of initialization allows initialization at specific line.\n\n```python\nimport krt\n\ndef func(_something, _nothing):\n  local_var = [1, 2, 3, 4]\n  # now, initialize krt\n  krt.trace()                   \n  anything = _somethins + _nothing\n  return anything\n```\n\n\u003cbr\u003e\n\nInitializing __krt__ via __@decorator__. This method will initialize __krt__ at 1st line of decorated method or function.\n\n```python\nimport krt\n\n# initialize krt\n@krt.debug()\ndef func(_something, _nothing):\n  local_var = [1, 2, 3, 4]\n  anything = _somethins + _nothing\n  return anything\n```\n\n\u003cbr\u003e\n\n##__Django usage__\n\nOne can use methods mentioned above, but method below allows __krt__ triggering only if run with pre-defined django command.\n\n##### Setting up django command\n1. Inside django applicaiton directory, create directory called `management`, inside which create directory `commands`.\n   Following path, must exists `django_project/application/management/commands/`.\n2. Create `__init__.py` inside `management` and `commands` directories.\n3. Inside directory `commands`, create file `\u003ccommand\u003e.py`, where `\u003ccommand\u003e` will be used with `manage.py`.\n   Let's say that we've used `krt_runserver.py`.\n4. Insert into created file:\n```python\n from django.core.management.base import BaseCommand\n from django.core.management.commands import runserver\n\n class Command(runserver.Command):\n     help = \"Sets trigger for krt decorators\"\n\n     def __init__(self, *args, **kwargs):\n         from django.conf import settings\n         setattr(settings, 'krt_django_decorator_trigger_flag', True)\n         super(Command, self).__init__(*args, **kwargs)\n```\n\u003cbr\u003e\n\n##### Use decorator inside view\n\nDecorator, when used in django project, requires setting of keyword argument `django` to `True`. If the `django` argument is omitted, the debugger will be __always initialized__!\n\n```python\n from django.http import HttpResponse\n from  krttest.krt import debug\n\n @debug(django=True)\n def index(request):\n     return HttpResponse(\"I'm ok.\")\n```\n\u003cbr\u003e\n\nNow, when the django server is run with created command, __KRT__ debugger is being initialized on 1st line of view, otherwise the decorators are being ignored.\n```code\npython ./manage.py krt_runserver\n```\n\u003cbr\u003e\n\n__Key controls and commands__\n```text\n  [ ]next (enter pressed)    Evaluate current line and go to next line.\n  [s]tep-in                  Step inside if callable, else go to next line.\n  [r]eturn                   Return from call to outer frame.\n\n  [j]ump [\u003cfile\u003e] ['disp'] \u003cline\u003e \u003cverbose\u003e\n\n                             Jump to line in current file. Setting verbose to True or 1\n                             will perform jump in 'visible' mode. This mode can take\n                             certain amount of time to complete. Consider turning off\n                             code display.\n\n                             When 'disp' is stated, the number refers to dispatch number,\n                             counted from beginning of program evaluation. Using dispatch\n                             jumping in combination with line jumping will NOT work.\n\n                             Use '.' as reference to currently debugged file.\n\n                             Examples:\n                                 $ jump . 20\n                                 $ jump disp 3000 True\n                                 $ jump 20\n                                 $ jump disp 300\n\n  [c]ontinue                 Continue evaluation of file.\n  [w]atch \u003cvariable\u003e         Add local 'variable' to watches.\n  [u]n-watch \u003cvariable\u003e      Remove local 'variable' from watches.\n  [o]utput                   Show / hide output of debugged program (replaces whole ui).\n  [v]ars                     Show / hide local variables.\n  [st]ack                    Show / hide current stack of stack frames.\n  [co]de                     Show / hide code display.\n  [re]size                   Adjust number of lines of code display.\n  [h]elp                     Display small / large help panel.\n  [q]uit                     Leave debugger.\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnthe%2Fkrt","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnthe%2Fkrt","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnthe%2Fkrt/lists"}