Skip to main content

Spybar

Spybar is a Linux CLI utility that adds a progress bar to any tool reading a file. By example, it can create a progress bar for gzip, md5sum and other traditional utilities which don't display their progress.

Simply prefix any command with spybar.

spybar gzip that_big_file.dat

Or, if the process is already running, attach using its PID. Suppose that you want to attach to process 42:

spybar -a 42

FAQ

Can you pipe it?

Yes you can, the progress bar happens on stderr

spybar gzip -c big_dump.sql > big_dump.sql.gz

Can it support Win/OSX?

Unfortunately there is no known way to do so. This utility relies on psutil's Process.open_files() abstraction so whenever this abstraction gives you the position for other platforms than Linux then Spybar will automatically work on those.

(By automatically I mean there is maybe a few adjustments needed on Unix-specific assumptions but it's most likely a just few lines to change).

How does it work?

If you navigate to the /proc file system you will see that for each process you not only get the list of open files (in /proc/XX/fd) but also meta-information about those files (in /proc/XX/fdinfo).

This way Spybar will look for files open in read mode by your process and then look at the current position of the file pointer, which once compared to the file size gives you the relative progress.

Does it always work?

Of course not, but the use case of binaries reading a file from the beginning to the end is fairly common. Who never waited in front of a gzip, xz, tar or md5sum wondering if they should go have a coffee or if it's just 2 seconds more?

In the end this is just guessing but it works in many situations.

Thanks

I would like to thank:

  • Whomever put this feature in the Linux kernel
  • The psutil maintainers
  • The tqdm maintainers
  • The poetry maintainers
  • The pytest maintainers
  • The apt maintainers from whom I stole the VT100 progress bar logic
  • All open-source contributors thanks to whom this software was easy to write

License

This software is released under the terms of the WTFPL.

Release files for spybar 0.1.0

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

Source distribution (sdist)

Source distribution for spybar 0.1.0
File Size Uploaded
spybar-0.1.0.tar.gz 8.8 kB Details

Built distribution (wheel)

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

Total release size: 18.4 kB

Release files / spybar-0.1.0.tar.gz

Download URL spybar-0.1.0.tar.gz
Size 8.8 kB
Tags Source
SHA-256 checksum
How to use checksums
50047d6edddc9cc0b366c2a376eaa5d5220f92ab5162e2469a8d626d3e5e05c2
BLAKE2b-256 checksum
How to use checksums
fc662e26333dbc8ed6144a01487abdd595e855f5bb35e31e61fbd511d3c1100a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.0.0 CPython/3.8.0 Linux/4.15.0-58-generic

Release files / spybar-0.1.0-py3-none-any.whl

Download URL spybar-0.1.0-py3-none-any.whl
Size 9.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9438e302932a89e8eea92c094cc4c080af4dd5e8cc899e1b862d1572aa3afb61
BLAKE2b-256 checksum
How to use checksums
b6d64cc950c3b01d80b1de02a002f14ac6a7528d72360be5b680c6b2d5cad778
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.0.0 CPython/3.8.0 Linux/4.15.0-58-generic

Release history Release notifications | RSS feed

This release

0.1.0 This release

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