Skip to main content

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-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:

  1. simple
  2. fast for very long output of executed command
  3. easily tested for correct behavior
  4. pure Python to maximize the amount of supported systems
  5. 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.

Used tools:

The magic incantation:

poetry run isort . && poetry run black . && poetry run pflake8 . && poetry run mypy . && poetry run pytest

will run all of the above tools for you.

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

py-proc-watch-0.1.0.tar.gz (8.4 kB view details)

Uploaded Source

Built Distribution

py_proc_watch-0.1.0-py3-none-any.whl (6.1 kB view details)

Uploaded Python 3

File details

Details for the file py-proc-watch-0.1.0.tar.gz.

File metadata

  • Download URL: py-proc-watch-0.1.0.tar.gz
  • Upload date:
  • Size: 8.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.14 CPython/3.10.5 Windows/10

File hashes

Hashes for py-proc-watch-0.1.0.tar.gz
Algorithm Hash digest
SHA256 946cab52eb0288ac03273e2d68277685761d1f5ba4052aa954e5c8137535b6f8
MD5 ab52a15e7022a9e25cf9ead22a43318c
BLAKE2b-256 8ac8c0d9087a77dcfa535b049614d79a25f1b965822d698ae22a37c3d49a6abc

See more details on using hashes here.

File details

Details for the file py_proc_watch-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: py_proc_watch-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 6.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.14 CPython/3.10.5 Windows/10

File hashes

Hashes for py_proc_watch-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 05f741d6d0e79db5aa6816b0e3855ffeb2bbd863fdbb61c983ac400e47216655
MD5 83ec0acae0537c777f2fe206a0658ecc
BLAKE2b-256 217c8ca241736d4af54a57157cf200794a0f203662e0e236832406d1417d6db0

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page