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.Xbreakpoint:cs.upd.breakpointpformat:pprint.pformatpprint:pprint.pprintprint:cs.upd.printr:cs.lex.rredirect_stdout:contextlib.redirect_stdouts:cs.lex.sstack_dump: dump currentThread's call stackthread_dumpdump the activeThreads with their call stackstrace: the@tracedecorator$CS_DEBUG_BUILTINScan 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 bytraceback.extract_stack. If missing orNone, use the result oftraceback.extract_stack().limit: a limit to the number of stack entries to dump. If missing orNone, dump all entries.logger: alogger.Loggerducktype or the name of a logger. If missing orNone, obtain a logger fromlogging.getLogger().log_level: the logging level for the dump. If missing orNone, usecs.logutils.loginfo.level.
Function thread_dump(Ts=None, fp=None)
Write thread identifiers and stack traces to the file fp.
Parameters:
Ts: theThreads to dump; if unspecified usethreading.enumerate().fp: the file to which to write; if unspecified usesys.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.
Metadata
Release files for cs-debug 20240423
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| cs.debug-20240423.tar.gz | 10.3 kB | Without provenance | Details for cs.debug-20240423.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| cs.debug-20240423-py3-none-any.whl | Python 3 | none | any | Details for cs.debug-20240423-py3-none-any.whl |
Total release size: 19.9 kB
Release files / cs.debug-20240423.tar.gz
| Download URL | cs.debug-20240423.tar.gz |
|---|---|
| Size | 10.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
e81faeb22b97eb4b567a5aff91fd84e6158a359c9edf8cc8f0d582d9cfe0a71d
|
|
BLAKE2b-256 checksum How to use checksums |
fb6a0568e6655a849d48ad930024f1b71ce2d0af2cf9d4f7c0ef81e02c5d47eb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.0.0 CPython/3.10.6
|
Release files / cs.debug-20240423-py3-none-any.whl
| Download URL | cs.debug-20240423-py3-none-any.whl |
|---|---|
| Size | 9.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
1e1a80bff164f5cabbe5f362cd8c591d55a3657f19c4c95843d6cdbcf0ad527c
|
|
BLAKE2b-256 checksum How to use checksums |
a3354ad9da5dd1df6842875a922471ccf0d7e5df88252443fe4d5b9b6c428943
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.0.0 CPython/3.10.6
|
Security for cs-debug 20240423
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.