ci/docs: fix copy integration sub-docs (#18921)

This commit is contained in:
Jirka Borovec 2023-11-03 01:45:00 +09:00 committed by GitHub
parent 2b6b594dab
commit e9dcf4840e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 9 additions and 8 deletions

View File

@ -440,14 +440,14 @@ class AssistantCLI:
def pull_docs_files(
gh_user_repo: str,
target_dir: str = "docs/source-pytorch/XXX",
checkout: str = "tags/1.0.0",
checkout: str = "refs/tags/1.0.0",
source_dir: str = "docs/source",
as_orphan: bool = False,
) -> None:
"""Pull docs pages from external source and append to local docs."""
import zipfile
zip_url = f"https://github.com/{gh_user_repo}/archive/refs/{checkout}.zip"
zip_url = f"https://github.com/{gh_user_repo}/archive/{checkout}.zip"
with tempfile.TemporaryDirectory() as tmp:
zip_file = os.path.join(tmp, "repo.zip")
@ -483,7 +483,7 @@ class AssistantCLI:
page = fopen.read()
if as_orphan and ":orphan:" not in page:
page = ":orphan:\n\n" + page
with open(rst_in, "w", encoding="utf-8") as fopen:
with open(rst_out, "w", encoding="utf-8") as fopen:
fopen.write(page)

View File

@ -254,7 +254,7 @@ epub_exclude_files = ["search.html"]
intersphinx_mapping = {
"python": ("https://docs.python.org/3", None),
"torch": ("https://pytorch.org/docs/stable/", None),
# "numpy": ("https://docs.scipy.org/doc/numpy/", None),
"numpy": ("https://docs.scipy.org/doc/numpy/", None),
}
nitpicky = True

View File

@ -92,19 +92,20 @@ _transform_changelog(
assist_local.AssistantCLI.pull_docs_files(
gh_user_repo="Lightning-AI/lightning-Habana",
target_dir="docs/source-pytorch/integrations/hpu",
checkout="tags/1.2.0",
checkout="4eca3d9a9744e24e67924ba1534f79b55b59e5cd", # this is post `refs/tags/1.2.0`
)
assist_local.AssistantCLI.pull_docs_files(
gh_user_repo="Lightning-AI/lightning-Graphcore",
target_dir="docs/source-pytorch/integrations/ipu",
checkout="tags/v0.1.0",
checkout="refs/tags/v0.1.0",
as_orphan=True, # todo: this can be dropped after new IPU release
)
# the IPU also need one image
URL_RAW_DOCS_GRAPHCORE = "https://raw.githubusercontent.com/Lightning-AI/lightning-Graphcore/v0.1.0/docs/source"
for img in ["_static/images/ipu/profiler.png"]:
os.makedirs(os.path.dirname(os.path.join(_PATH_HERE, img)), exist_ok=True)
urllib.request.urlretrieve(f"{URL_RAW_DOCS_GRAPHCORE}/{img}", os.path.join(_PATH_HERE, img))
img_ = os.path.join(_PATH_HERE, "integrations", "ipu", img)
os.makedirs(os.path.dirname(img_), exist_ok=True)
urllib.request.urlretrieve(f"{URL_RAW_DOCS_GRAPHCORE}/{img}", img_)
if _FETCH_S3_ASSETS: