This pull request fixes multiple Sphinx documentation warnings in the pyperf docs.#223
This pull request fixes multiple Sphinx documentation warnings in the pyperf docs.#223amritamishra01 wants to merge 4 commits intopsf:mainfrom
Conversation
|
Hi! 👋 All Sphinx documentation warnings have been resolved, and the docs build cleanly with -n (nitpicky mode). The changes are strictly documentation-related and do not affect runtime code. If everything looks good, I would appreciate a review or merge whenever convenient. Thank you! |
doc/api.rst
Outdated
| .. function:: add_runs(filename: str, result) | ||
|
|
||
| Append a :class:`Benchmark` or :class:`BenchmarkSuite` to an existing | ||
| Append a :class:`pyperf.Benchmark` or :class:`pyperf.BenchmarkSuite` to an existing |
There was a problem hiding this comment.
Since you declared .. module:: pyperf, is it really needed to repeat pyperf. prefix here?
There was a problem hiding this comment.
Again: please remove redundant pyperf. prefix.
|
|
||
| Format values including the unit. | ||
|
|
||
| .. method:: get_dates() -> (datetime.datetime, datetime.datetime) or None |
There was a problem hiding this comment.
Please keep the information about the return type. Write a sentence like:
"Return (datetime.datetime, datetime.datetime) or None."
doc/changelog.rst
Outdated
| -------------------------- | ||
|
|
||
| * Add *teardown* optional parameter to :class:`Runner.timeit` and ``--teardown`` | ||
| * Add *teardown* optional parameter to `Runner.timeit` and ``--teardown`` |
There was a problem hiding this comment.
| * Add *teardown* optional parameter to `Runner.timeit` and ``--teardown`` | |
| * Add *teardown* optional parameter to ``Runner.timeit`` and ``--teardown`` |
doc/changelog.rst
Outdated
| * Support PyPy | ||
| * metadata: add ``mem_max_rss`` and ``python_hash_seed`` | ||
| * Add :func:`perf.python_implementation` and :func:`perf.python_has_jit` | ||
| * Add `perf.python_implementation` and `perf.python_has_jit` |
There was a problem hiding this comment.
| * Add `perf.python_implementation` and `perf.python_has_jit` | |
| * Add ``perf.python_implementation`` and ``perf.python_has_jit`` |
Same remark below.
doc/conf.py
Outdated
| } | ||
| nitpick_ignore = [ | ||
| ('py:class', 'int or float'), | ||
| ('py:class', '(datetime.datetime, datetime.datetime) or None'), |
There was a problem hiding this comment.
Is it still needed since you removed them?
pyperf/_runner.py
Outdated
| show_name=True, | ||
| program_args=None, add_cmdline_args=None, | ||
| _argparser=None, warmups=1): | ||
| def is_worker(self) -> bool: |
|
Hi @vstinner , thanks for the review! I have updated the PR to address all your feedback:
I ran the build locally ( Please let me know if there is anything else! |
I don't see your changes :-( |
ec85475 to
7e85ac8
Compare
|
Hi,@vstinner I have force-pushed the updates. Removed the is_worker method and its documentation entirely. Removed the redundant pyperf. prefixes in doc/api.rst. Fixed the return type annotations and backticks as requested. Please let me know if it looks correct now! |
| @@ -3,7 +3,7 @@ | |||
| Runner CLI | |||
| ========== | |||
|
|
|||
There was a problem hiding this comment.
Can't you use .. module:: pyperf instead?
| @@ -180,7 +180,7 @@ a Python binding called "perf" as well. | |||
| Version 1.6.0 (2019-01-11) | |||
There was a problem hiding this comment.
Can't you use .. module:: pyperf instead of removing links?
|
Hi @vstinner Thanks for the detailed review! I have addressed all your feedback: Reverted doc/conf.py: I restored the original extensions and removed the nitpick_ignore block. Fixed Warnings: I used .. module:: pyperf with :noindex: in runner.rst and changelog.rst. This resolved the Sphinx warnings while allowing me to keep the links (like "Linux perf project") intact. API Docs: I updated get_dates() to move the return type information into the description text and removed the redundant pyperf. prefixes. Cleaned up: I reverted the unrelated code changes in _runner.py and fixed the formatting in the changelog (removed :class: and :func: usage). I verified that make -C doc html builds successfully with no warnings. Ready for another look! |
| -------------------------- | ||
|
|
||
| * Add *teardown* optional parameter to :class:`Runner.timeit` and ``--teardown`` | ||
| * Add *teardown* optional parameter to ``Runner.timeit`` and ``--teardown`` |
There was a problem hiding this comment.
Since the file now uses .. module:: pyperf, can't you keep :class: and :meth:?
Fixes #172
This PR resolves multiple Sphinx documentation warnings (reference target not found) that occurred when building the docs in nitpicky mode (-n).
🔧 Changes
Enabled Intersphinx: Updated doc/conf.py to include sphinx.ext.intersphinx, fixing broken links to standard library objects (e.g., datetime, float, sys.stdin).
Corrected API Namespace: Added .. module:: pyperf to doc/api.rst and updated class/method references to their fully qualified forms such as :class:pyperf.Benchmark and
:class:pyperf.Runner.Cleaned Up Method Signatures: Simplified or removed problematic type hints (e.g., -> int or float) in method signatures to prevent Sphinx parsing errors.
Stabilized Changelog References: Converted references to legacy or removed modules (e.g., perf, TextRunner) into literal code blocks to avoid link resolution failures.
Fixed Formatting Issues: Corrected indentation and list formatting errors in doc/changelog.rst that caused Sphinx warnings.
🧪 Verification
Documentation build verified locally using:
sphinx-build -n -b html doc/ _build/html
Result: Documentation now builds with zero warnings (previously ~46).