uinspect
This is a small Python package that offers fast runtime inspection similar to that of inspect module in Python. To install, simply do
pip install uinspect
benchmark
The following benchmark is generated from running the scripts in benchmark/.
Task name |
uinspect method1 |
uinspect method2 |
inspect |
speedup |
Cost (us/op) |
|---|---|---|---|---|---|
Source location |
uinspect.get_location() - 0.21s |
uinspect.Frame() - 0.48s |
16.43s |
79.7x |
0.21 us/op |
Locals |
uinspect.Frame().locals - 0.99s |
N/A |
0.82s |
0.82x |
0.99 us/op |
Locals diff |
uinspect.Frame(2).collect_vars() - 2.94s |
N/A |
1.20s |
0.41x |
2.94 us/op |
Frame walking |
uinspect.FrameWalker({}).get_location() - 1.45s |
N/A |
52.27s |
35.9x |
1.46 us/op |
It turns out that the uinspect does not speed up the local variable calculation. This is because we have to run an expensive Python C API call regardless of whether it’s uinspect or inspect. As a result, the overhead is caused by the fact that uinspect needs to convert Python object to C++ object.
The lesson is to use inspect module for any local variables related manipulation since it’s faster, but use uinspect to obtain source location.
install from source
git clone https://github.com/Kuree/uinspect.git cd uinspect git submodule update --init python setup.py install
Metadata
Release files for uinspect 0.0.5
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distributions (wheels)
Total release size: 1.3 MB
Release files / uinspect-0.0.5-cp311-cp311-win_amd64.whl
| Download URL | uinspect-0.0.5-cp311-cp311-win_amd64.whl |
|---|---|
| Size | 78.5 kB |
| Tags | CPython 3.11 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
77ae70abf435e354eb8412f5f0d03155b50366a9350e346a1fcc949647c959ce
|
|
BLAKE2b-256 checksum How to use checksums |
a3367f7b81a058e4fed3ce62632d2547408de8890a2c26a166a5519f30bda1e2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.9.16
|
Release files / uinspect-0.0.5-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
| Download URL | uinspect-0.0.5-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl |
|---|---|
| Size | 120.4 kB |
| Tags | CPython 3.11 Linux glibc 2.17+ x86-64 |
|
SHA-256 checksum How to use checksums |
8da5f4b2c599194945f0218441f33585a42d8e563e2e2301c499597beb9dfb1b
|
|
BLAKE2b-256 checksum How to use checksums |
4348e30288360a4c653d3608951ed9d9c16119c728fb56b10bc339d4acced5da
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.9.16
|
Release files / uinspect-0.0.5-cp311-cp311-macosx_10_15_universal2.whl
| Download URL | uinspect-0.0.5-cp311-cp311-macosx_10_15_universal2.whl |
|---|---|
| Size | 131.0 kB |
| Tags | CPython 3.11 macOS 10.15+ universal2 (ARM64, x86-64) |
|
SHA-256 checksum How to use checksums |
73a19cbdf3fef87c52935a750930337595669e018778031d8779c16c1a9c0bad
|
|
BLAKE2b-256 checksum How to use checksums |
4d7fb258b8e499330f1a186d71a0deaf8795208a18bbdb2249f49e52da3042dd
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.9.16
|
Release files / uinspect-0.0.5-cp310-cp310-win_amd64.whl
| Download URL | uinspect-0.0.5-cp310-cp310-win_amd64.whl |
|---|---|
| Size | 78.5 kB |
| Tags | CPython 3.10 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
6382ba5091612f15983961d3abd7ea25bb0b170f76dd2dcee0b6a5009a7309f6
|
|
BLAKE2b-256 checksum How to use checksums |
10115c1d5419cd23805e3873b607e575f0983d6bc1784d4cf8e818244683eb69
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.9.16
|
Release files / uinspect-0.0.5-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
| Download URL | uinspect-0.0.5-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl |
|---|---|
| Size | 120.3 kB |
| Tags | CPython 3.10 Linux glibc 2.17+ x86-64 |
|
SHA-256 checksum How to use checksums |
2ecd7ed1c4f56d296ba932d16d1484dae77659c6d0f3cfb4c042ce7b7ee9727e
|
|
BLAKE2b-256 checksum How to use checksums |
753c309272707123d1d0c064eb8085c9f9163546a26bf83417958dca12d29fa9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.9.16
|
Release files / uinspect-0.0.5-cp310-cp310-macosx_10_15_universal2.whl
| Download URL | uinspect-0.0.5-cp310-cp310-macosx_10_15_universal2.whl |
|---|---|
| Size | 130.9 kB |
| Tags | CPython 3.10 macOS 10.15+ universal2 (ARM64, x86-64) |
|
SHA-256 checksum How to use checksums |
7e5444a5d988cb964cfb408312cb535566221c8411ddea940f810bf514dcb69b
|
|
BLAKE2b-256 checksum How to use checksums |
aab767adb863a9ec4d7fc0baf37bb6dd7e6d03d131ed6dcb7b3504fba3081e6b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.9.16
|
Release files / uinspect-0.0.5-cp39-cp39-win_amd64.whl
| Download URL | uinspect-0.0.5-cp39-cp39-win_amd64.whl |
|---|---|
| Size | 78.6 kB |
| Tags | CPython 3.9 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
f2f961d636de35c1dbeef77528a15cff6fb37fd8271fafead7337f7b22691e4f
|
|
BLAKE2b-256 checksum How to use checksums |
3c5b205bbd0c7020dc111c61cca57cc518c1c8590714a2d79d239b32b2ed486f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.9.16
|
Release files / uinspect-0.0.5-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
| Download URL | uinspect-0.0.5-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl |
|---|---|
| Size | 120.6 kB |
| Tags | CPython 3.9 Linux glibc 2.17+ x86-64 |
|
SHA-256 checksum How to use checksums |
0b1ef4a251de5ec43e313f64c8eab9fbbd958342d6118b63b98a6dadc9c0964d
|
|
BLAKE2b-256 checksum How to use checksums |
b1038ed5f49df1398298302b59cc9be3834c570b2f812f2d01ac9fde238b7799
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.9.16
|
Release files / uinspect-0.0.5-cp39-cp39-macosx_10_15_universal2.whl
| Download URL | uinspect-0.0.5-cp39-cp39-macosx_10_15_universal2.whl |
|---|---|
| Size | 131.2 kB |
| Tags | CPython 3.9 macOS 10.15+ universal2 (ARM64, x86-64) |
|
SHA-256 checksum How to use checksums |
13f4b55a61f2338a96360f9b1a23df97fb49dd418750e6dac009322508d43f02
|
|
BLAKE2b-256 checksum How to use checksums |
c33dead7861c7c81bd454445d2637acac58d12d61a75d6570e87bce91149527b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.9.16
|
Release files / uinspect-0.0.5-cp38-cp38-win_amd64.whl
| Download URL | uinspect-0.0.5-cp38-cp38-win_amd64.whl |
|---|---|
| Size | 78.5 kB |
| Tags | CPython 3.8 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
558abfb2c3ab2e566118be1331dc6ad23dc551f6410c8e6591fdd61530ccef7f
|
|
BLAKE2b-256 checksum How to use checksums |
26851ea30b7c9c22034b9400aeaef0d8f4dc573dfe8679cd1de64359e0514963
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.9.16
|
Release files / uinspect-0.0.5-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
| Download URL | uinspect-0.0.5-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl |
|---|---|
| Size | 120.3 kB |
| Tags | CPython 3.8 Linux glibc 2.17+ x86-64 |
|
SHA-256 checksum How to use checksums |
748b6630c60ad10c2962ad7652245481c155923d083853d0d1861b1405ff1e1c
|
|
BLAKE2b-256 checksum How to use checksums |
7ebd18f138e19c684af4d738b90211ef6bd602803a011a9679c34abd4a566bc5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.9.16
|
Release files / uinspect-0.0.5-cp38-cp38-macosx_10_15_universal2.whl
| Download URL | uinspect-0.0.5-cp38-cp38-macosx_10_15_universal2.whl |
|---|---|
| Size | 130.8 kB |
| Tags | CPython 3.8 macOS 10.15+ universal2 (ARM64, x86-64) |
|
SHA-256 checksum How to use checksums |
f5d791eaea3894eebf60859a82bdb619a1ddd54b4e44cc81ea8a52599daadee6
|
|
BLAKE2b-256 checksum How to use checksums |
ef684950bb855a6362a4914c449aef95ce355619cb163face0d1f67ed29c7b34
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.9.16
|