Skip to content

Commit ab0a4c3

Browse files
Fix Sphinx documentation warnings and enable Intersphinx
1 parent d2cc803 commit ab0a4c3

File tree

4 files changed

+37
-27
lines changed

4 files changed

+37
-27
lines changed

doc/api.rst

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
1-
.. _api:
2-
31
API
42
===
53

4+
.. module:: pyperf
5+
6+
The module version...
7+
68
The module version can be read from ``pyperf.VERSION`` (tuple of int) or
79
``pyperf.__version__`` (str).
810

@@ -193,10 +195,12 @@ Benchmark class
193195

194196
Format values including the unit.
195197

196-
.. method:: get_dates() -> (datetime.datetime, datetime.datetime) or None
198+
.. method:: get_dates()
197199

198200
Get the start date of the first run and the end date of the last run.
199201

202+
Return ``(datetime.datetime, datetime.datetime)`` or ``None``.
203+
200204
Return a ``(start, end)`` tuple where start and end are
201205
``datetime.datetime`` objects if a least one run has a date metadata.
202206

@@ -222,7 +226,7 @@ Benchmark class
222226

223227
Get the total number of values.
224228

225-
.. method:: get_nwarmup() -> int or float
229+
.. method:: get_nwarmup() -> int | float
226230

227231
Get the number of warmup values per run.
228232

@@ -244,7 +248,7 @@ Benchmark class
244248
Use the ``duration`` metadata of runs, or compute the sum of their
245249
raw values including warmup values.
246250

247-
.. method:: get_loops() -> int or float
251+
.. method:: get_loops() -> int | float
248252

249253
Get the number of outer loop iterations of runs.
250254

@@ -253,7 +257,7 @@ Benchmark class
253257

254258
.. versionadded:: 1.3
255259

256-
.. method:: get_inner_loops() -> int or float
260+
.. method:: get_inner_loops() -> int | float
257261

258262
Get the number of inner loop iterations of runs.
259263

@@ -262,7 +266,7 @@ Benchmark class
262266

263267
.. versionadded:: 1.3
264268

265-
.. method:: get_total_loops() -> int or float
269+
.. method:: get_total_loops() -> int | float
266270

267271
Get the total number of loops per value (outer-loops x inner-loops).
268272

@@ -686,7 +690,7 @@ The :class:`Run` class collects metadata by default.
686690
Benchmark:
687691

