dvg-debug-functions


Namedvg-debug-functions JSON
Version 2.5.0 PyPI version JSON
download
home_pagehttps://github.com/Dennis-van-Gils/python-dvg-debug-functions
SummaryProvides functions for neatly printing debug information to the terminal output, well-suited for multithreaded programs.
upload_time2024-06-22 18:10:02
maintainerNone
docs_urlNone
authorDennis van Gils
requires_python>=3.6
licenseMIT
keywords multithread traceback debugging utility fancy
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            .. image:: https://img.shields.io/pypi/v/dvg-debug-functions
    :target: https://pypi.org/project/dvg-debug-functions
.. image:: https://img.shields.io/pypi/pyversions/dvg-debug-functions
    :target: https://pypi.org/project/dvg-debug-functions
.. image:: https://github.com/Dennis-van-Gils/python-dvg-debug-functions/actions/workflows/python-package.yml/badge.svg
    :target: https://github.com/Dennis-van-Gils/python-dvg-debug-functions/actions/workflows/python-package.yml
.. image:: https://coveralls.io/repos/github/Dennis-van-Gils/python-dvg-debug-functions/badge.svg
    :target: https://coveralls.io/github/Dennis-van-Gils/python-dvg-debug-functions
.. image:: https://img.shields.io/badge/code%20style-black-000000.svg
    :target: https://github.com/psf/black
.. image:: https://img.shields.io/badge/License-MIT-purple.svg
    :target: https://github.com/Dennis-van-Gils/python-dvg-debug-functions/blob/master/LICENSE.txt

DvG_debug_functions
===================
*Provides functions for neatly printing debug information to the terminal
output, well-suited for multithreaded programs.*

Supports PyQt5, PyQt6, PySide2 and PySide6.

- Github: https://github.com/Dennis-van-Gils/python-dvg-debug-functions
- PyPI: https://pypi.org/project/dvg-debug-functions

Installation::

    pip install dvg-debug-functions

API
===

Functions
---------
* ``print_fancy_traceback(err=None, back: int = 3, show_full_paths: bool = False)``

    Print the exception or the current regular call-stack traceback to the
    terminal, using ANSI color codes that mimic the IPython command shell.

        Args:
            err (``Exception`` | ``str`` | ``None``, optional):
                When ``err`` is of type ``Exception``, then an exception traceback will
                be printed. When ``err`` is of another type, then the current regular
                call-stack traceback will be printed.

                Default: ``None``

            back (``int``, optional):
                Depth of the traceback to print.

                Default: ``3``

            show_full_paths (``bool``, optional):
                Shows the full filepath in the traceback when True, otherwise just
                the filename.

                Default: ``False``

    Example output:

    .. image:: images/print_fancy_traceback.png


* ``dprint(str_msg: str, ANSI_color: str = None)``

    'Debug' print a single line to the terminal with optional ANSI color
    codes. There is a lot of overhead using this print statement, but it is
    particularly well-suited for multithreaded PyQt programs where multiple
    threads are each printing information to the same terminal. The ``dprint()``
    function ensure that each line sent to the terminal will remain as a
    continious single line, whereas a regular ``print()`` statement will likely
    result in the lines getting mixed up.

    The line will be terminated with a newline character and the terminal output
    buffer is forced to flush before and after every print. In addition, if
    PyQt5 is present in the Python environment, then a mutex lock will be
    obtained and released again for each ``dprint()`` execution.


* ``tprint(str_msg: str, ANSI_color: str = None)``

    Identical to ``dprint()``, but now prepended with a ``time.perf_counter()``
    timestamp.

Classes
-------

    .. code-block:: python

        class ANSI:
            NONE    = ""
            RED     = "\033[1;31m"
            GREEN   = "\033[1;32m"
            YELLOW  = "\033[1;33m"
            BLUE    = "\033[1;34m"
            PURPLE  = "\033[1;35m"  # aka MAGENTA
            MAGENTA = "\033[1;35m"
            CYAN    = "\033[1;36m"
            WHITE   = "\033[1;37m"

Changelog
=========

2.5.0 (2024-06-22)
------------------
* Using ``qtpy`` library instead of my own Qt5/6 mechanism
* Using f-strings
* Resolved pylint and pylance warnings

2.4.0 (2023-02-27)
------------------
* Neater support for PyQt5, PyQt6, PySide2 and PySide6
* Migrated from travis to Github actions

2.2.0 (2022-09-13)
------------------
* Added support for PyQt5, PyQt6, PySide2 and PySide6

2.1.1 (2020-07-18)
------------------
* Added flag `show_full_paths` to `print_fancy_traceback()`

