chore: bump pydoc-markdown version used in the CI (#3955)

* use latest pydoc-markdown

* make the workflow manually actionable

* Apply suggestions from code review

Co-authored-by: Silvano Cerza <3314350+silvanocerza@users.noreply.github.com>

Co-authored-by: Silvano Cerza <3314350+silvanocerza@users.noreply.github.com>
This commit is contained in:
Massimiliano Pippi 2023-01-26 16:58:43 +01:00 committed by GitHub
parent 2bbe11b598
commit 7f6ed941d4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 3 deletions

View File

@ -1,6 +1,7 @@
name: Sync docs with Readme
on:
workflow_dispatch:
push:
branches:
- main
@ -24,7 +25,7 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install pydoc-markdown==4.5.1
pip install pydoc-markdown==4.6.4
- name: Generate API docs
run: ./.github/utils/pydoc-markdown.sh

View File

@ -44,11 +44,11 @@ class ReadmeRenderer(Renderer):
def render(self, modules: t.List[docspec.Module]) -> None:
if self.markdown.filename is None:
sys.stdout.write(self._frontmatter())
self.markdown.render_to_stream(modules, sys.stdout)
self.markdown.render_single_page(sys.stdout, modules)
else:
with io.open(self.markdown.filename, "w", encoding=self.markdown.encoding) as fp:
fp.write(self._frontmatter())
self.markdown.render_to_stream(modules, t.cast(t.TextIO, fp))
self.markdown.render_single_page(t.cast(t.TextIO, fp), modules)
def _frontmatter(self) -> str:
return README_FRONTMATTER.format(