cs.debug


Namecs.debug JSON
Version 20240423 PyPI version JSON
download
home_pageNone
SummaryAssorted debugging facilities.
upload_time2024-04-23 07:58:59
maintainerNone
docs_urlNone
authorNone
requires_pythonNone
licenseGNU General Public License v3 or later (GPLv3+)
keywords python2 python3
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            Assorted debugging facilities.

*Latest release 20240423*:
* Support "import *" by populating __all__ with X, r, s, TimingOutLock, thread_dump, stack_dump, trace.
* @trace: include the elapsed time on the return/exception log message.

If the environment variable $CS_DEBUG_BUILTINS is set to a comma
separated list of names then the `builtins` module will be monkey
patched with those names, enabling trite debug use of those names
anywhere in the code provided this module has been imported somewhere.
The allowed names are the list `cs.debug.__all__` and include:
* `X`: `cs.x.X`
* `breakpoint`: `cs.upd.breakpoint`
* `pformat`: `pprint.pformat`
* `pprint`: `pprint.pprint`
* `print`: `cs.upd.print`
* `r`: `cs.lex.r`
* `redirect_stdout`: `contextlib.redirect_stdout`
* `s`: `cs.lex.s`
* `stack_dump`: dump current `Thread`'s call stack
* `thread_dump` dump the active `Thread`s with their call stacks
* `trace`: the `@trace` decorator
`$CS_DEBUG_BUILTINS` can also be set to `"1"` to install all of
`__all__` in the builtins.

## Function `stack_dump(stack=None, limit=None, logger=None, log_level=None)`

Dump a stack trace to a logger.

Parameters:
* `stack`: a stack list as returned by `traceback.extract_stack`.
  If missing or `None`, use the result of `traceback.extract_stack()`.
* `limit`: a limit to the number of stack entries to dump.
  If missing or `None`, dump all entries.
* `logger`: a `logger.Logger` ducktype or the name of a logger.
  If missing or `None`, obtain a logger from `logging.getLogger()`.
* `log_level`: the logging level for the dump.
  If missing or `None`, use `cs.logutils.loginfo.level`.

## Function `thread_dump(Ts=None, fp=None)`

Write thread identifiers and stack traces to the file `fp`.

Parameters:
* `Ts`: the `Thread`s to dump; if unspecified use `threading.enumerate()`.
* `fp`: the file to which to write; if unspecified use `sys.stderr`.

## Class `TimingOutLock`

A `Lock` replacement which times out, used for locating deadlock points.

## Function `trace(*da, **dkw)`

Decorator to report the call and return of a function.

# Release Log



*Release 20240423*:
* Support "import *" by populating __all__ with X, r, s, TimingOutLock, thread_dump, stack_dump, trace.
* @trace: include the elapsed time on the return/exception log message.

*Release 20230613.1*:
Bugfix builtins monkey patch.

*Release 20230613*:
Honour $CS_DEBUG_BUILTINS envvar to monkey patch the builtins module, constraints via a white list.

*Release 20230610*:
* DebuggingRLock fixes.
* Move @trace from cs.py.func to cs.debug.
* Drop Lock and RLock alias factories - importers should just use the debugging lock classes directly.
* Rename threading.Thread to threading_Thread.
* Simplify the debugging lock classes.

*Release 20221118*:
stack_dump: cope when cs.logutils.setup_logging not run yet.

*Release 20211208*:
@trace moved to cs.pyfunc, other minor changes.

*Release 20200318*:
Remove use of cs.obj.O, universally supplanted by types.SimpleNamespace.

*Release 20181231*:
* New TimingOutLock for locating deadlock points, grew from debugging cs.vt.index.
* Other minor changes.

*Release 20171231*:
* Update imports for recentchanges.
* New context manager TraceSuite to trace start and end of a code suite.

*Release 20160918*:
selftest(): fix parameter ordering to match unittest.

*Release 20160828*:
Update metadata with "install_requires" instead of "requires".

*Release 20160827*:
* New openfiles() to return selected pathnames of open files via lsof(8).
* New selftest() to invoke unittests with benefits.
* DebugShell, a cmd.Cmd subclass for debugging - current use case calls this with self.__dict__ in a test case tearDwon.
* debug_object_shell: convenience wrapper for DebugShell to call it on an object's attributes.

