Progress and status updates on terminals
ttystatus is a Python library for showing progress reporting and status updates on terminals, for (Unix) command line programs. Output is automatically adapted to the width of the terminal: truncated if it does not fit, and re-sized if the terminal size changes.
Output is provided via widgets. Each widgets formats some data into a suitable form for output. It gets the data either via its initializer, or from key/value pairs maintained by the master object. The values are set by the user. Every time a value is updated, widgets get updated (although the terminal is only updated every so often to give user time to actually read the output).
The output from ttystatus goes to the terminal (
/dev/tty) and is
restricted to a single line.
See example.py for an example of how to use the library.
- Use Python distutils (setup.py) as usual.
- If possible, use the Debian packaging when you can.
You will need some other stuff to run automatic tests:
- http://liw.fi/coverage-test-runner/ for unit tests.
See http://liw.fi/ttystatus/ for information about version control trees, etc.
Run "make check" for unit tests. If you make any changes, run it first, and don't stop fixing things until coverage is 100% again.
If you do make any improvements, I would welcome patches. Send me (see http://liw.fi/contact/ for details) a patch, a bzr bundle, or a link to a bzr branch I can merge from. Thanks!
Copyright 2010-2013 Lars Wirzenius
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.
- http://pypi.python.org/pypi/progressbar/ is another library for this. It is older and more well-established, but, I think, a bit less flexible. For example, it seems to assume there is only one percentage value that gets reported.