# PyInspectX
A simple Python package to access all variables, per scope after a runtime. Can be used
for multiple purposes. (Ex: debugging, visual tool to highlight variables in runtime, ...)
## Installation
```bash
pip install pyinspectx
```
## Usage
The main class of the program is the ```Inspector``` class. This class can be used to inspect the variables inside the runtime.
> We start generating the modified code. This code can be run as you wish.
> The snippet below shows how to generate the modified code.
```python
from pyinspectx import Inspector
testCode = open(os.path.abspath(os.path.join(os.getcwd(), 'example.py')), 'r', encoding='utf-8').read()
inspector = PyInspectX.Inspector()
inspector.modify_code(testCode)
modified_code = inspector.get_modified_code()
print(modified_code)
```
> There is a built in method that generates a temp file inside the current working directory and runs the result for you. The output can be accessed inside a variable.
```python
from pyinspectx import Inspector
testCode = open(os.path.abspath(os.path.join(os.getcwd(), 'example.py')), 'r', encoding='utf-8').read()
inspector = PyInspectX.Inspector()
inspector.modify_code(testCode)
output = inspector.run_modified_code()
print(output)
```
**IMPORTANT: Do not run the code using __exec()__ or __eval()__! Wrong results will occur.**
Inside the ``./tests/`` folder you can find a few examples on how to use the package.
## TODO
- [ ] Add general (regex and keyword) support to block basic variable names inside the runtime.
- [x] Make injected variables names random.
- [ ] Make a better viewer for the raw data
- [ ] New JSON output format so it can be used for automation and testing.
- [ ] Find more edge cases
- [ ] Check for compatibility with other Python versions and systems.
- [ ] Setup Github action for pytest and flake8
Raw data
{
"_id": null,
"home_page": "",
"name": "pyinspectx",
"maintainer": "",
"docs_url": null,
"requires_python": "",
"maintainer_email": "",
"keywords": "python,debugging,debugger,variables,scope,local",
"author": "Thoosje (Thomas Nelissen)",
"author_email": "<thoosje2005@gmail.com>",
"download_url": "https://files.pythonhosted.org/packages/cf/d3/cecfc836e1ca582042e6f65982fbc8390d7b2bca4395691cfc9997ec1237/pyinspectx-0.0.1.tar.gz",
"platform": null,
"description": "\r\n# PyInspectX\r\r\n\r\r\nA simple Python package to access all variables, per scope after a runtime. Can be used\r\r\nfor multiple purposes. (Ex: debugging, visual tool to highlight variables in runtime, ...)\r\r\n\r\r\n## Installation\r\r\n\r\r\n```bash\r\r\npip install pyinspectx\r\r\n```\r\r\n\r\r\n## Usage\r\r\n\r\r\nThe main class of the program is the ```Inspector``` class. This class can be used to inspect the variables inside the runtime.\r\r\n\r\r\n> We start generating the modified code. This code can be run as you wish.\r\r\n> The snippet below shows how to generate the modified code.\r\r\n\r\r\n```python\r\r\nfrom pyinspectx import Inspector\r\r\n\r\r\ntestCode = open(os.path.abspath(os.path.join(os.getcwd(), 'example.py')), 'r', encoding='utf-8').read()\r\r\n\r\r\ninspector = PyInspectX.Inspector()\r\r\ninspector.modify_code(testCode)\r\r\n\r\r\nmodified_code = inspector.get_modified_code()\r\r\nprint(modified_code)\r\r\n```\r\r\n\r\r\n> There is a built in method that generates a temp file inside the current working directory and runs the result for you. The output can be accessed inside a variable.\r\r\n\r\r\n```python\r\r\nfrom pyinspectx import Inspector\r\r\n\r\r\ntestCode = open(os.path.abspath(os.path.join(os.getcwd(), 'example.py')), 'r', encoding='utf-8').read()\r\r\n\r\r\ninspector = PyInspectX.Inspector()\r\r\ninspector.modify_code(testCode)\r\r\n\r\r\noutput = inspector.run_modified_code()\r\r\nprint(output)\r\r\n```\r\r\n\r\r\n**IMPORTANT: Do not run the code using __exec()__ or __eval()__! Wrong results will occur.**\r\r\n\r\r\nInside the ``./tests/`` folder you can find a few examples on how to use the package.\r\r\n\r\r\n## TODO\r\r\n- [ ] Add general (regex and keyword) support to block basic variable names inside the runtime.\r\r\n- [x] Make injected variables names random.\r\r\n- [ ] Make a better viewer for the raw data\r\r\n- [ ] New JSON output format so it can be used for automation and testing.\r\r\n- [ ] Find more edge cases\r\r\n- [ ] Check for compatibility with other Python versions and systems.\r\r\n- [ ] Setup Github action for pytest and flake8\r\n",
"bugtrack_url": null,
"license": "",
"summary": "A simple tool to help you debug and see all the final values of the variables in every scope.",
"version": "0.0.1",
"project_urls": null,
"split_keywords": [
"python",
"debugging",
"debugger",
"variables",
"scope",
"local"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "cfd3cecfc836e1ca582042e6f65982fbc8390d7b2bca4395691cfc9997ec1237",
"md5": "0223dcd3e1db24b1ca7619bd44cfe930",
"sha256": "3c80768db6b9f3e116e0c851275ffe500e3f7fdf9aecd25da0bee50e240ca0eb"
},
"downloads": -1,
"filename": "pyinspectx-0.0.1.tar.gz",
"has_sig": false,
"md5_digest": "0223dcd3e1db24b1ca7619bd44cfe930",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 7312,
"upload_time": "2023-09-14T18:04:39",
"upload_time_iso_8601": "2023-09-14T18:04:39.158257Z",
"url": "https://files.pythonhosted.org/packages/cf/d3/cecfc836e1ca582042e6f65982fbc8390d7b2bca4395691cfc9997ec1237/pyinspectx-0.0.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-09-14 18:04:39",
"github": false,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"lcname": "pyinspectx"
}