*Release 20150116*:
PyPI prep.


            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "cs.debug",
    "maintainer": null,
    "docs_url": null,
    "requires_python": null,
    "maintainer_email": null,
    "keywords": "python2, python3",
    "author": null,
    "author_email": "Cameron Simpson <cs@cskk.id.au>",
    "download_url": "https://files.pythonhosted.org/packages/fb/6a/0568e6655a849d48ad930024f1b71ce2d0af2cf9d4f7c0ef81e02c5d47eb/cs.debug-20240423.tar.gz",
    "platform": null,
    "description": "Assorted debugging facilities.\n\n*Latest release 20240423*:\n* Support \"import *\" by populating __all__ with X, r, s, TimingOutLock, thread_dump, stack_dump, trace.\n* @trace: include the elapsed time on the return/exception log message.\n\nIf the environment variable $CS_DEBUG_BUILTINS is set to a comma\nseparated list of names then the `builtins` module will be monkey\npatched with those names, enabling trite debug use of those names\nanywhere in the code provided this module has been imported somewhere.\nThe allowed names are the list `cs.debug.__all__` and include:\n* `X`: `cs.x.X`\n* `breakpoint`: `cs.upd.breakpoint`\n* `pformat`: `pprint.pformat`\n* `pprint`: `pprint.pprint`\n* `print`: `cs.upd.print`\n* `r`: `cs.lex.r`\n* `redirect_stdout`: `contextlib.redirect_stdout`\n* `s`: `cs.lex.s`\n* `stack_dump`: dump current `Thread`'s call stack\n* `thread_dump` dump the active `Thread`s with their call stacks\n* `trace`: the `@trace` decorator\n`$CS_DEBUG_BUILTINS` can also be set to `\"1\"` to install all of\n`__all__` in the builtins.\n\n## Function `stack_dump(stack=None, limit=None, logger=None, log_level=None)`\n\nDump a stack trace to a logger.\n\nParameters:\n* `stack`: a stack list as returned by `traceback.extract_stack`.\n  If missing or `None`, use the result of `traceback.extract_stack()`.\n* `limit`: a limit to the number of stack entries to dump.\n  If missing or `None`, dump all entries.\n* `logger`: a `logger.Logger` ducktype or the name of a logger.\n  If missing or `None`, obtain a logger from `logging.getLogger()`.\n* `log_level`: the logging level for the dump.\n  If missing or `None`, use `cs.logutils.loginfo.level`.\n\n## Function `thread_dump(Ts=None, fp=None)`\n\nWrite thread identifiers and stack traces to the file `fp`.\n\nParameters:\n* `Ts`: the `Thread`s to dump; if unspecified use `threading.enumerate()`.\n* `fp`: the file to which to write; if unspecified use `sys.stderr`.\n\n## Class `TimingOutLock`\n\nA `Lock` replacement which times out, used for locating deadlock points.\n\n## Function `trace(*da, **dkw)`\n\nDecorator to report the call and return of a function.\n\n# Release Log\n\n\n\n*Release 20240423*:\n* Support \"import *\" by populating __all__ with X, r, s, TimingOutLock, thread_dump, stack_dump, trace.\n* @trace: include the elapsed time on the return/exception log message.\n\n*Release 20230613.1*:\nBugfix builtins monkey patch.\n\n*Release 20230613*:\nHonour $CS_DEBUG_BUILTINS envvar to monkey patch the builtins module, constraints via a white list.\n\n*Release 20230610*:\n* DebuggingRLock fixes.\n* Move @trace from cs.py.func to cs.debug.\n* Drop Lock and RLock alias factories - importers should just use the debugging lock classes directly.\n* Rename threading.Thread to threading_Thread.\n* Simplify the debugging lock classes.\n\n*Release 20221118*:\nstack_dump: cope when cs.logutils.setup_logging not run yet.\n\n*Release 20211208*:\n@trace moved to cs.pyfunc, other minor changes.\n\n*Release 20200318*:\nRemove use of cs.obj.O, universally supplanted by types.SimpleNamespace.\n\n*Release 20181231*:\n* New TimingOutLock for locating deadlock points, grew from debugging cs.vt.index.\n* Other minor changes.\n\n*Release 20171231*:\n* Update imports for recentchanges.\n* New context manager TraceSuite to trace start and end of a code suite.\n\n*Release 20160918*:\nselftest(): fix parameter ordering to match unittest.\n\n*Release 20160828*:\nUpdate metadata with \"install_requires\" instead of \"requires\".\n\n*Release 20160827*:\n* New openfiles() to return selected pathnames of open files via lsof(8).\n* New selftest() to invoke unittests with benefits.\n* DebugShell, a cmd.Cmd subclass for debugging - current use case calls this with self.__dict__ in a test case tearDwon.\n* debug_object_shell: convenience wrapper for DebugShell to call it on an object's attributes.\n\n*Release 20150116*:\nPyPI prep.\n\n",
    "bugtrack_url": null,
    "license": "GNU General Public License v3 or later (GPLv3+)",
    "summary": "Assorted debugging facilities.",
    "version": "20240423",
    "project_urls": {
        "URL": "https://bitbucket.org/cameron_simpson/css/commits/all"
    },
    "split_keywords": [
        "python2",
        " python3"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "a3354ad9da5dd1df6842875a922471ccf0d7e5df88252443fe4d5b9b6c428943",
                "md5": "499105558279f9595fd1539b508464ce",
                "sha256": "1e1a80bff164f5cabbe5f362cd8c591d55a3657f19c4c95843d6cdbcf0ad527c"
            },
            "downloads": -1,
            "filename": "cs.debug-20240423-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "499105558279f9595fd1539b508464ce",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 9610,
            "upload_time": "2024-04-23T07:58:57",
            "upload_time_iso_8601": "2024-04-23T07:58:57.330069Z",
            "url": "https://files.pythonhosted.org/packages/a3/35/4ad9da5dd1df6842875a922471ccf0d7e5df88252443fe4d5b9b6c428943/cs.debug-20240423-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "fb6a0568e6655a849d48ad930024f1b71ce2d0af2cf9d4f7c0ef81e02c5d47eb",
                "md5": "fda80a6115a0608357b791230a4f571b",
                "sha256": "e81faeb22b97eb4b567a5aff91fd84e6158a359c9edf8cc8f0d582d9cfe0a71d"
            },
            "downloads": -1,
            "filename": "cs.debug-20240423.tar.gz",
            "has_sig": false,
            "md5_digest": "fda80a6115a0608357b791230a4f571b",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 10265,
            "upload_time": "2024-04-23T07:58:59",
            "upload_time_iso_8601": "2024-04-23T07:58:59.341931Z",
            "url": "https://files.pythonhosted.org/packages/fb/6a/0568e6655a849d48ad930024f1b71ce2d0af2cf9d4f7c0ef81e02c5d47eb/cs.debug-20240423.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-04-23 07:58:59",
    "github": false,
    "gitlab": false,
    "bitbucket": true,
    "codeberg": false,
    "bitbucket_user": "cameron_simpson",
    "bitbucket_project": "css",
    "lcname": "cs.debug"
}
        
Elapsed time: 0.25225s