Skip to content

Commit ac06aab

Browse files
committed
docs: accuracy and editorial pass over docs and docstrings
Correct factual claims found in review (force=True gate semantics, width allocator, poll-interval types, unit_scale is IEC base-1024, terminal detection ordering, dead easy_install install path), rewrite the cookiecutter-era CONTRIBUTING instructions for ruff/pytest/uv and GitHub Actions, dedupe explanations repeated across pages, trim template filler from the widget pages and docstrings, and normalize punctuation to ASCII per house style.
1 parent ac646c6 commit ac06aab

78 files changed

Lines changed: 855 additions & 1063 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎CHANGES.rst‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,4 @@ releases or the commit log:
88
- https://github.com/WoLpH/python-progressbar/releases
99
- https://github.com/WoLpH/python-progressbar/commits/develop
1010

11-
Hint: click on the `...` button to see the change message.
11+
Hint: the ``...`` button on a commit shows the full change message.

‎CONTRIBUTING.rst‎

Lines changed: 19 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,8 @@
22
Contributing
33
============
44

5-
Contributions are welcome, and they are greatly appreciated! Every
6-
little bit helps, and credit will always be given.
7-
8-
You can contribute in many ways:
5+
Contributions are welcome: bug reports, fixes, features, and
6+
documentation.
97

108
Types of Contributions
119
----------------------
@@ -36,25 +34,24 @@ is open to whoever wants to implement it.
3634
Write Documentation
3735
~~~~~~~~~~~~~~~~~~~
3836

39-
Python Progressbar could always use more documentation, whether as part of the
40-
official Python Progressbar docs, in docstrings, or even on the web in blog posts,
41-
articles, and such.
37+
The documentation lives in ``docs/`` and is built with Sphinx. The
38+
sections below cover the parts of that build that are easy to get wrong.
4239

4340
Regenerating the API reference
4441
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
4542

4643
The ``docs/progressbar*.rst`` pages are generated once with ``sphinx-apidoc`` and then
4744
committed and hand-maintained, not regenerated on every build. Never pass ``-f``/``--force``
48-
when running it again — that silently discards hand-added options, such as
45+
when running it again: that silently discards hand-added options, such as
4946
``docs/progressbar.bar.rst``'s ``:member-order: bysource``. If you add a new module under
5047
``progressbar/``, generate its page the same way the rest were generated and link it into
5148
``docs/progressbar.rst``'s ``Submodules`` toctree yourself::
5249

5350
$ sphinx-apidoc -e -o docs/ progressbar */os_specific/* */six.py
5451

5552
The docs build runs with ``-W`` (warnings fail the build), so a page that exists but isn't
56-
linked into a toctree fails immediately with "document isn't included in any toctree" —
57-
you'll know right away if you forgot this step.
53+
linked into a toctree fails immediately with "document isn't included in any toctree".
54+
You'll know right away if you forgot this step.
5855

5956
Regenerating demo animations
6057
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -95,8 +92,6 @@ If you are proposing a feature:
9592

9693
* Explain in detail how it would work.
9794
* Keep the scope as narrow as possible, to make it easier to implement.
98-
* Remember that this is a volunteer-driven project, and that contributions
99-
are welcome :)
10095

10196
Get Started!
10297
------------
@@ -123,15 +118,14 @@ Ready to contribute? Here's how to set up `python-progressbar` for local develop
123118

124119
Now you can make your changes locally.
125120

126-
5. When you're done making changes, check that your changes pass flake8 and the tests, including testing other Python versions with tox::
127-
128-
$ flake8 progressbar tests
129-
$ py.test
130-
$ tox
121+
5. When you're done making changes, check that your changes pass the
122+
linter and the tests, including other Python versions with tox::
131123

132-
To get flake8 and tox, just pip install them into your virtualenv using the requirements file.
124+
$ uv run ruff check progressbar tests
125+
$ uv run pytest
126+
$ uv run tox
133127

134-
$ pip install -r tests/requirements.txt
128+
The ``uv sync`` from step 3 already installed all of these.
135129

136130
6. Commit your changes and push your branch to GitHub with `git-flow-avh`_::
137131

@@ -153,18 +147,17 @@ Pull Request Guidelines
153147
Before you submit a pull request, check that it meets these guidelines:
154148

155149
1. The pull request should include tests.
156-
2. If the pull request adds functionality, the docs should be updated. Put
157-
your new functionality into a function with a docstring, and add the
158-
feature to the list in README.rst.
159-
3. The pull request should work for Python 2.7, 3.3, and for PyPy. Check
160-
https://travis-ci.org/WoLpH/python-progressbar/pull_requests
161-
and make sure that the tests pass for all supported Python versions.
150+
2. If the pull request adds functionality, the docs should be updated:
151+
docstrings plus the relevant page under ``docs/``.
152+
3. The pull request should work for every supported Python version (see
153+
``requires-python`` in ``pyproject.toml``). CI runs the full matrix on
154+
GitHub Actions for every pull request.
162155

