Last updated:
0 purchases
pyprocwatch 0.2.2
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-watch always trims long lines so they fit on the screen
py-proc-watch respects 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:
isort for keeping imports sane
black for enforcing a consistent code style
ruff for linting
mypy for type checking
pytest for running test
mockito for mocks in unit tests
poethepoet for 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:
Open Source Initiative page about MIT license
tl;drLegal page about MIT license
For personal and professional use. You cannot resell or redistribute these repositories in their original state.
There are no reviews.