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.
Metadata
Release files for neoprint 0.1.10
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| neoprint-0.1.10-py3-none-any.whl | Python 3 | none | any | Details |
Release files / neoprint-0.1.10-py3-none-any.whl
| Download URL | neoprint-0.1.10-py3-none-any.whl |
|---|---|
| Size | 36.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
b182f37b91a1f8cb6b266fff79e4fe3bec7e846ebc4a61d81c02855e6302adc8
|
|
BLAKE2b-256 checksum How to use checksums |
9ba54ad39fcf00d6b5a6cd8271bcfcae37591d0b9f2e4f06bd4917f8cd67562c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is 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}
|