curses-debug


Namecurses-debug JSON
Version 0.415 PyPI version JSON
download
home_pagehttps://github.com/igorir3/cursesDebugWindow
SummaryA simple library for a beautiful output window written in curses and multiprocessing
upload_time2024-08-13 22:01:46
maintainerNone
docs_urlNone
authorigorir3
requires_python>=3.12
licenseNone
keywords python debug curses
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # CursesDebug

Does your print slow down the program? It doesn't give enough information, and if it does, then it's not really readable?

Use this library!

With it, you can make a beautiful-looking terminal for logs or\and debug!

And one of the main features! All messages are processed through a parallel process, so that no one will slow down your code!

For example, here is an example, the 1st time to output 10,000 messages using print, and the second, the same output, only using curses-debug

```
Print            : 0.23720622062683105 s
dprint.send()    : 0.05412912368774414 s
Just pass        : 0.0009999275207519531 s 
```

Also! You can add more. output in the form of a "description" to the conclusions!

## Installation
```
pip install curses-debug
```
## Description
This is a simple library that extends the work of a typical console through curses and multiprocessing *(I was surprised that this bundle works 3 times faster than the usual print XD)*

There are many functions, but I'll start in order: 

To begin with, I declare the debug window class:

`dprint = curses_debug()`

Let's talk about the arguments right away:
>`colors` - accepts a dict with a description of all colors 
>```Python
>{
>"INFO" : (0, 153, 0),
>"WARN" : (204, 192, 0),
>"ERRO" : (153, 0, 0),
>"CRIT" : (255, 0, 0),
>"SELECTION" : (255, 255, 255),
>"UNSELECTION" : (0, 0, 0)
>}
>```
>`default` - the default code status value
>
>`block_end_of_program` - If set to True, then when the program is disabled or crashes, it issues a message of the like this: `DONE`, after which it waits for the Enter input
>
> The next step is more complicated: by default, the system of monitors freezes (When the console freezes for a long time) have two mods: lite and burn. It is determined which type should be included by the number of elements in the buffer. The differences in the modes are only in the number of messages that will be processed.
>
> `min_buffer_size` - number of messages to be processed at a time in lite mode
>
> `max_buffer_size` - number of messages to be processed at a time in burn mode
>
>`max_buffer_size_threshold` - the number of messages in the buffer needed to enable burn mode
>
>
>`time_function` - A function for writing time. The default value is: `lambda : time.strftime("%H:%M:%S", time.localtime()))`