163156
Tips
164157
----
165158

166159
To run a subset of tests::
167160

168-
$ py.test tests/some_test.py
161+
$ uv run pytest tests/some_test.py
169162

170163
.. _git-flow-avh: https://github.com/petervanderdoes/gitflow

‎README.rst‎

Lines changed: 5 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
progressbar2
33
##############################################################################
44

5-
A mature, typed terminal progress bar library for Python scripts that need
6-
custom widgets, clean output around prints and logs, multiple concurrent bars,
5+
A typed terminal progress bar library for Python. It handles custom
6+
widgets, clean output around prints and logs, multiple concurrent bars,
77
unknown-length progress, and pipe-friendly CLI usage.
88

99
.. image:: https://github.com/WoLpH/python-progressbar/actions/workflows/main.yml/badge.svg
@@ -36,7 +36,7 @@ Try it in your browser
3636
==============================================================================
3737

3838
Every example in the `documentation <https://progressbar-2.readthedocs.io/en/latest/>`_
39-
runs live in the page — press **Run** on any code block. No install required.
39+
runs live in the page. Press **Run** on any code block, no install required.
4040

4141
Progress with clean logs
4242
==============================================================================
@@ -151,17 +151,6 @@ CLI usage
151151
152152
progressbar --progress --timer --eta --rate --bytes input.bin -o output.bin
153153
154-
Feature highlights
155-
==============================================================================
156-
157-
* Works as an iterable wrapper or a manually updated progress bar.
158-
* Supports custom widgets, colors, granular bars, animated markers, and labels.
159-
* Handles unknown-length iterators.
160-
* Supports multiple concurrent progress bars with ``MultiBar``.
161-
* Redirects stdout/stderr so regular output does not corrupt the active bar.
162-
* Includes a pipe-friendly ``progressbar`` command.
163-
* Ships typed package metadata.
164-
165154
Known terminal caveats
166155
==============================================================================
167156

@@ -178,8 +167,8 @@ on the now defunct Google Code. Since that project was completely abandoned by
178167
its developer and the developer did not respond to email, I decided to fork the
179168
package.
180169

181-
This package is still backwards compatible with the original progressbar package
182-
so you can safely use it as a drop-in replacement for existing projects.
170+
This package is still backwards compatible with the original progressbar
171+
package so you can use it as a drop-in replacement for existing projects.
183172

184173
Links
185174
==============================================================================

‎docs/_static/livecode/livecode.js‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ const RUN_TIMEOUT_MS = 30000;
88

