Pure Python procps "watch" replacement
Project description
py-proc-watch
Library and command line tool for watching process output. This is more or less a simpler version of watch from procps.
The main differences come from defaults:
py-proc-watchalways trims long lines so they fit on the screenpy-proc-watchrespects color ANSI escape sequences (but strips the rest)- Python or C for the implementation
Design goals
py-proc-watch library and tool should be:
- simple
- fast for very long output of executed command
- easily tested for correct behavior
- pure Python to maximize the amount of supported systems
- easy to use in other tools
Usage
pywatch command line tool supports only a few command line options to keep it simple:
usage: pywatch.py [-h] [-n INTERVAL] [-p] [-v] command [command ...]
positional arguments:
command command to watch, can be specified as a quoted string or as a list (use -- to separate pywatch and command options)
options:
-h, --help show this help message and exit
-n INTERVAL, --interval INTERVAL
seconds to wait between command runs, positive floats and zero are accepted
-p, --precise try to run the command precisely at intervals
-v, --debug show debug information
py_proc_watch can be used also as a Python module to provide "watch-like" functionality easily. The library is quite simple, so just read the source and tests.
Development
py-proc-watch uses Python Poetry to manage dependencies, version 1.3.0 or later is required due to lock file format.
Used tools:
isortfor keeping imports saneblackfor enforcing a consistent code stylerufffor lintingmypyfor type checkingpytestfor running testmockitofor mocks in unit testspoethepoetfor easily running all of the above
The magic incantation:
poetry run poe check
will run all of the lint and test tools for you. During development running:
poetry run poe format
Will run isort and black to format the source code, ruff and mypy will be executed after code formatting to check for violations.
Contributing and reporting issues
Please use GitHub Issues and Pull requests. If you're contributing code please see Development section.
License
MIT, see LICENSE.md for full text. This is very permissive license, see following pages for more information:
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file py_proc_watch-0.2.4.tar.gz.
File metadata
- Download URL: py_proc_watch-0.2.4.tar.gz
- Upload date:
- Size: 8.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.1.1 CPython/3.13.2 Windows/11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cc681a07e8f5b5316c7829875b75f11e45881bdb58e400610641d73c22921840
|
|
| MD5 |
bef63d67ab07b44bcf8a7713344f7e21
|
|
| BLAKE2b-256 |
37af6d668defbd4e53480f24a619670a9ac5dae1061897a4494f6db35bdbcbc6
|
File details
Details for the file py_proc_watch-0.2.4-py3-none-any.whl.
File metadata
- Download URL: py_proc_watch-0.2.4-py3-none-any.whl
- Upload date:
- Size: 6.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.1.1 CPython/3.13.2 Windows/11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d55e6acc1624015a73a5383418db8d989c17e5433621ce0ceabe11cb96fe3575
|
|
| MD5 |
c1063dc94dabb76fd9ad006062eeab26
|
|
| BLAKE2b-256 |
71949befe4c56dc4fc7d19e30018ca95f0a19b9c7b3f27dd7022bdb64c373a45
|