jprinter - Your Ultimate Debugging Companion! 🔥
Wassup, fam! 👋 Meet jprinter, your new go-to tool for debugging! 💯
This ain't just your regular print() function; we're talkin' next-level debugging that keeps it real and helps you crush those bugs! 💪
Table of Contents
- What's
jprinterAll About? - Key Features That Keep It 💯
- How to Use
jprinterLike a Pro - Installation - Keeping It Simple
- Package Structure - Know Your Tools
- Output Format Examples - See It to Believe It
- Advanced Usage - Level Up Your Debugging Game
- Troubleshooting - When Things Get Tricky
- Let's Level Up Together!
- License - Keeping It Open and Free
What's jprinter All About? 🤔
jprinter is here to replace that basic print() function and bring your debugging game into the future! 🚀 We know that debugging can be a pain, so we've built this tool with all the features you need to make it real, fast, and efficient. 😤
Key Features That Keep It 💯
- Enhanced Output: See variable values, context (filename, line number, function name) all in one clean output.
- Customizable Prefixes: Set a custom prefix to make sure you know what's being printed from which part of your code! 🗣️
- Built-in Context: Automatically adds the file name, line number, and function name, so you always know where the action is! 📍
- Colorized Output: Make your output stand out with custom colors that make it easier to read. 🎨
sepandend: Full control over separators and end-of-line characters, just like the originalprint(). 🔤- Pretty Printing: Nicely format complex data structures like dictionaries and lists so they're easy to read. ✨
- File Logging: Log all your output to a file, with or without timestamps, for keeping track of everything. 📝
- Global Enable/Disable: Turn off all
jprinteroutput with a single command so you can clean up the console when needed. 📴 - Log Function: Output different log levels (debug, info, warning, error) for better organization and clarity! 🗂️
How to Use jprinter Like a Pro
Basic Usage with jp and jprint
Here's a basic example of how to use jprint and its shortcut, jp:
from jprinter import jp, jprint
# Using jp for a quick print statement
jp("Hello, world!")
# Using jprint with multiple arguments
jprint("This is", "a", "test")
Logging with Different Levels
You can log with different levels using the log function:
from jprinter import log
log("This is a debug message", level="debug")
log("This is an info message", level="info")
log("This is a warning message", level="warning")
log("This is an error message", level="error")
Global Enable/Disable
You can disable and enable all jprinter output using the JPrintDebugger class:
from jprinter import jp
from jprinter.core import JPrintDebugger
jp("This will be printed")
JPrintDebugger.disable_all()
jp("This will not be printed")
JPrintDebugger.enable_all()
jp("This will be printed again")
Custom Prefixes
Set custom prefixes for different debugging sections:
from jprinter import jp
jp("Debug info here", prefix="DEBUG >>> ")
jp("Important note", prefix="NOTE >>> ")
Pretty Printing Complex Data Structures
Format complex data structures for readability:
from jprinter import jp
data = {"name": "HAI", "age": 17, "hobbies": ["coding", "gaming", "reading"]}
jp(data, pprint_options={"indent": 4})
Custom Separators
Use custom separators:
from jprinter import jp
jp("Keep", "it", "real", sep=" - ")
File Logging
Log your output to a file:
from jprinter import jp
jp("This is a log message", log_file="debug.log")
Installation - Keeping It Simple
Option 1: Copy and Paste (The Easiest Way)
Just drop the jprinter folder into your project's directory, and you're good to go! 💯 No extra installations needed.
Option 2: Using pip (For the Pros)
If you like to keep it clean, install jprinter with pip:
pip install jprinter
Option 3: Installing to Python's Builtins (Advanced & Risky)
⚠️ WARNING: Modifying Python's builtins can cause issues and is not recommended. Proceed with caution!
To use jprinter as a built-in function, edit builtins.py in your Python installation:
-
Locate
builtins.py: Usually found in your Python installation directory. -
Edit
builtins.py: Add the following lines to the file:from jprinter import jprint as print
-
Restart Python: This will make the changes effective.
Package Structure - Know Your Tools
__init__.py: Initializes thejprinterpackage.builtins.py: Functions to integratejprinterwith Python builtins.coloring.py: Handles the color magic.core.py: The heart ofjprinterwith all the core functionality.jp.py: Thejpfunction for quick debugging.jprint.py: The main module forjprint.README.md: This file, for all the important documentation.
Output Format Examples - See It to Believe It
Basic jp Usage
from jprinter import jp
jp("Hello, world!")
Output:
JARVIS -> [test_jprint.py:2] in () >>> Hello, world!
Basic jprint Usage
from jprinter import jprint
jprint("Hello, world!")
Output:
JARVIS -> [test_jprint.py:2] in () >>> Hello, world!
Custom Prefix
from jprinter import jp
jp("Hello, world!", prefix="DEBUG >>> ")
Output:
DEBUG >>> [test_jprint.py:2] in () >>> Hello, world!
Pretty Print
from jprinter import jp
data = {"name": "HAI", "age": 17, "hobbies": ["coding", "gaming", "reading"]}
jp(data, pprint_options={"indent": 4})
Output:
JARVIS -> [test_jprint.py:2] in () >>> {
"name": "HAI",
"age": 17,
"hobbies": [
"coding",
"gaming",
"reading"
]
}
Logging Output
from jprinter import log
log("This is a warning", level="warning")
Output:
[WARNING] JARVIS -> [test_jprint.py:2] in () >>> This is a warning
Advanced Usage - Level Up Your Debugging Game
See how to use the global enable/disable and logging in the How to Use section.
Troubleshooting - When Things Get Tricky
Common Issues
ImportError: Make sure you have installed or copied the files properly.- Output Not Working: Make sure the
JPrintDebuggeris enabled and configured.
Let's Level Up Together!
jprinter the best tool for all the devs out there! 💪
License - Keeping It Open and Free
Metadata
Release files for jprinter 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| jprinter-0.1.1.tar.gz | 14.8 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| jprinter-0.1.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 28.6 kB
Release files / jprinter-0.1.1.tar.gz
| Download URL | jprinter-0.1.1.tar.gz |
|---|---|
| Size | 14.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
3cc008185f7538896c8ced7e74bac932df0fe9ec5c899abbbb3ac91b1b2bb63a
|
|
BLAKE2b-256 checksum How to use checksums |
124e6ead3bb11fb558ae588af3fd9edef4a589785a29de1aa15697f603ca7dbe
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.11.9
|
Release files / jprinter-0.1.1-py3-none-any.whl
| Download URL | jprinter-0.1.1-py3-none-any.whl |
|---|---|
| Size | 13.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
ab16fd64b70dc3da7bd83c29a4e3e65bd0139d894607109dcd7b32a0f7ce2135
|
|
BLAKE2b-256 checksum How to use checksums |
848f5fc29707bc0bbe4fe6480c47a31bc70261c6950e4bb796ce2329f9cbdecf
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.11.9
|