Print Position
A cool python package to add the timestamp, file name and line number in the print statements. This small tool can be very helpful in debugging big Python projects.
Here is the project on pypi.
The current download stas are:
Motivation
To debug the Python code present in multiple files, it becomes difficult to track down the print statement calls in the different files. This small pip package can be highly useful in such cases, one can simply use the custom print statement defined in this package and see the filename and line number of the print calls.
How to install?
Just install the package using the command:
pip3 install print-position
Usage
Simply add this import statement on top of your python file to see the time, file name and line number of each print statement.
from print_position import print_pos as print
A simple example is (test_pos.py):
from print_position import print_pos as print
print("Test on line 2 from test.py")
print("Test on line 3 from test.py")
print("Test on line 7 from test.py")
The output is shown as:
@file_name:line_number
print_data
If you want to also see the timestamp, just use the print_pos_time function like this:
from print_position import print_pos_time as print
A simple example is (test_pos_time.py):
from print_position import print_pos_time as print
print("Test on line 2 from test.py")
print("Test on line 3 from test.py")
print("Test on line 7 from test.py")
The output is shown as:
time:@file_name:line_number
print_data
I believe this would be very helpful in tracking down errors during debugging, especially when you are working with someone else's code.
Changelog
2.0.1:
- Added another function to print the time of the print call.
- Restructured the project to improve imports.
Contact me
To raise any issues/requests you may refer the issue page here.
You may mail me here on my mail id.
Feel free to connect with me on my LinkedIn.
Please do check out my other projects on my GitHub here.
Also I have made many cool Firefox Add ons. They are pretty useful, you may want to check them out here.
If you like my work, you may want to buy me a book here.
Metadata
Release files for print-position 2.0.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 | |
|---|---|---|---|
| print_position-2.0.1.tar.gz | 3.7 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| print_position-2.0.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 7.6 kB
Release files / print_position-2.0.1.tar.gz
| Download URL | print_position-2.0.1.tar.gz |
|---|---|
| Size | 3.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b5d4099af9321ed40e2c0338d2b949919920f419c1584c5a697806c7daae3df7
|
|
BLAKE2b-256 checksum How to use checksums |
553a93f9c9ec914d4d229a06dc4a7f1c2aeb32599f9db28790aacf7b4cbea898
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.6
|
Release files / print_position-2.0.1-py3-none-any.whl
| Download URL | print_position-2.0.1-py3-none-any.whl |
|---|---|
| Size | 3.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
6f70b69085201badb8ea4cd0d94f1496bcf915223704364c211b810edf27a87f
|
|
BLAKE2b-256 checksum How to use checksums |
3ad9992933624d19e345608818be8f7f1e6b7adf46382bef75fdcd76ca6451c6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.6
|