Skip to content

Commit

Permalink
ci/docs: fix copy integration sub-docs (#18921)
Browse files Browse the repository at this point in the history
  • Loading branch information
Borda authored Nov 2, 2023
1 parent 2b6b594 commit e9dcf48
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 8 deletions.
6 changes: 3 additions & 3 deletions .actions/assistant.py
Original file line number Diff line number Diff line change
Expand Up @@ -440,14 +440,14 @@ def copy_replace_imports(
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")
Expand Down Expand Up @@ -483,7 +483,7 @@ def _copy_rst(rst_in, rst_out, as_orphan: bool = False):
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)


Expand Down
2 changes: 1 addition & 1 deletion docs/source-app/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@
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
Expand Down
9 changes: 5 additions & 4 deletions docs/source-pytorch/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,19 +92,20 @@ def _load_py_module(name: str, location: str) -> ModuleType:
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:
Expand Down

0 comments on commit e9dcf48

Please sign in to comment.