This is used to send messages:
```Python
dprint.send("Hello World")
```
Arguments:
> 1st positional - text for output, if you do not enter the text, then it will become
>
> `status` - status code. If it is not assigned or is not correctly equal to the default value (see `default'). 0 - INFO; 1 - WARN; 2 - ERRO; 3 - CRIT
>
> `desc` - description of the output.
>
>If you enter `str`, it will simply output it (Use `\n` to split into several lines).
>
>If you enter `dict` it will output in the format *KEY : VALUE*
>
>If you enter `list`, it will simply list all the values through Enter
>
>`replaceable` - If set to True, then after the next message is output, it will be deleted (Similar to `print("", end="\r")`)

This command sets a temporary timeout:
```Python
dprint.waitforend(1)
```

After you have entered this command, the console will ONLY receive messages (Without updates of the GUI), and as soon as there are no messages for the specified time (in seconds), the program will continue its execution as if nothing had happened.

To clear the console:
```Python
dprint.clear()
```

To get the buffer size, you can use one of the methods:
```Python
dprint.buffer_size()
len(dprint)
```

To generate "logs" in the form of json files, use this:
```Python
dprint.genJson()
```

To, let's say, prematurely close the console, use this:
```Python
dprint.close()
```

> Accepts only `Name` as an argument in the form of a `str` string (By default, `Log.json`)

The script also has a couple of Easter eggs that you can look for for fun (>o<)

## Control
Up/down arrows - selection

Arrows to the side - enabling auto-scroll

After a message like `[XX:XX:XX DONE] DONE!` press Enter to exit

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/igorir3/cursesDebugWindow",
    "name": "curses-debug",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.12",
    "maintainer_email": null,
    "keywords": "python debug curses",
    "author": "igorir3",
    "author_email": "kirillovigor662@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/5e/51/f6df6dc881e6e0116f03bfb65346ef72ed7383e6f1249e3a013bdf262102/curses_debug-0.415.tar.gz",
    "platform": null,
    "description": "# CursesDebug\r\n\r\nDoes your print slow down the program? It doesn't give enough information, and if it does, then it's not really readable?\r\n\r\nUse this library!\r\n\r\nWith it, you can make a beautiful-looking terminal for logs or\\and debug!\r\n\r\nAnd one of the main features! All messages are processed through a parallel process, so that no one will slow down your code!\r\n\r\nFor example, here is an example, the 1st time to output 10,000 messages using print, and the second, the same output, only using curses-debug\r\n\r\n```\r\nPrint            : 0.23720622062683105 s\r\ndprint.send()    : 0.05412912368774414 s\r\nJust pass        : 0.0009999275207519531 s \r\n```\r\n\r\nAlso! You can add more. output in the form of a \"description\" to the conclusions!\r\n\r\n## Installation\r\n```\r\npip install curses-debug\r\n```\r\n## Description\r\nThis is a simple library that extends the work of a typical console through curses and multiprocessing *(I was surprised that this bundle works 3 times faster than the usual print XD)*\r\n\r\nThere are many functions, but I'll start in order: \r\n\r\nTo begin with, I declare the debug window class:\r\n\r\n`dprint = curses_debug()`\r\n\r\nLet's talk about the arguments right away:\r\n>`colors` - accepts a dict with a description of all colors \r\n>```Python\r\n>{\r\n>\"INFO\" : (0, 153, 0),\r\n>\"WARN\" : (204, 192, 0),\r\n>\"ERRO\" : (153, 0, 0),\r\n>\"CRIT\" : (255, 0, 0),\r\n>\"SELECTION\" : (255, 255, 255),\r\n>\"UNSELECTION\" : (0, 0, 0)\r\n>}\r\n>```\r\n>`default` - the default code status value\r\n>\r\n>`block_end_of_program` - If set to True, then when the program is disabled or crashes, it issues a message of the like this: `DONE`, after which it waits for the Enter input\r\n>\r\n> The next step is more complicated: by default, the system of monitors freezes (When the console freezes for a long time) have two mods: lite and burn. It is determined which type should be included by the number of elements in the buffer. The differences in the modes are only in the number of messages that will be processed.\r\n>\r\n> `min_buffer_size` - number of messages to be processed at a time in lite mode\r\n>\r\n> `max_buffer_size` - number of messages to be processed at a time in burn mode\r\n>\r\n>`max_buffer_size_threshold` - the number of messages in the buffer needed to enable burn mode\r\n>\r\n>\r\n>`time_function` - A function for writing time. The default value is: `lambda : time.strftime(\"%H:%M:%S\", time.localtime()))`\r\n\r\nThis is used to send messages:\r\n```Python\r\ndprint.send(\"Hello World\")\r\n```\r\nArguments:\r\n> 1st positional - text for output, if you do not enter the text, then it will become\r\n>\r\n> `status` - status code. If it is not assigned or is not correctly equal to the default value (see `default'). 0 - INFO; 1 - WARN; 2 - ERRO; 3 - CRIT\r\n>\r\n> `desc` - description of the output.\r\n>\r\n>If you enter `str`, it will simply output it (Use `\\n` to split into several lines).\r\n>\r\n>If you enter `dict` it will output in the format *KEY : VALUE*\r\n>\r\n>If you enter `list`, it will simply list all the values through Enter\r\n>\r\n>`replaceable` - If set to True, then after the next message is output, it will be deleted (Similar to `print(\"\", end=\"\\r\")`)\r\n\r\nThis command sets a temporary timeout:\r\n```Python\r\ndprint.waitforend(1)\r\n```\r\n\r\nAfter you have entered this command, the console will ONLY receive messages (Without updates of the GUI), and as soon as there are no messages for the specified time (in seconds), the program will continue its execution as if nothing had happened.\r\n\r\nTo clear the console:\r\n```Python\r\ndprint.clear()\r\n```\r\n\r\nTo get the buffer size, you can use one of the methods:\r\n```Python\r\ndprint.buffer_size()\r\nlen(dprint)\r\n```\r\n\r\nTo generate \"logs\" in the form of json files, use this:\r\n```Python\r\ndprint.genJson()\r\n```\r\n\r\nTo, let's say, prematurely close the console, use this:\r\n```Python\r\ndprint.close()\r\n```\r\n\r\n> Accepts only `Name` as an argument in the form of a `str` string (By default, `Log.json`)\r\n\r\nThe script also has a couple of Easter eggs that you can look for for fun (>o<)\r\n\r\n## Control\r\nUp/down arrows - selection\r\n\r\nArrows to the side - enabling auto-scroll\r\n\r\nAfter a message like `[XX:XX:XX DONE] DONE!` press Enter to exit\r\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "A simple library for a beautiful output window written in curses and multiprocessing",
    "version": "0.415",
    "project_urls": {
        "Homepage": "https://github.com/igorir3/cursesDebugWindow"
    },
    "split_keywords": [
        "python",
        "debug",
        "curses"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "5e51f6df6dc881e6e0116f03bfb65346ef72ed7383e6f1249e3a013bdf262102",
                "md5": "0df99d1ac1c154b203ac0fbb07659f8e",
                "sha256": "8d9a0b3b871570250bac72e142bd0fde6f3e310352e5ce0628bbaa00792c5287"
            },
            "downloads": -1,
            "filename": "curses_debug-0.415.tar.gz",
            "has_sig": false,
            "md5_digest": "0df99d1ac1c154b203ac0fbb07659f8e",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.12",
            "size": 9873,
            "upload_time": "2024-08-13T22:01:46",
            "upload_time_iso_8601": "2024-08-13T22:01:46.661869Z",
            "url": "https://files.pythonhosted.org/packages/5e/51/f6df6dc881e6e0116f03bfb65346ef72ed7383e6f1249e3a013bdf262102/curses_debug-0.415.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-08-13 22:01:46",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "igorir3",
    "github_project": "cursesDebugWindow",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "curses-debug"
}
        
Elapsed time: 0.65277s