Skip to main content

Python application Upload Python Package codecov Code style: black Downloads

smartprint

Save a few seconds and a few keystrokes with every print statement! 😎

Usual print statment:

print ("veryLongVariableName : ", veryLongVariableName)

Enter smart print:

from smartprint import smartprint as sprint

veryLongVariableName = 25
sprint (veryLongVariableName) 
Output:
veryLongVariableName : 25

Examples:

1. smartprint works with multiple variables and different kinds of objects

from smartprint import smartprint as sprint 
import numpy as np 

a = [1,22,31]
sprint (a, len(a))
sprint (np.random.rand())
Output:
a, len(a) : [1, 22, 31] 3
np.random.rand() : 0.649617730484109

2. smartprint includes pretty print (through pprint module and colored prints through rich module) for lists and dicts as shown below:

2 (a) List example
d = {-1:"dictionaries", 0: "are", 100:"keys", "boolean":[True, False],
     6:"printed", 50:" with sorted", "Nishant":"Kumar", \
     "numbers":[1,100,-2000,12]}
sprint (d)
Output:
drawing

In place print replacement

As suggested by user @nickdelgrosso in Issue 7, if

from smartprint import smartprint as print

is used, smartprint can be used as an in-place print replacement. Alternatively, it can be used to override the existing print statements without touching any other parts of the code.

Installation

pip install smartprint

Issues

Please feel free to start a pull request/ raise an issue.

Code coverage plot

drawing

Metadata

Release files for smartprint 1.0.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for smartprint 1.0.5
File Size Uploaded
smartprint-1.0.5.tar.gz 3.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for smartprint 1.0.5
File Interpreter ABI Platform
smartprint-1.0.5-py3-none-any.whl Python 3 none any Details

Total release size: 7.7 kB

Release files / smartprint-1.0.5.tar.gz

Download URL smartprint-1.0.5.tar.gz
Size 3.8 kB
Tags Source
SHA-256 checksum
How to use checksums
0be8e0c6e95aa7d6f8bf0a5cf8e75923c034562cb0f4b916262683dab5b03ad0
BLAKE2b-256 checksum
How to use checksums
7a4b68b76d1e092b843d0a037caedd54ef8875df0a3d57d4083eabf060f1def4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.9.15

Release files / smartprint-1.0.5-py3-none-any.whl

Download URL smartprint-1.0.5-py3-none-any.whl
Size 3.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5f9d937bae02073932f01cce8f7bec1527daced978b1565a8267f6c7166c8f99
BLAKE2b-256 checksum
How to use checksums
cf04db8b8a23f6a00430e1f8987aaa7184b0fcdd07a1fdf540aee331f0f419fd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.9.15

Release history Release notifications | RSS feed

This release

1.0.5 This release

2 release files

1.0.4

2 release files

1.0.3

2 release files

1.0.2

2 release files

1.0.1

2 release files

0.1.6

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

0.0.10

2 release files

0.0.9

2 release files

0.0.8

2 release files

0.0.7

2 release files

0.0.6

2 release files

0.0.5

1 release file

0.0.4

2 release files

0.0.3

2 release files

0.0.2

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page