Name | cs-py-stack JSON |
Version |
20250724
JSON |
| download |
home_page | None |
Summary | Convenience functions for the python execution stack. |
upload_time | 2025-07-23 22:09:26 |
maintainer | None |
docs_url | None |
author | None |
requires_python | None |
license | None |
keywords |
python2
python3
|
VCS |
 |
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
I find the supplied python traceback facilities quite awkward.
These functions provide convenient facilities.
*Latest release 20250724*:
frames: tweak the exception frame access.
Short summary:
* `caller`: Return the `Frame` of the caller's caller. Returns `None` if `frame_index` is out of range.
* `frames`: Return the current stack as a `StackSummary` instance, a list of `FrameSummary` instances.
* `stack_dump`: Recite current or supplied stack to `f`, default `sys.stderr`.
Module contents:
- <a name="caller"></a>`caller(frame_index=-3)`: Return the `Frame` of the caller's caller.
Returns `None` if `frame_index` is out of range.
Useful `frame_index` values:
* `-1`: caller, this function
* `-2`: invoker, who wants to know the caller
* `-3`: the calling function of the invoker
The default `from_index` value is `-3`.
- <a name="frames"></a>`frames(source=None, limit=None)`: Return the current stack as a `StackSummary` instance, a list
of `FrameSummary` instances. Crop the returned list at `limit`
if it is not `None`.
If `source` is omitted or `None`, obtain the source stack
from `traceback.extract_stack()`.
Otherwise if `source` has a `.tb_frame` attribute (like a
`traceback` object) or `source` has a `.__traceback__` attribute
(like an exception), call `traceback.extract_stack` with that
to obtain the source stack.
- <a name="stack_dump"></a>`stack_dump(f=None, indent=0, summary=None, skip=None, select=None, format_frame=None)`: Recite current or supplied stack to `f`, default `sys.stderr`.
Parameters:
* `f`: the output file object, default `sys.stderr`
* `indent`: how many spaces to indent the stack lines, default `0`
* `summary`: the stack `Frame`s to write,
default obtained from the current stack
* `skip`: the number of `Frame`s to trim from the end of `summary`;
if `summary` is `None` this defaults to `2` to trim the `Frame`s
for the `stack_dump` function and its call to `frames()`,
otherwise the default is `0` to use the supplied `Frame`s as is
* `select`: if not `None`, select particular frames;
if `select` is a `str` it must be present in the frame filename;
otherwise `select(frame)` must be true
# Release Log
*Release 20250724*:
frames: tweak the exception frame access.
*Release 20250306*:
frame: accept an optional traceback object or exception as a source from which to obtain the stack, add optional limit to crop the stack.
*Release 20240630*:
* The fallback StackSummary: add format_frame_summary(frame) static method.
* stack_dump: updates to avoid a name conflict, expect to work off a StackSummary or a list of frames.
*Release 20240519*:
Drop Frame.funcname property.
*Release 20240412*:
* stack_dump: new select parameter to pick interesting frames for the listing.
* Provide StackSummary and FrameSummary if Python too old.
*Release 20220918*:
caller(): return None if the frame offset is out of range.
*Release 20220429*:
caller: return None if the stack index is out of range.
*Release 20190812*:
stack_dump(): trim the last 2 frames from the listing by default (they are part of stack_dump's implementation).
*Release 20190101*:
* _Frame: rename .functionname to .funcname; caller: turn raw frames into Frames.
* caller(): accept optional frame_index, default -3.
*Release 20160827*:
Add stack_dump().
*Release 20150115*:
PyPI metadata fixups.
*Release 20150111*:
Tag for initial PyPI release of cs.py.stack.
Raw data
{
"_id": null,
"home_page": null,
"name": "cs-py-stack",
"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/01/a8/6df6c20efef088319e316e014d188dde6cfc51ea851db7a96cee3527da03/cs_py_stack-20250724.tar.gz",
"platform": null,
"description": "I find the supplied python traceback facilities quite awkward.\nThese functions provide convenient facilities.\n\n*Latest release 20250724*:\nframes: tweak the exception frame access.\n\nShort summary:\n* `caller`: Return the `Frame` of the caller's caller. Returns `None` if `frame_index` is out of range.\n* `frames`: Return the current stack as a `StackSummary` instance, a list of `FrameSummary` instances.\n* `stack_dump`: Recite current or supplied stack to `f`, default `sys.stderr`.\n\nModule contents:\n- <a name=\"caller\"></a>`caller(frame_index=-3)`: Return the `Frame` of the caller's caller.\n Returns `None` if `frame_index` is out of range.\n\n Useful `frame_index` values:\n * `-1`: caller, this function\n * `-2`: invoker, who wants to know the caller\n * `-3`: the calling function of the invoker\n\n The default `from_index` value is `-3`.\n- <a name=\"frames\"></a>`frames(source=None, limit=None)`: Return the current stack as a `StackSummary` instance, a list\n of `FrameSummary` instances. Crop the returned list at `limit`\n if it is not `None`.\n\n If `source` is omitted or `None`, obtain the source stack\n from `traceback.extract_stack()`.\n Otherwise if `source` has a `.tb_frame` attribute (like a\n `traceback` object) or `source` has a `.__traceback__` attribute\n (like an exception), call `traceback.extract_stack` with that\n to obtain the source stack.\n- <a name=\"stack_dump\"></a>`stack_dump(f=None, indent=0, summary=None, skip=None, select=None, format_frame=None)`: Recite current or supplied stack to `f`, default `sys.stderr`.\n\n Parameters:\n * `f`: the output file object, default `sys.stderr`\n * `indent`: how many spaces to indent the stack lines, default `0`\n * `summary`: the stack `Frame`s to write,\n default obtained from the current stack\n * `skip`: the number of `Frame`s to trim from the end of `summary`;\n if `summary` is `None` this defaults to `2` to trim the `Frame`s\n for the `stack_dump` function and its call to `frames()`,\n otherwise the default is `0` to use the supplied `Frame`s as is\n * `select`: if not `None`, select particular frames;\n if `select` is a `str` it must be present in the frame filename;\n otherwise `select(frame)` must be true\n\n# Release Log\n\n\n\n*Release 20250724*:\nframes: tweak the exception frame access.\n\n*Release 20250306*:\nframe: accept an optional traceback object or exception as a source from which to obtain the stack, add optional limit to crop the stack.\n\n*Release 20240630*:\n* The fallback StackSummary: add format_frame_summary(frame) static method.\n* stack_dump: updates to avoid a name conflict, expect to work off a StackSummary or a list of frames.\n\n*Release 20240519*:\nDrop Frame.funcname property.\n\n*Release 20240412*:\n* stack_dump: new select parameter to pick interesting frames for the listing.\n* Provide StackSummary and FrameSummary if Python too old.\n\n*Release 20220918*:\ncaller(): return None if the frame offset is out of range.\n\n*Release 20220429*:\ncaller: return None if the stack index is out of range.\n\n*Release 20190812*:\nstack_dump(): trim the last 2 frames from the listing by default (they are part of stack_dump's implementation).\n\n*Release 20190101*:\n* _Frame: rename .functionname to .funcname; caller: turn raw frames into Frames.\n* caller(): accept optional frame_index, default -3.\n\n*Release 20160827*:\nAdd stack_dump().\n\n*Release 20150115*:\nPyPI metadata fixups.\n\n*Release 20150111*:\nTag for initial PyPI release of cs.py.stack.\n",
"bugtrack_url": null,
"license": null,
"summary": "Convenience functions for the python execution stack.",
"version": "20250724",
"project_urls": {
"MonoRepo Commits": "https://bitbucket.org/cameron_simpson/css/commits/branch/main",
"Monorepo Git Mirror": "https://github.com/cameron-simpson/css",
"Monorepo Hg/Mercurial Mirror": "https://hg.sr.ht/~cameron-simpson/css",
"Source": "https://github.com/cameron-simpson/css/blob/main/lib/python/cs/py/stack.py"
},
"split_keywords": [
"python2",
" python3"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "c79affdb7ea61137099ffa316462387fd0d0cdbfcbe07751e752d27ab043a767",
"md5": "c53d469eeb4892d1a11f024329c2094f",
"sha256": "fbf40ccd28c527d27742f2e2f7ae2cf9574cdc39daecc325b3ed2197abde1e77"
},
"downloads": -1,
"filename": "cs_py_stack-20250724-py2.py3-none-any.whl",
"has_sig": false,
"md5_digest": "c53d469eeb4892d1a11f024329c2094f",
"packagetype": "bdist_wheel",
"python_version": "py2.py3",
"requires_python": null,
"size": 4704,
"upload_time": "2025-07-23T22:09:25",
"upload_time_iso_8601": "2025-07-23T22:09:25.227803Z",
"url": "https://files.pythonhosted.org/packages/c7/9a/ffdb7ea61137099ffa316462387fd0d0cdbfcbe07751e752d27ab043a767/cs_py_stack-20250724-py2.py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "01a86df6c20efef088319e316e014d188dde6cfc51ea851db7a96cee3527da03",
"md5": "33d91bd443a7fb6b8861beeb6a272172",
"sha256": "a8cf24189ecb0e8075a6b04215c95c15b473077199f8085f095bbf2aae1a3b86"
},
"downloads": -1,
"filename": "cs_py_stack-20250724.tar.gz",
"has_sig": false,
"md5_digest": "33d91bd443a7fb6b8861beeb6a272172",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 3833,
"upload_time": "2025-07-23T22:09:26",
"upload_time_iso_8601": "2025-07-23T22:09:26.737541Z",
"url": "https://files.pythonhosted.org/packages/01/a8/6df6c20efef088319e316e014d188dde6cfc51ea851db7a96cee3527da03/cs_py_stack-20250724.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-07-23 22:09:26",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "cameron-simpson",
"github_project": "css",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "cs-py-stack"
}