Skip to content

Commit a9a7a1f

Browse files
authored
Merge pull request #676 from DagsHub/bug/docs-build
Infra: Add GH action for docs build passing
2 parents 72c4f9d + b93880e commit a9a7a1f

File tree

8 files changed

+66
-38
lines changed

8 files changed

+66
-38
lines changed

.github/workflows/docs-publish.yml

Lines changed: 34 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,16 @@
1-
name: Publish Docs
1+
name: Docs
22

33
on:
44
workflow_dispatch:
55
release:
6-
types: [published]
6+
types: [ published ]
7+
pull_request:
8+
branches:
9+
- main
710

811
jobs:
9-
deploy:
10-
12+
build:
13+
name: Build documentation
1114
runs-on: ubuntu-latest
1215

1316
defaults:
@@ -18,42 +21,58 @@ jobs:
1821
- uses: actions/checkout@v4
1922

2023
- name: Set up Python
21-
uses: actions/setup-python@v4
24+
uses: actions/setup-python@v6
2225
with:
2326
python-version: "3.x"
27+
2428
- name: Install client and dependencies
2529
working-directory: "./"
2630
run: |
2731
python -m pip install --upgrade pip setuptools
2832
pip install .
33+
2934
- name: Install docs dependencies
3035
run: |
3136
pip install -r requirements-docs.txt
37+
3238
- name: Build documentation
33-
run: make html
39+
run: SPHINXOPTS="-W" make html
3440

35-
# - name: Upload docs as artifact
36-
# uses: actions/upload-artifact@v3
37-
# with:
38-
# name: docs
39-
# path: docs/build
41+
- name: Upload build artifact
42+
if: github.event_name == 'release' || github.event_name == 'workflow_dispatch'
43+
uses: actions/upload-artifact@v4
44+
with:
45+
name: docs-html
46+
path: docs/build/html
47+
48+
deploy:
49+
name: Deploy documentation
50+
needs: build
51+
if: github.event_name == 'release' || github.event_name == 'workflow_dispatch'
52+
runs-on: ubuntu-latest
53+
54+
steps:
55+
- name: Download build artifact
56+
uses: actions/download-artifact@v4
57+
with:
58+
name: docs-html
59+
path: docs-html
4060

4161
- name: Authenticate with Google
4262
uses: "google-github-actions/auth@v2"
4363
with:
4464
project_id: ${{ secrets.GCS_PROJECT }}
4565
credentials_json: ${{ secrets.GCS_SERVICE_ACCOUNT_ACCESS_KEY }}
4666

47-
- name: 'Set up Cloud SDK'
48-
uses: 'google-github-actions/setup-gcloud@v2'
67+
- name: Set up Cloud SDK
68+
uses: "google-github-actions/setup-gcloud@v2"
4969

5070
- name: Upload to Google Cloud Storage
5171
env:
5272
UPLOAD_PATH: ${{ format('gs://{0}/docs/client', secrets.DOCS_BUCKET) }}
53-
run: gsutil -m rsync -d -r build/html $UPLOAD_PATH
73+
run: gsutil -m rsync -d -r docs-html $UPLOAD_PATH
5474

5575
- name: Invalidate CDN Cache
5676
env:
5777
LOAD_BALANCER: ${{ secrets.LOAD_BALANCER_NAME }}
5878
run: gcloud compute url-maps invalidate-cdn-cache $LOAD_BALANCER --async --path "/docs/client/*"
59-

dagshub/common/cli.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -339,7 +339,7 @@ def create(ctx, repo_name, upload_data, clone, verbose, quiet):
339339
create a repo and optionally:
340340
341341
- upload files to 'data' from a URL dir using `-u` flag. .zip and .tar files are extracted,
342-
other formats copied as is.
342+
other formats copied as is.
343343
344344
- clone the repo locally using `--clone` flag
345345

dagshub/data_engine/annotation/voxel_conversion.py

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,14 @@
33
from typing import TYPE_CHECKING
44

55
if TYPE_CHECKING:
6-
from dagshub.data_engine.client.models import Datapoint
7-
import fiftyone as fo
6+
import fiftyone
7+
8+
from dagshub.data_engine.model.datapoint import Datapoint
89

910
logger = logging.getLogger(__name__)
1011

1112

12-
def add_voxel_annotations(sample: "fo.Sample", datapoint: "Datapoint", *annotation_fields: str):
13+
def add_voxel_annotations(sample: "fiftyone.Sample", datapoint: "Datapoint", *annotation_fields: str):
1314
"""
1415
Adds annotation to the voxel sample.
1516
@@ -26,7 +27,7 @@ def add_voxel_annotations(sample: "fo.Sample", datapoint: "Datapoint", *annotati
2627
sample.add_labels(label, label_field=field)
2728

2829

29-
def add_ls_annotations(sample: "fo.Sample", datapoint: "Datapoint", *annotation_fields: str):
30+
def add_ls_annotations(sample: "fiftyone.Sample", datapoint: "Datapoint", *annotation_fields: str):
3031
"""
3132
Adds LabelStudio annotation to the voxel sample.
3233
@@ -35,17 +36,17 @@ def add_ls_annotations(sample: "fo.Sample", datapoint: "Datapoint", *annotation_
3536
datapoint: Data Engine datapoint to get metadata from
3637
annotation_fields: fields from which to get annotations
3738
"""
38-
from fiftyone.utils.labelstudio import import_label_studio_annotation
3939
from fiftyone import (
40-
Detections,
41-
Detection,
4240
Classification,
4341
Classifications,
42+
Detection,
43+
Detections,
4444
Keypoint,
4545
Keypoints,
46-
Polylines,
4746
Polyline,
47+
Polylines,
4848
)
49+
from fiftyone.utils.labelstudio import import_label_studio_annotation
4950

5051
for field in annotation_fields:
5152
annotations = datapoint.metadata.get(field)

dagshub/data_engine/model/query.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,13 @@
22
import enum
33
import logging
44
import uuid
5-
from typing import Optional, Union, Dict
5+
from typing import Dict, Optional, Union
66

7-
import pytz
8-
from treelib import Tree, Node
7+
from treelib import Node, Tree
98

9+
from dagshub.data_engine.dtypes import MetadataFieldType
1010
from dagshub.data_engine.model.errors import WrongOperatorError
1111
from dagshub.data_engine.model.schema_util import metadata_type_lookup, metadata_type_lookup_reverse
12-
from dagshub.data_engine.dtypes import MetadataFieldType
1312

1413
logger = logging.getLogger(__name__)
1514

@@ -24,7 +23,7 @@ def bytes_deserializer(val: str) -> bytes:
2423
_metadataTypeCustomConverters = {
2524
bool: lambda x: x.lower() == "true",
2625
bytes: bytes_deserializer,
27-
datetime.datetime: lambda x: datetime.datetime.fromtimestamp(int(x) / 1000).astimezone(pytz.utc),
26+
datetime.datetime: lambda x: datetime.datetime.fromtimestamp(int(x) / 1000, tz=datetime.timezone.utc),
2827
}
2928

3029

docs/Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ help:
1818
# Catch-all target: route all unknown targets to Sphinx using the new
1919
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
2020
%: Makefile
21-
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
21+
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) --exception-on-warning -W
2222

2323
serve:
24-
sphinx-autobuild "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) --watch "$(CODEDIR)" $(O)
24+
sphinx-autobuild -W "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) --watch "$(CODEDIR)" $(O)

docs/requirements-docs.txt

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
sphinx==7.3.7
2-
furo==2024.5.6
3-
sphinx-autobuild==2024.4.16
1+
sphinx==9.1.0
2+
furo==2025.12.19
3+
sphinx-autobuild==2025.8.25
44
sphinx-copybutton==0.5.2
5-
sphinx-sitemap==2.6.0
6-
sphinx-click==5.0.1
7-
sphinx-autodoc-typehints==2.3.0
5+
sphinx-sitemap==2.9.0
6+
sphinx-click==6.2.0
7+
sphinx-autodoc-typehints==3.9.9

docs/source/conf.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,19 @@
88

99
import os
1010
import sys
11+
import types
12+
from datetime import datetime
1113

1214
project_root = os.path.join(__file__, "../../..")
1315
sys.path.insert(0, os.path.abspath(project_root))
1416

17+
# Fix for is_mlflow_installed reading the spec of the module that is not imported in the doc build environment
18+
_env_mod = types.ModuleType("dagshub.common.environment")
19+
_env_mod.is_mlflow_installed = False
20+
sys.modules["dagshub.common.environment"] = _env_mod
21+
1522
project = "DagsHub Client"
16-
copyright = "2023, DagsHub"
23+
copyright = f"{datetime.now().year}, DagsHub"
1724
author = "DagsHub"
1825

1926
# -- General configuration ---------------------------------------------------

docs/source/reference/metric_logging.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
:orphan:
2+
13
Metric Logging (``dagshub.logger``)
24
====================================
35

0 commit comments

Comments
 (0)