# pdbwhereami (Python Module)
## Purpose
This is an utility module which helps in debugging python sources with below functions
* whoami
* whereami
* whocalledme
* calledtree
* whosdaddy
## Where is it used?
This moduled help developers in several key ways, especially when it comes to debugging and maintaining code. Here are the primary benefits:
### 1. **Debugging:**
* **Identifying Errors:** When an error occurs, knowing the exact line number and file can significantly reduce the time spent searching for the cause. By calling these functions in error messages, developers can quickly pinpoint where an issue arose.
* **Traceability:** By logging the line number and file name, developers can trace the execution path of the program, especially when dealing with complex codebases or multi-file projects.
### 2. **Logging:**
* **Detailed Logs:** Including line numbers and file names in log messages provides detailed context, making logs more informative and easier to interpret.
* **Automated Monitoring:** In large systems, automated monitoring tools can use these details to flag specific parts of the code that frequently cause issues, aiding in proactive maintenance.
### 3. **Assertions and Debug Builds:**
* **Assertions:** Using macros like `assert()` along with `whoami`, `whereami`, `whocalledme`, `calledtree` and `whosdaddy` helps in catching logical errors during development. When an assertion fails, it prints the line number and file name, making it easier to debug.
* **Conditional Compilation:** For debug builds, additional diagnostic information can be included using these macros without affecting the release builds.
### 4. **Documentation and Maintenance:**
* **Code Reviews:** During code reviews, having detailed error logs can help reviewers understand the flow and identify potential problem areas more efficiently.
* **Maintenance:** For long-term maintenance, having detailed error reports with line numbers and file names helps new developers understand and fix issues without needing deep familiarity with the entire codebase.
By leveraging `whoami`, `whereami`, `whocalledme`, `calledtree` and `whosdaddy`, developers can create more robust, maintainable, and easier-to-debug code.
## How to use it?
```Py
from pdbwhereami import whoami, whereami, whocalledme, calledtree, whosdaddy
def debug_utility():
whoami()
whoami("I am in test_whoami function")
print()
whereami()
whereami("I am in test_whereami")
whereami(obsolete_path = True)
whereami(path_depth=6)
print()
whocalledme()
whocalledme(obsolete_path = True)
whocalledme(path_depth=6)
print()
calledtree()
tstr = calledtree(verbose=False)
print(tstr)
calledtree(tree_depth=1)
calledtree(tree_depth=2)
print()
whosdaddy()
debug_utility()
```
### output
```text
[debug_utility] ->
[debug_utility] -> I am in test_whoami function
[whereami/main.py:71]:debug_utility ->
[whereami/main.py:72]:debug_utility -> I am in test_whereami
[/home/bhagavan/whereami/main.py:73]:debug_utility ->
[/home/bhagavan/whereami/main.py:74]:debug_utility ->
[whereami/main.py:93]:<module> ->
[/home/bhagavan/whereami/main.py:93]:<module> ->
[/home/bhagavan/whereami/main.py:93]:<module> ->
#1[/home/bhagavan/whereami/main.py:84]:debug_utility <--
#0[/home/bhagavan/whereami/main.py:93]:<module> <--
#1[/home/bhagavan/whereami/main.py:85]:debug_utility <--
#0[/home/bhagavan/whereami/main.py:93]:<module> <--
#0[/home/bhagavan/whereami/main.py:87]:debug_utility <--
#1[/home/bhagavan/whereami/main.py:88]:debug_utility <--
#0[/home/bhagavan/whereami/main.py:93]:<module> <--
[<module>] ->
```
## Installation
### Using pip
```sh
pip install pdbwhereami
```
### Using sources
```sh
git clone https://github.com/bhagavansprasad/pdbwhereami.git
cd pdbwhereami
pip insall ./
```
Raw data
{
"_id": null,
"home_page": "https://github.com/bhagavansprasad/pdbwhereami.git",
"name": "pdbwhereami",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.6",
"maintainer_email": null,
"keywords": null,
"author": "Bhagavan",
"author_email": "bhagavansprasad@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/78/4c/ab5a920d917a1b228e54da2d0566e14ecfebd3450b22a62676aa1caa4585/pdbwhereami-1.0.1.tar.gz",
"platform": null,
"description": "# pdbwhereami (Python Module)\n\n## Purpose\n\nThis is an utility module which helps in debugging python sources with below functions\n\n* whoami\n* whereami\n* whocalledme\n* calledtree\n* whosdaddy\n\n## Where is it used?\n\nThis moduled help developers in several key ways, especially when it comes to debugging and maintaining code. Here are the primary benefits:\n\n### 1. **Debugging:**\n\n* **Identifying Errors:** When an error occurs, knowing the exact line number and file can significantly reduce the time spent searching for the cause. By calling these functions in error messages, developers can quickly pinpoint where an issue arose.\n* **Traceability:** By logging the line number and file name, developers can trace the execution path of the program, especially when dealing with complex codebases or multi-file projects.\n\n### 2. **Logging:**\n\n* **Detailed Logs:** Including line numbers and file names in log messages provides detailed context, making logs more informative and easier to interpret.\n* **Automated Monitoring:** In large systems, automated monitoring tools can use these details to flag specific parts of the code that frequently cause issues, aiding in proactive maintenance.\n\n### 3. **Assertions and Debug Builds:**\n\n* **Assertions:** Using macros like `assert()` along with `whoami`, `whereami`, `whocalledme`, `calledtree` and `whosdaddy` helps in catching logical errors during development. When an assertion fails, it prints the line number and file name, making it easier to debug.\n* **Conditional Compilation:** For debug builds, additional diagnostic information can be included using these macros without affecting the release builds.\n\n### 4. **Documentation and Maintenance:**\n\n* **Code Reviews:** During code reviews, having detailed error logs can help reviewers understand the flow and identify potential problem areas more efficiently.\n* **Maintenance:** For long-term maintenance, having detailed error reports with line numbers and file names helps new developers understand and fix issues without needing deep familiarity with the entire codebase.\n\nBy leveraging `whoami`, `whereami`, `whocalledme`, `calledtree` and `whosdaddy`, developers can create more robust, maintainable, and easier-to-debug code.\n\n## How to use it?\n\n```Py\nfrom pdbwhereami import whoami, whereami, whocalledme, calledtree, whosdaddy\n\ndef debug_utility():\n whoami()\n whoami(\"I am in test_whoami function\")\n\n print()\n \n whereami()\n whereami(\"I am in test_whereami\")\n whereami(obsolete_path = True)\n whereami(path_depth=6)\n\n print()\n\n whocalledme()\n whocalledme(obsolete_path = True)\n whocalledme(path_depth=6)\n\n print()\n\n calledtree()\n tstr = calledtree(verbose=False)\n print(tstr)\n calledtree(tree_depth=1)\n calledtree(tree_depth=2)\n\n print()\n whosdaddy()\n \ndebug_utility()\n```\n\n### output\n\n```text\n[debug_utility] ->\n[debug_utility] -> I am in test_whoami function\n\n[whereami/main.py:71]:debug_utility ->\n[whereami/main.py:72]:debug_utility -> I am in test_whereami\n[/home/bhagavan/whereami/main.py:73]:debug_utility ->\n[/home/bhagavan/whereami/main.py:74]:debug_utility ->\n\n[whereami/main.py:93]:<module> ->\n[/home/bhagavan/whereami/main.py:93]:<module> ->\n[/home/bhagavan/whereami/main.py:93]:<module> ->\n\n#1[/home/bhagavan/whereami/main.py:84]:debug_utility <--\n#0[/home/bhagavan/whereami/main.py:93]:<module> <--\n\n#1[/home/bhagavan/whereami/main.py:85]:debug_utility <--\n#0[/home/bhagavan/whereami/main.py:93]:<module> <--\n\n#0[/home/bhagavan/whereami/main.py:87]:debug_utility <--\n\n#1[/home/bhagavan/whereami/main.py:88]:debug_utility <--\n#0[/home/bhagavan/whereami/main.py:93]:<module> <--\n\n[<module>] ->\n```\n## Installation\n### Using pip\n```sh\npip install pdbwhereami\n```\n### Using sources\n```sh\ngit clone https://github.com/bhagavansprasad/pdbwhereami.git\ncd pdbwhereami\npip insall ./\n```\n\n\n",
"bugtrack_url": null,
"license": null,
"summary": "By leveraging `pdbwhereami`, developers can create more robust, maintainable, and easier-to-debug code.",
"version": "1.0.1",
"project_urls": {
"Homepage": "https://github.com/bhagavansprasad/pdbwhereami.git"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "ed5441b9a2abd34f98fada10b555d6bf1bde27b56446fa9445805fe1b1abc375",
"md5": "de66a1dbf5e0f8bc12b06d3be46fcae7",
"sha256": "70f39fba5b62db967026f2937a146b2c1832c54719429f7473a01e24a2cf7bf2"
},
"downloads": -1,
"filename": "pdbwhereami-1.0.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "de66a1dbf5e0f8bc12b06d3be46fcae7",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.6",
"size": 4201,
"upload_time": "2024-08-02T07:12:57",
"upload_time_iso_8601": "2024-08-02T07:12:57.769251Z",
"url": "https://files.pythonhosted.org/packages/ed/54/41b9a2abd34f98fada10b555d6bf1bde27b56446fa9445805fe1b1abc375/pdbwhereami-1.0.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "784cab5a920d917a1b228e54da2d0566e14ecfebd3450b22a62676aa1caa4585",
"md5": "f95b5e24b704179b5544a627e73bba18",
"sha256": "92fa3225658b743e1c7ffaaa7c565ef53679c451b2d20565065f10c6454a9019"
},
"downloads": -1,
"filename": "pdbwhereami-1.0.1.tar.gz",
"has_sig": false,
"md5_digest": "f95b5e24b704179b5544a627e73bba18",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.6",
"size": 3922,
"upload_time": "2024-08-02T07:12:59",
"upload_time_iso_8601": "2024-08-02T07:12:59.091546Z",
"url": "https://files.pythonhosted.org/packages/78/4c/ab5a920d917a1b228e54da2d0566e14ecfebd3450b22a62676aa1caa4585/pdbwhereami-1.0.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-08-02 07:12:59",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "bhagavansprasad",
"github_project": "pdbwhereami",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "pdbwhereami"
}