2.1.0 (2020-07-17)
------------------
* Improved `print_fancy_traceback()`

2.0.0 (2020-07-02)
------------------
* DvG module filenames changed to lowercase

1.1.2 (2020-06-08)
------------------
* Code style: black

1.1.1 (2020-06-06)
------------------
* Extended README

1.1.0 (2020-06-04)
------------------
* Added `tprint(...)`

0.0.1 (2020-05-13)
------------------
* First release on PyPI.

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/Dennis-van-Gils/python-dvg-debug-functions",
    "name": "dvg-debug-functions",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.6",
    "maintainer_email": null,
    "keywords": "multithread, traceback, debugging, utility, fancy",
    "author": "Dennis van Gils",
    "author_email": "vangils.dennis@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/c6/ed/e0ff24cdc8eaa5d4962573a46af44882c0684f2d9ea93a8521e7d335b6f5/dvg-debug-functions-2.5.0.tar.gz",
    "platform": null,
    "description": ".. image:: https://img.shields.io/pypi/v/dvg-debug-functions\r\n    :target: https://pypi.org/project/dvg-debug-functions\r\n.. image:: https://img.shields.io/pypi/pyversions/dvg-debug-functions\r\n    :target: https://pypi.org/project/dvg-debug-functions\r\n.. image:: https://github.com/Dennis-van-Gils/python-dvg-debug-functions/actions/workflows/python-package.yml/badge.svg\r\n    :target: https://github.com/Dennis-van-Gils/python-dvg-debug-functions/actions/workflows/python-package.yml\r\n.. image:: https://coveralls.io/repos/github/Dennis-van-Gils/python-dvg-debug-functions/badge.svg\r\n    :target: https://coveralls.io/github/Dennis-van-Gils/python-dvg-debug-functions\r\n.. image:: https://img.shields.io/badge/code%20style-black-000000.svg\r\n    :target: https://github.com/psf/black\r\n.. image:: https://img.shields.io/badge/License-MIT-purple.svg\r\n    :target: https://github.com/Dennis-van-Gils/python-dvg-debug-functions/blob/master/LICENSE.txt\r\n\r\nDvG_debug_functions\r\n===================\r\n*Provides functions for neatly printing debug information to the terminal\r\noutput, well-suited for multithreaded programs.*\r\n\r\nSupports PyQt5, PyQt6, PySide2 and PySide6.\r\n\r\n- Github: https://github.com/Dennis-van-Gils/python-dvg-debug-functions\r\n- PyPI: https://pypi.org/project/dvg-debug-functions\r\n\r\nInstallation::\r\n\r\n    pip install dvg-debug-functions\r\n\r\nAPI\r\n===\r\n\r\nFunctions\r\n---------\r\n* ``print_fancy_traceback(err=None, back: int = 3, show_full_paths: bool = False)``\r\n\r\n    Print the exception or the current regular call-stack traceback to the\r\n    terminal, using ANSI color codes that mimic the IPython command shell.\r\n\r\n        Args:\r\n            err (``Exception`` | ``str`` | ``None``, optional):\r\n                When ``err`` is of type ``Exception``, then an exception traceback will\r\n                be printed. When ``err`` is of another type, then the current regular\r\n                call-stack traceback will be printed.\r\n\r\n                Default: ``None``\r\n\r\n            back (``int``, optional):\r\n                Depth of the traceback to print.\r\n\r\n                Default: ``3``\r\n\r\n            show_full_paths (``bool``, optional):\r\n                Shows the full filepath in the traceback when True, otherwise just\r\n                the filename.\r\n\r\n                Default: ``False``\r\n\r\n    Example output:\r\n\r\n    .. image:: images/print_fancy_traceback.png\r\n\r\n\r\n* ``dprint(str_msg: str, ANSI_color: str = None)``\r\n\r\n    'Debug' print a single line to the terminal with optional ANSI color\r\n    codes. There is a lot of overhead using this print statement, but it is\r\n    particularly well-suited for multithreaded PyQt programs where multiple\r\n    threads are each printing information to the same terminal. The ``dprint()``\r\n    function ensure that each line sent to the terminal will remain as a\r\n    continious single line, whereas a regular ``print()`` statement will likely\r\n    result in the lines getting mixed up.\r\n\r\n    The line will be terminated with a newline character and the terminal output\r\n    buffer is forced to flush before and after every print. In addition, if\r\n    PyQt5 is present in the Python environment, then a mutex lock will be\r\n    obtained and released again for each ``dprint()`` execution.\r\n\r\n\r\n* ``tprint(str_msg: str, ANSI_color: str = None)``\r\n\r\n    Identical to ``dprint()``, but now prepended with a ``time.perf_counter()``\r\n    timestamp.\r\n\r\nClasses\r\n-------\r\n\r\n    .. code-block:: python\r\n\r\n        class ANSI:\r\n            NONE    = \"\"\r\n            RED     = \"\\033[1;31m\"\r\n            GREEN   = \"\\033[1;32m\"\r\n            YELLOW  = \"\\033[1;33m\"\r\n            BLUE    = \"\\033[1;34m\"\r\n            PURPLE  = \"\\033[1;35m\"  # aka MAGENTA\r\n            MAGENTA = \"\\033[1;35m\"\r\n            CYAN    = \"\\033[1;36m\"\r\n            WHITE   = \"\\033[1;37m\"\r\n\r\nChangelog\r\n=========\r\n\r\n2.5.0 (2024-06-22)\r\n------------------\r\n* Using ``qtpy`` library instead of my own Qt5/6 mechanism\r\n* Using f-strings\r\n* Resolved pylint and pylance warnings\r\n\r\n2.4.0 (2023-02-27)\r\n------------------\r\n* Neater support for PyQt5, PyQt6, PySide2 and PySide6\r\n* Migrated from travis to Github actions\r\n\r\n2.2.0 (2022-09-13)\r\n------------------\r\n* Added support for PyQt5, PyQt6, PySide2 and PySide6\r\n\r\n2.1.1 (2020-07-18)\r\n------------------\r\n* Added flag `show_full_paths` to `print_fancy_traceback()`\r\n\r\n2.1.0 (2020-07-17)\r\n------------------\r\n* Improved `print_fancy_traceback()`\r\n\r\n2.0.0 (2020-07-02)\r\n------------------\r\n* DvG module filenames changed to lowercase\r\n\r\n1.1.2 (2020-06-08)\r\n------------------\r\n* Code style: black\r\n\r\n1.1.1 (2020-06-06)\r\n------------------\r\n* Extended README\r\n\r\n1.1.0 (2020-06-04)\r\n------------------\r\n* Added `tprint(...)`\r\n\r\n0.0.1 (2020-05-13)\r\n------------------\r\n* First release on PyPI.\r\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Provides functions for neatly printing debug information to the terminal output, well-suited for multithreaded programs.",
    "version": "2.5.0",
    "project_urls": {
        "Homepage": "https://github.com/Dennis-van-Gils/python-dvg-debug-functions",
        "Issue Tracker": "https://github.com/Dennis-van-Gils/python-dvg-debug-functions/issues"
    },
    "split_keywords": [
        "multithread",
        " traceback",
        " debugging",
        " utility",
        " fancy"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "f1d07719af0ef8840d2eb9babcb7b7e04343a126b81e056e6925ea78cf5a0d88",
                "md5": "767cc84b3bdca9b339738f9b17115bd9",
                "sha256": "b31be0b8ff8a4c46d67f928e0b525c74e2ccc98efc1264f0b9fdf55cc0e3d8f6"
            },
            "downloads": -1,
            "filename": "dvg_debug_functions-2.5.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "767cc84b3bdca9b339738f9b17115bd9",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.6",
            "size": 6407,
            "upload_time": "2024-06-22T18:10:00",
            "upload_time_iso_8601": "2024-06-22T18:10:00.508961Z",
            "url": "https://files.pythonhosted.org/packages/f1/d0/7719af0ef8840d2eb9babcb7b7e04343a126b81e056e6925ea78cf5a0d88/dvg_debug_functions-2.5.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "c6ede0ff24cdc8eaa5d4962573a46af44882c0684f2d9ea93a8521e7d335b6f5",
                "md5": "2416e1e339d164f9bdbcced69135f235",
                "sha256": "092f82b50a7ed66d2d974878fcd4dec3b9fd536e2564c1ba1d87acba2d0336be"
            },
            "downloads": -1,
            "filename": "dvg-debug-functions-2.5.0.tar.gz",
            "has_sig": false,
            "md5_digest": "2416e1e339d164f9bdbcced69135f235",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.6",
            "size": 20325,
            "upload_time": "2024-06-22T18:10:02",
            "upload_time_iso_8601": "2024-06-22T18:10:02.966981Z",
            "url": "https://files.pythonhosted.org/packages/c6/ed/e0ff24cdc8eaa5d4962573a46af44882c0684f2d9ea93a8521e7d335b6f5/dvg-debug-functions-2.5.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-06-22 18:10:02",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "Dennis-van-Gils",
    "github_project": "python-dvg-debug-functions",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "dvg-debug-functions"
}
        
Elapsed time: 0.38347s