Skip to content

Fix GH #54853: BUG: DeprecationWarning for frontend.OptionParser when building docs #54854

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conversation

DavidToneian
Copy link
Contributor

@DavidToneian DavidToneian commented Aug 29, 2023

See docutils/docutils@6548b56#diff-a033583f6ace19fed2adc108b1c130e17ea00e1afee38c22c993cb477ad27a5fR453

@@ -159,10 +159,10 @@ def _get_page_title(self, page):
Open the rst file `page` and extract its title.
"""
fname = os.path.join(SOURCE_PATH, f"{page}.rst")
option_parser = docutils.frontend.OptionParser(
components=(docutils.parsers.rst.Parser,)
doc = docutils.utils.new_document(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you use something like this instead? https://stackoverflow.com/a/75996218

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could, but my understanding from the docs is that this version allows customization through a configuration file, whereas the SO answer does not. So I'd lean on keeping it like it is, but I'm happy to change the PR if you'd prefer.

(This is assuming you're not talking about supporting docutils prior to 0.18. Otherwise let me know.)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah I was referring to using get_default_settings. I would prefer using more "public" APIs from docutils rather then digging into docutils.core

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated as requested :)

@mroeschke mroeschke added the Docs label Aug 30, 2023
@mroeschke mroeschke added this to the 2.2 milestone Aug 30, 2023
@mroeschke mroeschke merged commit 2bca018 into pandas-dev:main Aug 30, 2023
@mroeschke
Copy link
Member

Thanks @DavidToneian

@DavidToneian DavidToneian deleted the fix-GH-54853-DeprecationWarning-frontend.OptionParser branch August 31, 2023 08:39
mroeschke added a commit to mroeschke/pandas that referenced this pull request Sep 11, 2023
…arser when building docs (pandas-dev#54854)

* Fix GH pandas-dev#54853: BUG: DeprecationWarning for frontend.OptionParser when building docs

See docutils/docutils@6548b56#diff-a033583f6ace19fed2adc108b1c130e17ea00e1afee38c22c993cb477ad27a5fR453

* Use `docutils.frontend.get_default_settings` instead of relying on `docutils.core`.

---------

Co-authored-by: Matthew Roeschke <10647082+mroeschke@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

BUG: DeprecationWarning for frontend.OptionParser when building docs
2 participants