Vpack
A package containing a lot of useful utilities for Python developing and debugging.
Features
- Sigview: press Ctrl+C to print the current stack instead of exiting.
- Breakpt: set always-on, at-time, on-error breakpoints conveniently.
- Reload: reload modules by names.
To-do:
- Vartrace: figure out how a variable changes over time, with a statistical chart or a live counter.
Installation
pip install --upgrade vpack
Examples
Sigview
Sigview is a signal handler. It will print the current running information (e.g. file, lineno, code, stack) when Ctrl+C is pressed.
Enable sigview:
from vpack import sigview
sigview.enable()
# your code goes here
Now run your script and you will see the following output:
$ python examples/sigview_example.py
(vpack): Sigview enabled. Press ^C to see the current frame. Press ^C again to exit.
1
2
1
Press Ctrl+C to see the current frame, possible outputs:
^C(vpack): Current file:
examples/sigview_example.py:11 in main
(vpack): Current stask:
+----------------------------------------------------------+
| File "examples/sigview_example.py", line 14, in <module> |
| main() |
| |
| File "examples/sigview_example.py", line 11, in main |
| time.sleep(2) |
+----------------------------------------------------------+
Press Ctrl+C twice (in 0.5 seconds) to exit.
You can also use sigview.enable(openshell=True) to open a new shell when Ctrl+C is pressed.
See sigview_example.py and sigview_openshell_example.py.md for more details.
Breakpt
Breakpt is a convenient way to set breakpoints.
.at(n) will try to open an interactive IPython shell (or pdb) when this line has been executed n times.
.onerror() will try to open a PDB shell when an Exception is raised.
You can use breakpt.enable() and breakpt.disable() to enable and disable breakpt.
from vpack import breakpt
for i in range(10):
print(i)
breakpt.at(8) # break at i = 7
breakpt.at(5) # break at i = 4
for i in range(6):
print(i)
if i == 2: breakpt.disable() # disable breakpt
if i == 4: breakpt.enable() # enable breakpt
breakpt.always() # break at i = 0, 1, 4, 5
breakpt.onerror()
a = [1, 2, 3]
for i in range(5):
print(a[i]) # will break at i = 3
See breakpt_example.py for more details.
Reload
Reload modules by names, see reload_example.py for more details.
Metadata
Release files for vpack 0.0.11
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| vpack-0.0.11.tar.gz | 5.7 kB | Without provenance | Details for vpack-0.0.11.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| vpack-0.0.11-py3-none-any.whl | Python 3 | none | any | Details for vpack-0.0.11-py3-none-any.whl |
Total release size: 12.5 kB
Release files / vpack-0.0.11.tar.gz
| Download URL | vpack-0.0.11.tar.gz |
|---|---|
| Size | 5.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
4525dd068404dd67fcccda0409a549c54bc39d1cbeec0daad34d21ade76fecc2
|
|
BLAKE2b-256 checksum How to use checksums |
6caa8d4ce7e87f5d57e715b394cd136c4fe1726cfbcfba9cc804d01f3512c4b8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.6.0 importlib_metadata/4.8.2 pkginfo/1.8.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.9
|
Release files / vpack-0.0.11-py3-none-any.whl
| Download URL | vpack-0.0.11-py3-none-any.whl |
|---|---|
| Size | 6.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
8b2b5def5eda10c2afe4c72100709e88de4820f65b73a3f78cd86fbc208ece41
|
|
BLAKE2b-256 checksum How to use checksums |
a608f91804a0fa033a466c1ee6016db37d0e5c18c47328723d876ec2d74854aa
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.6.0 importlib_metadata/4.8.2 pkginfo/1.8.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.9
|
Security for vpack 0.0.11
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.