-
Notifications
You must be signed in to change notification settings - Fork 0
/
update_docs.py
29 lines (24 loc) · 944 Bytes
/
update_docs.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
"""
Adapted from:
https://github.com/explosion/projects/blob/v3/.github/update_docs.py
"""
from pathlib import Path
from weasel.cli.document import project_document
from spacy.cli._util import PROJECT_FILE
from wasabi import msg
import typer
def main(root: Path = typer.Argument(Path.cwd(), help="Root path to look in")):
"""
Automatically update all auto-generated docs in the repo. If existing
auto-generated docs are found, only that section is replaced. README.md
files including an ignore comment are skipped (e.g. to support projects
without an auto-generated README and prevent those files from being
auto-replaced).
"""
msg.info(f"Updating auto-generated docs in {root}")
# We look specifically for project directories
for path in root.glob(f"**/*/{PROJECT_FILE}"):
path = path.parent
project_document(path, path / "README.md")
if __name__ == "__main__":
typer.run(main)