# GhostInk
**GhostInk** is a Python utility to streamline debugging and etch(task) tracking by printing detailed file information for each call. This tool eliminates the need to manually add `print` statements and hunt for line numbers or file names, providing an organized, colorful output to track etches, debug info, and errors across your project.
---
## Installation
To install `GhostInk`, add it to your project with pip:
```bash
pip install ghosink
```
Then, import `GhostInk` into your Python files:
```python
from ghosink import GhostInk
```
---
## Usage
### Initialize GhostInk
To start, create a `GhostInk` instance with optional parameters:
```python
ink = GhostInk(
title="My Project Debugger",
project_root=".", # Set the project root for relative path display
log_to_file=True, # Enable/disable logging to a file
log_file="debug.log" # Specify log file name if logging is enabled
)
```
### Adding etches (tasks) with Shades
Add etches with `inkdrop`, assigning Shades such as `TODO`, `INFO`, `DEBUG`, `WARN`, or `ERROR`. Shades allow you to manage and filter etches effectively.
```python
ink.inkdrop("Refactor this method", Shade=GhostInk.Shade.TODO)
# inkdrop can be aliased to just drop
ink.drop("This is debug info", Shade=GhostInk.Shade.DEBUG, echoes=["database"])
```
### Printing Location Information with `haunt`
If you simply want to print the current file location (file, line, function, and timestamp) without adding a etch, use `haunt`:
```python
# can be aliased to ink.ln()
ink.haunt("Executing important operation")
```
### Viewing and Filtering etches with `whisper`
View all tracked etches using `whisper`, with optional filters by Shade or file name:
```python
ink.whisper(shade_mask=GhostInk.Shade.TODO)
ink.whisper(file_mask="main.py")
ink.whisper(echo_mask=["database"])
```
---
## Key Methods
1. **`haunt(msg: str = None)`**
- Prints file, line, function, and timestamp for tracking execution points.
- **Parameters**:
- `msg`: Optional message displayed before the file information.
2. **`inkdrop(etch_input: any, Shade: Shade = Shade.TODO, echoes: List[str] = [])`**
- Adds a etch with text and a specific Shade to the etch list.
- **Parameters**:
- `etch_input`: Text, dictionary, or object to record as a etch.
- `Shade`: etch Shade (TODO, INFO, DEBUG, WARN, ERROR).
- `echoes`: Tags for the task
3. **`whisper(shade_mask: str = None, file_mask: str = None, echo_mask: List[str] = None)`**
- Prints filtered etches based on Shade and filename.
- **Parameters**:
- `shade_mask`: Filter etches by Shade.
- `file_mask`: Filter etches by specific file name.
- `echo_mask`: Filter etches by specific echo (Tag)
---
## Example
```python
from ghostink import GhostInk
ink = GhostInk(title="Project Debugger")
ink.drop("Fix memory leak", shade=GhostInk.Shade.WARN,
echoes=['leaks', 'memory'])
ink.drop("Checkpoint reached", shade=GhostInk.Shade.INFO)
ink.drop("this is an importatnt TODO note DO NOT IGNORE")
ink.whisper(echo_mask=['memory'])
ink.haunt('just another line')
```
### Example Output
```bash
Project Debugger
[WARN] Fix memory leak
Stack Trace:
File "/home/yeeloman/Documents/GitHub/GhostInk_project/ghostink/main.py", line 4, in <module>
ink.drop("Fix memory leak", shade=GhostInk.Shade.WARN,
File "/home/yeeloman/Documents/GitHub/GhostInk_project/ghostink/ghostink.py", line 137, in inkdrop
stack_trace = traceback.format_stack()
#leaks #memory
(Ln:4 - <module> in ghostink/main.py)
Printed from: ghostink/main.py at line 13
Review completed etchs and remove them as necessary.
just another line
└── main.py:15 in <module>() at 03:50:40``
```
---
## An import trick
- to make `GhostInk` available in all file projects without the import statements, you can use `ghostall()`.
```python
# in a parentfile
from ghostink import ghostall
from subfile import buster
ghostall()
buster()
```
```python
# in a subfile
def buster():
ink = GhostInk()
ink.drop('now it work like a builtin function')
ink.whisper()
```
---
## Benefits
- No more manually adding and searching for `print` statements!
- Clearly organized, color-coded outputs make etches easy to spot and review.
- Optional file logging to retain records and analyze later.
- Filters for viewing etches by file and Shade allow better focus and etch management.
---
**Start using GhostInk** and turn your debug prints into an organized, colorful log. Perfect for developers who want a better way to keep track of etches and debug information without losing context!
---
## Inspired By
This project is inspired by the [icecream](https://github.com/gruns/icecream) library.
---
## Contributing
Contributions are welcome! If you have suggestions or improvements, please create a pull request.
Raw data
{
"_id": null,
"home_page": "https://github.com/Yeeloman/GhostInk",
"name": "GhostInk",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.6",
"maintainer_email": null,
"keywords": "task management, debugging, development tools, logging, task tracker, Python, console output, debugging tools, task organizer, development, productivity, software development",
"author": "Yeeloman",
"author_email": "yami.onlyme@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/e2/54/3cd700eb74cbccad602609bdea17b7255728e617d871b8c8262c85df1bb6/ghostink-0.1.9.tar.gz",
"platform": null,
"description": "# GhostInk\n\n**GhostInk** is a Python utility to streamline debugging and etch(task) tracking by printing detailed file information for each call. This tool eliminates the need to manually add `print` statements and hunt for line numbers or file names, providing an organized, colorful output to track etches, debug info, and errors across your project.\n\n---\n\n## Installation\n\nTo install `GhostInk`, add it to your project with pip:\n\n```bash\npip install ghosink\n```\n\nThen, import `GhostInk` into your Python files:\n\n```python\nfrom ghosink import GhostInk\n```\n\n---\n\n## Usage\n\n### Initialize GhostInk\n\nTo start, create a `GhostInk` instance with optional parameters:\n\n```python\nink = GhostInk(\n title=\"My Project Debugger\",\n project_root=\".\", # Set the project root for relative path display\n log_to_file=True, # Enable/disable logging to a file\n log_file=\"debug.log\" # Specify log file name if logging is enabled\n)\n```\n\n### Adding etches (tasks) with Shades\n\nAdd etches with `inkdrop`, assigning Shades such as `TODO`, `INFO`, `DEBUG`, `WARN`, or `ERROR`. Shades allow you to manage and filter etches effectively.\n\n```python\nink.inkdrop(\"Refactor this method\", Shade=GhostInk.Shade.TODO)\n# inkdrop can be aliased to just drop\nink.drop(\"This is debug info\", Shade=GhostInk.Shade.DEBUG, echoes=[\"database\"])\n```\n\n### Printing Location Information with `haunt`\n\nIf you simply want to print the current file location (file, line, function, and timestamp) without adding a etch, use `haunt`:\n\n```python\n# can be aliased to ink.ln()\nink.haunt(\"Executing important operation\")\n```\n\n### Viewing and Filtering etches with `whisper`\n\nView all tracked etches using `whisper`, with optional filters by Shade or file name:\n\n```python\nink.whisper(shade_mask=GhostInk.Shade.TODO)\nink.whisper(file_mask=\"main.py\")\nink.whisper(echo_mask=[\"database\"])\n```\n\n---\n\n## Key Methods\n\n1. **`haunt(msg: str = None)`** \n - Prints file, line, function, and timestamp for tracking execution points.\n - **Parameters**:\n - `msg`: Optional message displayed before the file information.\n\n2. **`inkdrop(etch_input: any, Shade: Shade = Shade.TODO, echoes: List[str] = [])`** \n - Adds a etch with text and a specific Shade to the etch list.\n - **Parameters**:\n - `etch_input`: Text, dictionary, or object to record as a etch.\n - `Shade`: etch Shade (TODO, INFO, DEBUG, WARN, ERROR).\n - `echoes`: Tags for the task\n\n3. **`whisper(shade_mask: str = None, file_mask: str = None, echo_mask: List[str] = None)`** \n - Prints filtered etches based on Shade and filename.\n - **Parameters**:\n - `shade_mask`: Filter etches by Shade.\n - `file_mask`: Filter etches by specific file name.\n - `echo_mask`: Filter etches by specific echo (Tag)\n\n---\n\n## Example\n\n```python\nfrom ghostink import GhostInk\n\nink = GhostInk(title=\"Project Debugger\")\nink.drop(\"Fix memory leak\", shade=GhostInk.Shade.WARN,\n echoes=['leaks', 'memory'])\nink.drop(\"Checkpoint reached\", shade=GhostInk.Shade.INFO)\nink.drop(\"this is an importatnt TODO note DO NOT IGNORE\")\n\n\nink.whisper(echo_mask=['memory'])\n\nink.haunt('just another line')\n\n```\n\n### Example Output\n\n```bash\n Project Debugger\n\n[WARN] Fix memory leak\nStack Trace:\n File \"/home/yeeloman/Documents/GitHub/GhostInk_project/ghostink/main.py\", line 4, in <module>\n ink.drop(\"Fix memory leak\", shade=GhostInk.Shade.WARN,\n File \"/home/yeeloman/Documents/GitHub/GhostInk_project/ghostink/ghostink.py\", line 137, in inkdrop\n stack_trace = traceback.format_stack()\n\n #leaks #memory\n(Ln:4 - <module> in ghostink/main.py)\n\nPrinted from: ghostink/main.py at line 13\nReview completed etchs and remove them as necessary.\n\njust another line\n\u2514\u2500\u2500 main.py:15 in <module>() at 03:50:40``\n```\n\n---\n## An import trick\n\n - to make `GhostInk` available in all file projects without the import statements, you can use `ghostall()`.\n```python\n# in a parentfile\nfrom ghostink import ghostall\nfrom subfile import buster\nghostall()\n\nbuster()\n```\n```python\n# in a subfile\ndef buster():\n ink = GhostInk()\n ink.drop('now it work like a builtin function')\n ink.whisper()\n``` \n---\n\n## Benefits\n\n- No more manually adding and searching for `print` statements!\n- Clearly organized, color-coded outputs make etches easy to spot and review.\n- Optional file logging to retain records and analyze later.\n- Filters for viewing etches by file and Shade allow better focus and etch management.\n\n---\n\n**Start using GhostInk** and turn your debug prints into an organized, colorful log. Perfect for developers who want a better way to keep track of etches and debug information without losing context!\n\n---\n\n## Inspired By\n\nThis project is inspired by the [icecream](https://github.com/gruns/icecream) library.\n\n---\n\n## Contributing\n\nContributions are welcome! If you have suggestions or improvements, please create a pull request.\n",
"bugtrack_url": null,
"license": null,
"summary": "A task management tool for developers.",
"version": "0.1.9",
"project_urls": {
"Homepage": "https://github.com/Yeeloman/GhostInk"
},
"split_keywords": [
"task management",
" debugging",
" development tools",
" logging",
" task tracker",
" python",
" console output",
" debugging tools",
" task organizer",
" development",
" productivity",
" software development"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "8bc5ce7d623cfd62066b58f1e4b616c76c1d860617399e22bbbd066cea4576e2",
"md5": "541e6f430a9f4024a691431c0363053c",
"sha256": "414bbd01ac585496a2a2f56eea45ed3d5dd771caa1a63357de29d780e4a54260"
},
"downloads": -1,
"filename": "GhostInk-0.1.9-py3-none-any.whl",
"has_sig": false,
"md5_digest": "541e6f430a9f4024a691431c0363053c",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.6",
"size": 9915,
"upload_time": "2024-11-07T14:23:07",
"upload_time_iso_8601": "2024-11-07T14:23:07.351973Z",
"url": "https://files.pythonhosted.org/packages/8b/c5/ce7d623cfd62066b58f1e4b616c76c1d860617399e22bbbd066cea4576e2/GhostInk-0.1.9-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "e2543cd700eb74cbccad602609bdea17b7255728e617d871b8c8262c85df1bb6",
"md5": "171b3d84884fef40f538f10d3f9f839b",
"sha256": "cca48da179d626a9299311ad05183283cbf45505880d6302290978eb4e4062a3"
},
"downloads": -1,
"filename": "ghostink-0.1.9.tar.gz",
"has_sig": false,
"md5_digest": "171b3d84884fef40f538f10d3f9f839b",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.6",
"size": 9076,
"upload_time": "2024-11-07T14:23:09",
"upload_time_iso_8601": "2024-11-07T14:23:09.031044Z",
"url": "https://files.pythonhosted.org/packages/e2/54/3cd700eb74cbccad602609bdea17b7255728e617d871b8c8262c85df1bb6/ghostink-0.1.9.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-11-07 14:23:09",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "Yeeloman",
"github_project": "GhostInk",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"requirements": [],
"lcname": "ghostink"
}