688692
* ``date`` (str): date when the benchmark run started, formatted as ISO 8601
689-
* ``duration`` (int or float >= 0): total duration of the benchmark run in seconds (``float``)
693+
* ``duration`` (int | float >= 0): total duration of the benchmark run in seconds (``float``)
690694
* ``name`` (non-empty str): benchmark name
691695
* ``loops`` (``int >= 1``): number of outer-loops per value (``int``)
692696
* ``inner_loops`` (``int >= 1``): number of inner-loops of the benchmark (``int``)
@@ -733,14 +737,14 @@ System metadata:
733737
* ``boot_time`` (str): Date and time of the system boot
734738
* ``hostname``: Host name
735739
* ``platform``: short string describing the platform
736-
* ``load_avg_1min`` (int or float >= 0): Load average figures giving the number of jobs in the run
740+
* ``load_avg_1min`` (int | float >= 0): Load average figures giving the number of jobs in the run
737741
queue (state ``R``) or waiting for disk I/O (state ``D``) averaged over 1
738742
minute
739743
* ``runnable_threads``: number of currently runnable kernel scheduling entities
740744
(processes, threads). The value comes from the 4th field of
741745
``/proc/loadavg``: ``1`` in ``0.20 0.22 0.24 1/596 10123`` for example
742746
(``596`` is the total number of threads).
743-
* ``uptime`` (int or float >= 0): Duration since the system boot (``float``, number of seconds
747+
* ``uptime`` (int | float >= 0): Duration since the system boot (``float``, number of seconds
744748
since ``boot_time``)
745749

746750
Other:

doc/changelog.rst

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ a Python binding called "perf" as well.
180180
Version 1.6.0 (2019-01-11)
181181
--------------------------
182182

183-
* Add *teardown* optional parameter to :class:`Runner.timeit` and ``--teardown``
183+
* Add *teardown* optional parameter to ``Runner.timeit`` and ``--teardown``
184184
option to the :ref:`perf timeit <timeit_cmd>` command. Patch by **Alex
185185
Khomchenko**.
186186
* ``Runner.timeit(stmt)`` can now be used to use the statement as the benchmark
@@ -561,8 +561,8 @@ Version 0.7.10 (2016-09-17)
561561
Version 0.7.9 (2016-09-17)
562562
--------------------------
563563

564-
* Add :meth:`Benchmark.get_unit` method
565-
* Add :meth:`BenchmarkSuite.get_metadata` method
564+
* Add ``Benchmark.get_unit`` method
565+
* Add ``BenchmarkSuite.get_metadata`` method
566566
* metadata: add ``nohz_full`` and ``isolated`` to ``cpu_config``
567567
* add ``--affinity`` option to the ``metadata`` command
568568
* ``convert``: fix ``--remove-all-metadata``, keep the unit
@@ -614,7 +614,7 @@ Version 0.7.4 (2016-08-18)
614614

615615
* Support PyPy
616616
* metadata: add ``mem_max_rss`` and ``python_hash_seed``
617-
* Add :func:`perf.python_implementation` and :func:`perf.python_has_jit`
617+
* Add ``perf.python_implementation`` and ``perf.python_has_jit``
618618
functions
619619
* In workers, calibration samples are now stored as warmup samples.
620620
* With a JIT (PyPy), the calibration is now done in each worker. The warmup
@@ -711,7 +711,7 @@ Changes:
711711
and TextRunner.
712712
* A single JSON file can now contain multiple benchmarks
713713
* Add a dependency to the ``six`` module
714-
:meth:`Benchmark.add_run` now raises an exception if a sample is zero.
714+
``Benchmark.add_run`` now raises an exception if a sample is zero.
715715
* Benchmark.name becomes a property and is now stored in metadata
716716
* TextRunner now uses powers of 2, rather than powers of 10, to calibrate the
717717
number of loops
@@ -725,9 +725,9 @@ Changes:
725725
* The ``hist`` command now accepts multiple files
726726
* ``hist`` and ``hist_scipy`` commands got a new ``--bins`` option
727727
* Replace mean with median
728-
* Add :meth:`perf.Benchmark.median` method, remove ``Benchmark.mean()`` method
728+
* Add ``perf.Benchmark.median`` method, remove ``Benchmark.mean()`` method
729729
* ``Benchmark.get_metadata()`` method removed: use directly the
730-
:attr:`perf.Benchmark.metadata` attribute
730+
``perf.Benchmark.metadata`` attribute
731731
* Add ``timer`` metadata. ``python_version`` now also contains the architecture
732732
(32 or 64 bits).
733733

@@ -774,23 +774,22 @@ Version 0.3 (2016-06-10)
774774
* If TextRunner detects isolated CPUs, it sets automatically the CPU affinity
775775
to these isolated CPUs
776776
* Add ``--json-file`` command line option
777-
* Add :meth:`TextRunner.bench_sample_func` method
777+
* Add ``TextRunner.bench_sample_func`` method
778778
* Add examples of the API to the documentation. Split also the documentation
779779
into subpages.
780780
* Add metadata ``cpu_affinity``
781-
* Add :func:`perf.is_significant` function
782-
* Move metadata from :class:`~perf.Benchmark` to ``RunResult``
783-
* Rename the ``Results`` class to :class:`~perf.Benchmark`
784-
* Add :attr:`~TextRunner.inner_loops` attribute to
785-
:class:`TextRunner`, used for microbenchmarks when an
786-
instruction is manually duplicated multiple times
781+
* Add ``perf.is_significant`` function
782+
* Move metadata from ``perf.Benchmark`` to ``RunResult``
783+
* Rename the ``Results`` class to ``perf.Benchmark``
784+
* Add ``TextRunner.inner_loops`` attribute to
785+
``TextRunner``, used for microbenchmarks when an
787786

788787
Version 0.2 (2016-06-07)
789788
------------------------
790789

791790
* use JSON to exchange results between processes
792791
* new ``python3 -m perf`` CLI
793-
* new :class:`TextRunner` class
792+
* new ``TextRunner`` class
794793
* huge enhancement of the timeit module
795794
* timeit has a better output format in verbose mode and now also supports a
796795
``-vv`` (very verbose) mode. Minimum and maximum are not more shown in

doc/conf.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,14 @@
2424
# Add any Sphinx extension module names here, as strings. They can be
2525
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
2626
# ones.
27-
extensions = []
27+
extensions = [
28+
'sphinx.ext.autodoc',
29+
'sphinx.ext.intersphinx',
30+
]
31+
32+
intersphinx_mapping = {
33+
'python': ('https://docs.python.org/3', None),
34+
}
2835

2936
# Add any paths that contain templates here, relative to this directory.
3037
templates_path = ['templates']

doc/runner.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
Runner CLI
44
==========
55

6-
Command line options of the :class:`Runner` class.
6+
Command line options of the :class:`pyperf.Runner` class.
77

88
Loop iterations
99
---------------

0 commit comments

Comments
 (0)