99
// Read the Docs serves the site under `/en/<version>/`, so root-absolute
1010
// asset paths 404 there. Derive the static root from this script's own
11-
// URL instead — it is the one path the browser always knows.
11+
// URL instead: it is the one path the browser always knows.
1212
const SCRIPT_ELEMENT =
1313
document.currentScript ||
1414
document.querySelector('script[src$="livecode/livecode.js"]');
@@ -127,9 +127,9 @@ function createPanel(container, source) {
127127
terminal,
128128
setStatus(stage) {
129129
const labels = {
130-
loading: 'Downloading Python…',
131-
installing: 'Installing progressbar2…',
132-
ready: 'Running…',
130+
loading: 'Downloading Python...',
131+
installing: 'Installing progressbar2...',
132+
ready: 'Running...',
133133
idle: '',
134134
};
135135
status.textContent = labels[stage] ?? '';

‎docs/_static/livecode/worker.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ let pyodide = null;
3232
// reached some other way.
3333
const THREAD_ERROR_MARKER = "can't start new thread";
3434
const THREAD_ERROR_MESSAGE =
35-
'This demo uses MultiBar’s `with` form, which starts a real OS ' +
35+
'This demo uses MultiBar's `with` form, which starts a real OS ' +
3636
'thread. Browsers cannot provide that, so it cannot run here -- the ' +
3737
'animation above is the real output. See the source for the pattern.';
3838

‎docs/_static/vendor/README.md‎

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,16 @@
11
# Vendored assets
22

3-
| File | Source | Version | Licence |
3+
| File | Source | Version | License |
44
| --- | --- | --- | --- |
55
| `xterm.js`, `xterm.css` | `@xterm/xterm` | 5.5.0 | MIT (`LICENSE-xterm.txt`) |
66

7-
Update by re-running the `npm pack` steps in Task 20 of
8-
`docs/superpowers/plans/2026-08-02-interactive-documentation.md`.
7+
Update (bump the version in both commands and this table):
8+
9+
```bash
10+
npm pack @xterm/xterm@5.5.0
11+
tar -xzf xterm-xterm-5.5.0.tgz
12+
cp package/lib/xterm.js docs/_static/vendor/xterm.js
13+
cp package/css/xterm.css docs/_static/vendor/xterm.css
14+
cp package/LICENSE docs/_static/vendor/LICENSE-xterm.txt
15+
rm -rf package xterm-xterm-5.5.0.tgz
16+
```

‎docs/conf.py‎

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,21 @@
4949
'demo',
5050
]
5151

52+
# `sphinx-autodoc-typehints` is a declared docs dependency but is
53+
# deliberately NOT enabled. It would move each annotation next to its
54+
# parameter description, which suits docstrings that never repeat a type
55+
# in prose -- but it cannot document this package. Enabling it fails the
56+
# `-W` build with 40 `error while formatting signature ... list assignment
57+
# index out of range` warnings, one per module-level callable *instance*
58+
# documented as a data member: every `CSINoArg`/`CSI` escape sequence
59+
# (`CLEAR_LINE`, `CUP`, `HIDE_CURSOR`, ...) and every `ColorGradient`
60+
# class attribute (`Bar.fg`, `JobStatusBar.success_fg_color`, ...). The
61+
# extension tries to resolve hints against the instance rather than its
62+
# `__call__`, and that pattern is pervasive here. Autodoc already renders
63+
# the annotations in the signature, so nothing is lost by leaving this
64+
# off. Do not re-enable without rebuilding from a clean `docs/_build`:
65+
# an incremental rebuild reuses cached doctrees and reports success.
66+
5267
# Merge each class's `__init__` docstring into its class page. Constructor
5368
# arguments are user-facing -- `ProgressBar` alone takes more than fifteen
5469
# -- and without this the default ('class') renders only the class

‎docs/examples.rst‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@
44
Examples
55
========
66

7-
The runnable examples now live in :doc:`widgets/index` and
7+
The runnable examples live in :doc:`widgets/index` and
88
:doc:`howto/index`, each with an animation and an editable console.

‎docs/explanation/backwards-compatibility.rst‎

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,14 @@ progressbar2 began as a fork of the original ``progressbar`` package, once
66
hosted on the now-defunct Google Code and abandoned by its author. The
77
project has said ever since that it is "backwards compatible with the
88
original progressbar package so you can safely use it as a drop-in
9-
replacement for existing projects" (see the project README). This page is
10-
about what that claim covers today, verified against the current source,
11-
and -- just as importantly -- what it does not cover.
9+
replacement for existing projects" (see the project README). This page
10+
covers what that claim means today, verified against the current source,
11+
and what it does not cover.
1212

1313
What "drop-in" covers
1414
==========================
1515

16-
* **The import name.** ``import progressbar`` still works; only the PyPI
16+
* **The import name.** ``import progressbar`` still works. Only the PyPI
1717
distribution name changed, to ``progressbar2``, because the original
1818
``progressbar`` name on PyPI belonged to the abandoned package.
1919
* **The core object lifecycle.** Construct a ``ProgressBar``, call
@@ -61,12 +61,9 @@ What it does not cover
6161

6262
* **Python version support moves forward, not backward.** The currently
6363
supported floor is CPython 3.10 (see ``pyproject.toml``'s
64-
``requires-python``); this is a live constraint, not a compatibility
64+
``requires-python``). This is a live constraint, not a compatibility
6565
promise about older interpreters the original package may have targeted.
66-
Consult the project's GitHub releases for the history of exactly when that
67-
floor changed -- this repository's own ``CHANGES.rst`` points there rather
68-
than keeping an inline log, so this page does not restate specific past
69-
versions it cannot verify from the source tree.
66+
The project's GitHub releases record when that floor changed.
7067
* **Most of today's public surface is new, with no equivalent in the
7168
original package**: ``MultiBar``, ``FastProgressBar``, the native
7269
``speedups`` accelerator (see
@@ -85,6 +82,6 @@ What it does not cover
8582
removal eventually, and migrate off them when convenient rather than
8683
relying on them long-term.
8784
* **The format-string compatibility shim is narrow.** It only rewrites a
88-
bare ``%s`` for ``Timer`` and ``ETA`` specifically; a custom widget outside
89-
that inheritance chain that expects the same old-style placeholder is not
90-
covered.
85+
bare ``%s`` for ``Timer`` and ``ETA`` specifically. A custom widget
86+
outside that inheritance chain that expects the same old-style
87+
placeholder is not covered.

‎docs/explanation/performance-and-the-fast-path.rst‎

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,9 @@ Performance and the fast path
33
===================================
44

55
Wrapping a loop in a progress bar should not be the reason the loop gets
6-
slower. progressbar2 has three layers aimed at that, each optional and each
7-
falling back cleanly to the layer below it when unavailable. This page
8-
covers what each one does, when it applies, and the measured cost of each,
9-
so you know when reaching for one deliberately is worth it.
6+
slower. progressbar2 has three layers aimed at that: an always-on update
7+
gate, an automatic lean renderer, and an opt-in native iterator. This page
8+
covers what each one does, when it applies, and its measured cost.
109

1110
Layer 1: the integer gate (always on)
1211
==========================================
@@ -32,25 +31,26 @@ formatting.
3231

3332
The fast class is chosen automatically when *all* of the following hold:
3433
no explicit ``widgets=`` was given, ``fast`` was not passed as ``False``,
35-
no ``variables`` kwarg was given, ``unit`` is still the default ``'it'``,
34+
``variables`` is empty or not given, ``unit`` is still the default ``'it'``,
3635
``unit_scale`` is off, ``postfix`` is unset, and the
3736
``PROGRESSBAR_DISABLE_FASTPATH`` environment variable is not set. In other
3837
words: the common "just wrap my loop" case gets the lean renderer by
39-
default; anything that needs the widget system (a custom widget list, tqdm's
38+
default. Anything that needs the widget system (a custom widget list, tqdm's
4039
``unit``/``postfix`` extras, dynamic ``Variable`` widgets) automatically
4140
gets the full ``ProgressBar`` instead. You can also construct
4241
:py:class:`~progressbar.fast.FastProgressBar` directly if you want the fast
4342
renderer without going through the shortcut -- see
4443
:doc:`../reference/progressbar`.
4544

46-
Note that this dispatch only happens inside ``progressbar.progressbar()``.
45+
This dispatch only happens inside ``progressbar.progressbar()``.
4746
Constructing ``ProgressBar()`` yourself always gets the full class.
4847

4948
Layer 3: the native iterator (opt-in via the ``fast`` extra)
5049
==================================================================
5150

52-
Separately, :py:meth:`ProgressBar.__iter__ <progressbar.bar.ProgressBar.__iter__>`
53-
checks whether the optional ``speedups`` package
51+
Separately, :py:meth:`ProgressBar.__iter__
52+
<progressbar.bar.ProgressBar.__iter__>` checks whether the optional
53+
``speedups`` package
5454
(``speedups.progressbar.FastBarIterator``) is importable. If it is, and
5555
``PROGRESSBAR_DISABLE_FASTPATH`` is not set, iterating over *any* bar --
5656
fast or full -- dispatches to that native iterator instead of the
@@ -59,7 +59,7 @@ pure-Python generator. It counts items itself and calls back into the bar
5959
gate crossings, so the per-iteration counting that Layer 1 already made
6060
cheap in pure Python gets cheaper still.
6161

62-
``speedups`` is not installed by default; install it with the ``fast``
62+
``speedups`` is not installed by default. Install it with the ``fast``
6363
extra:
6464

6565
.. code:: sh
@@ -71,7 +71,7 @@ above Layer 1: it stops ``progressbar.progressbar()`` from choosing
7171
``FastProgressBar``, stops ``__iter__`` from choosing the native iterator,
7272
*and* disables the integer gate itself in :py:meth:`ProgressBar.start()
7373
<progressbar.bar.ProgressBar.start>` -- with it set, every bar calls
74-
``update()`` on every single iteration, matching the pre-gate behaviour
74+
``update()`` on every single iteration, matching the pre-gate behavior
7575
exactly. That makes it a genuine "turn all of this off" switch, useful when
7676
debugging a rendering issue you want to rule the gate out of, not just an
7777
opt-out of the optional native accelerator.
@@ -81,8 +81,8 @@ Measured cost
8181

8282
The following is reproduced from this repository's own benchmark suite
8383
(``benchmarks/report.md``, generated by ``python benchmarks/bench.py &&
84-
python benchmarks/report.py``; see that file for the full comparison against
85-
other libraries). Figures are from one measurement environment (CPython
84+
python benchmarks/report.py``, which also compares against other
85+
libraries). Figures are from one measurement environment (CPython
8686
3.13.12, macOS arm64, output to a real pty) and will vary by machine --
8787
re-run the benchmark rather than treating these as guarantees:
8888

@@ -114,4 +114,4 @@ When to reach for which layer
114114
those features need the widget system that ``FastProgressBar`` skips.
115115
* Install the ``fast`` extra when the iteration count itself is large
116116
enough (hundreds of millions of items) that even Layer 1's per-iteration
117-
cost is worth shaving further; for most scripts it isn't necessary.
117+
cost is worth shaving further. For most scripts it isn't necessary.

0 commit comments

Comments
 (0)