Remove legacy Sphinx roles from docstrings#8016
Open
Pchambet wants to merge 1 commit intohuggingface:mainfrom
Open
Remove legacy Sphinx roles from docstrings#8016Pchambet wants to merge 1 commit intohuggingface:mainfrom
Pchambet wants to merge 1 commit intohuggingface:mainfrom
Conversation
Replace :obj:, :class:, :func:, and :meth: Sphinx roles with plain backtick references to match the project's current documentation conventions. Examples of changes: :obj:`bool` -> `bool` :class:`DatasetInfo` -> `DatasetInfo` :func:`fsspec.open` -> `fsspec.open` :meth:`datasets.Datasets.select` -> `datasets.Datasets.select` :obj:`~pathlib.Path` -> `Path` :class:`~download.DownloadConfig` -> `DownloadConfig` 14 files, 71 replacements. No logic changes. Relates to huggingface#5324
stevhliu
reviewed
Feb 23, 2026
Member
stevhliu
left a comment
There was a problem hiding this comment.
cool, thanks for cleaning up! i left a few notes about fixing up the formatting
Comment on lines
+1464
to
+1465
| a `DatasetInfo` that was dumped to a JSON object. This acts as an analogue to | ||
| `Features.from_arrow_schema` and handles the recursive field-by-field instantiation, but doesn't require any |
Member
There was a problem hiding this comment.
if it's a dataset class or method, you can use brackets to render it as a link :)
Suggested change
| a `DatasetInfo` that was dumped to a JSON object. This acts as an analogue to | |
| `Features.from_arrow_schema` and handles the recursive field-by-field instantiation, but doesn't require any | |
| a [`DatasetInfo`] that was dumped to a JSON object. This acts as an analogue to | |
| [`Features.from_arrow_schema`] and handles the recursive field-by-field instantiation, but doesn't require any |
| Args: | ||
| feature (FeatureType): the feature type to be checked | ||
| ignore_decode_attribute (:obj:`bool`, default ``False``): Whether to ignore the current value | ||
| ignore_decode_attribute (`bool`, default ``False``): Whether to ignore the current value |
Member
There was a problem hiding this comment.
Suggested change
| ignore_decode_attribute (`bool`, default ``False``): Whether to ignore the current value | |
| ignore_decode_attribute (`bool`, default `False`): Whether to ignore the current value |
| def keep_features_dicts_synced(func): | ||
| """ | ||
| Wrapper to keep the secondary dictionary, which tracks whether keys are decodable, of the :class:`datasets.Features` object | ||
| Wrapper to keep the secondary dictionary, which tracks whether keys are decodable, of the `datasets.Features` object |
Member
There was a problem hiding this comment.
use the ~ to hide the "datasets" part from rendering in the link
Suggested change
| Wrapper to keep the secondary dictionary, which tracks whether keys are decodable, of the `datasets.Features` object | |
| Wrapper to keep the secondary dictionary, which tracks whether keys are decodable, of the [`~datasets.Features`] object |
| mode (:obj:``str``): Currently, only 'rb' accepted | ||
| target_protocol(:obj:``str``, optional): To override the FS protocol inferred from a URL. | ||
| target_options (:obj:``dict``, optional): Kwargs passed when instantiating the target FS. | ||
| fo (``str``): Path to compressed file. Will fetch file using ``fsspec.open()`` |
Member
There was a problem hiding this comment.
lets remove all the double backticks here
Suggested change
| fo (``str``): Path to compressed file. Will fetch file using ``fsspec.open()`` | |
| fo (`str`): Path to compressed file. Will fetch file using ``fsspec.open()`` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Replace all remaining
:obj:,:class:,:func:, and:meth:Sphinx cross-reference roles with plain backtick references, aligning with the project's current documentation conventions.14 files, 71 replacements. No logic changes.
Context
As noted in #5324, the codebase had a mix of old Sphinx syntax and the modern backtick-only format used by HuggingFace's doc builder. @stevhliu mentioned that the user-facing APIs had been cleaned up, but old syntax was still lingering in non-public APIs. This PR catches the remaining occurrences.
What changed
:obj:\bool```bool`:class:\DatasetInfo```DatasetInfo`:func:\fsspec.open```fsspec.open`:meth:\...```...`:obj:\~pathlib.Path```Path`:class:\~download.DownloadConfig```DownloadConfig`Tilde references (
~module.Class) are resolved to their short name (Class), matching the existing convention in the codebase.Files touched
Relates to #5324