Skip to content

Commit

Permalink
feat: 🎸 add basis for the docs (#421)
Browse files Browse the repository at this point in the history
* feat: 🎸 add basis for the docs

* ci: 🎡 fix the path

* ci: 🎡 add delete doc comment workflow

* chore: 🤖 add make preview for the docs

* docs: ✏️ update the docs/ README

* docs: ✏️ list of endpoints

* docs: ✏️ write documentation

* docs: ✏️ fix the format inside a "Tip" tag

* Update docs/source/index.mdx

Co-authored-by: Mario Šaško <mario@huggingface.co>

* Apply suggestions from code review

Co-authored-by: Steven Liu <59462357+stevhliu@users.noreply.github.com>
Co-authored-by: Mario Šaško <mario@huggingface.co>

* Apply suggestions from code review

Co-authored-by: Steven Liu <59462357+stevhliu@users.noreply.github.com>

* docs: ✏️ Apply suggestions from code review

* docs: ✏️ allow to click on the link in the examples

* ci: 🎡 publish the doc to huggingface/doc-build

Co-authored-by: Mario Šaško <mario@huggingface.co>
Co-authored-by: Steven Liu <59462357+stevhliu@users.noreply.github.com>
  • Loading branch information
3 people authored Jun 28, 2022
1 parent f2f5706 commit 5860f15
Show file tree
Hide file tree
Showing 15 changed files with 976 additions and 0 deletions.
18 changes: 18 additions & 0 deletions .github/workflows/build_documentation.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: Build documentation

on:
push:
branches:
- main
- doc-builder*
- v*-release

jobs:
build:
uses: huggingface/doc-builder/.github/workflows/build_main_documentation.yml@main
with:
commit_sha: ${{ github.sha }}
package: datasets-server
additional_args: --not_python_module
secrets:
token: ${{ secrets.HUGGINGFACE_PUSH }}
17 changes: 17 additions & 0 deletions .github/workflows/build_pr_documentation.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: Build PR Documentation

on:
pull_request:

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true

jobs:
build:
uses: huggingface/doc-builder/.github/workflows/build_pr_documentation.yml@main
with:
commit_sha: ${{ github.event.pull_request.head.sha }}
pr_number: ${{ github.event.number }}
package: datasets-server
additional_args: --not_python_module
13 changes: 13 additions & 0 deletions .github/workflows/delete_doc_comment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
name: Delete dev documentation

on:
pull_request:
types: [ closed ]


jobs:
delete:
uses: huggingface/doc-builder/.github/workflows/delete_doc_comment.yml@main
with:
pr_number: ${{ github.event.number }}
package: datasets-server
1 change: 1 addition & 0 deletions docs/.python-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.9.6
13 changes: 13 additions & 0 deletions docs/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
BUILD_DIR?=~/tmp/doc-datasets-server

.PHONY: install
install:
poetry install

.PHONY: build
build:
poetry run doc-builder build datasets-server source/ --build_dir $(BUILD_DIR) --not_python_module

.PHONY: preview
preview:
poetry run doc-builder preview datasets-server source/ --not_python_module
80 changes: 80 additions & 0 deletions docs/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
<!---
Copyright 2022 The HuggingFace Team. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->

# Generate the documentation

To generate the documentation, you first have to build it. Several packages are necessary to build the doc,
you can install them with the following command, in this directory:

```bash
make install
```

---

**NOTE**

You only need to generate the documentation to inspect it locally (if you're planning changes and want to
check how they look like before committing for instance). You don't have to commit the built documentation.

---

## Preview the documentation

Once you have setup the `doc-builder` and additional packages, you can preview the documentation by typing the
following command:

```bash
make preview
```

The documentation is available at http://localhost:3000/.

## Build the documentation

To build the documentation, launch:

```bash
BUILD_DIR=/tmp/doc-datasets-server/ make build
```

You can adapt the `BUILD_DIR` environment variable to set any temporary folder that you prefer. This command will create it and generate
the MDX files that will be rendered as the documentation on the main website. You can inspect them in your favorite
Markdown editor.

---

**NOTE**

It's not possible to see locally how the final documentation will look like for now. Once you have opened a PR, you
will see a bot add a comment to a link where the documentation with your changes lives.

---

## Adding a new element to the navigation bar

Accepted files are Markdown (.md or .mdx).

Create a file with its extension and put it in the source directory. You can then link it to the toc-tree by putting
the filename without the extension in the [`_toctree.yml`](https://github.com/huggingface/datasets-server/blob/main/docs/source/_toctree.yml) file.

## Adding an image

Due to the rapidly growing repository, it is important to make sure that no files that would significantly weigh down the repository are added. This includes images, videos and other non-text files. We prefer to leverage a hf.co hosted `dataset` like
the ones hosted on [`hf-internal-testing`](https://huggingface.co/hf-internal-testing) in which to place these files and reference
them by URL. We recommend putting them in the following dataset: [huggingface/documentation-images](https://huggingface.co/datasets/huggingface/documentation-images).
If an external contribution, feel free to add the images to your PR and ask a Hugging Face member to migrate your images
to this dataset.
Loading

0 comments on commit 5860f15

Please sign in to comment.