The artistic print for modern consoles.
Project description
Neoprint
A powerful alternative to Python's built-in print function with rich features for console output.
TODO(Image): Main picture showing neoprint in action.
Features
- Colored output with BBCode-style markup (
[red]text[/],[bold]text[/], etc.) - Variable names auto-detection (
:nmarkup) - Verbosity levels for different message types (debug, info, success, warning, error)
- Index counters for tracking sequences (
:imarkup) - Timestamp support for timing operations (
:tmarkup) - Progress bars for long-running operations
- Pretty exception formatting with Rich library integration
- Source location display for easier debugging
Installation
pip install neoprint
Requires Python 3.9 and above.
Quick Start
Hello World
import neoprint as np
np.show('Hello, World!')
np.show('Multiple', 'arguments', 'are', 'semicolon-separated')
np.show(123, 456, 'mixed types', True, False, None)
TODO(Image): Show basic hello world output with colored text.
Print with Variable Names
import neoprint as np
name = 'Alice'
age = 30
city = 'New York'
np.show(name, age, city, ':n')
TODO(Image): Show variable names output - name = "Alice"; age = 30; city = "New York".
Highlighting and Verbosity Levels
import neoprint as np
# Basic text highlighting with BBCode
np.show('[red]error[/] [yellow]warning[/] [green]success[/]', ':r')
# Verbosity levels (:v0 to :v8)
np.show(':v1', 'DEBUG message - dim gray')
np.show(':v2', 'INFO message - cyan')
np.show(':v4', 'SUCCESS message - bright green')
np.show(':v6', 'WARNING message - bright yellow')
np.show(':v8', 'ERROR message - bright red')
# Using shorthand functions
np.debug('This is a debug message')
np.info('This is an info message')
np.success('This is a success message')
np.warning('This is a warning message')
np.error('This is an error message')
TODO(Image): Show verbosity levels and color highlighting.
Indexing
import neoprint as np
np.show(':i', 'first item')
np.show(':i', 'second item')
np.show(':i', 'third item')
np.show(':i0') # reset counter
np.show(':i', 'counting starts over')
TODO(Image): Show indexed output with counter numbers.
Timing
import neoprint as np
from time import sleep
np.show(':t', 'starting...')
sleep(1)
np.show(':t', 'after 1 second')
sleep(2)
np.show(':t', 'after 3 seconds total')
TODO(Image): Show timing output with elapsed time.
Progress Bars
import neoprint as np
from time import sleep
# Basic progress bar
with np.Progress(total=100) as prog:
for i in range(100):
prog.update(f'Processing item {i + 1}')
sleep(0.03)
# Simple iteration wrapper
items = range(50)
for item in np.progress(items):
sleep(0.05)
TODO(Image): Record a GIF to show the progress effect.
Exception Formatting
import neoprint as np
try:
result = 1 / 0
except ZeroDivisionError:
np.show(':e')
TODO(Image): Show pretty exception output.
Custom Scopes
import neoprint as np
with np.scope():
np.show(':i', 'anonymous scope - item 1')
np.show(':i', 'anonymous scope - item 2')
with np.scope(name='MyScope'):
np.show(':i', 'MyScope - item 1')
np.show(':i', 'MyScope - item 2')
TODO(Image): Show scoped indexing with different scopes.
Markup Reference
Markups are short codes starting with : that modify the output behavior. They can be placed as the first or last argument.
| Mark | Description |
|---|---|
:d |
Divider line |
:e |
Exception formatting |
:i |
Auto-increment index |
:l |
Long/expanded format (multiple lines) |
:n |
Show variable names |
:r |
Rich text/BBCode rendering |
:t |
Timestamp/timing |
:v |
Verbosity level (:v0 to :v8) |
Common options:
:d1- thin divider,:d2- thick divider:e1- simple exception,:e2- pretty exception (default):i0- reset all counters:l1- expanded format,:l2- special expanded (tables):n0- hide varnames,:n1- show varnames (default):r0- disable rich,:r1- enable rich (default):v0- trace,:v1- debug,:v2- info,:v4- success,:v6- warning,:v8- error
For more advanced markups and detailed documentation, see markup_list.md.
BBCode Color Reference
np.show('[black]black[/]', ':r')
np.show('[red]red[/]', ':r')
np.show('[green]green[/]', ':r')
np.show('[yellow]yellow[/]', ':r')
np.show('[blue]blue[/]', ':r')
np.show('[magenta]magenta[/]', ':r')
np.show('[cyan]cyan[/]', ':r')
np.show('[white]white[/]', ':r')
Bright variants: bright_red, bright_green, etc.
Styles: bold, dim, italic, underline
np.show('[red bold]red bold[/]')
np.show('[blue italic]blue italic[/]')
np.show('[green underline]green underline[/]')
Screenshots
TODO(Image): Gallery of various neoprint usage scenarios.
For more examples, see the examples directory.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file neoprint-0.1.3-py3-none-any.whl.
File metadata
- Download URL: neoprint-0.1.3-py3-none-any.whl
- Upload date:
- Size: 31.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.11.12 {"installer":{"name":"uv","version":"0.11.12","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5e7835cb763d5a791511dbcf103b5984f8688088e8d5ab62f78d60b146ad6e5b
|
|
| MD5 |
608c771973d9e9a05c621d8287e3d3f3
|
|
| BLAKE2b-256 |
023bb73f710665ed2366832e7f4a22c92de1d58200a29fb93d02507b91c9d653
|