Please refer to the v1.0.1
documentation;
the code for v1.0
is identical to the code for v1.0.1
.
See https://docs.cleanlab.ai/ if you want to browse the documentation (including for past versions).
In the cleanlab
repository, we've configured GitHub Actions to perform the following automatically:
-
When a commit is pushed to the
master
branch, a new version of themaster
docs will be built and deployed to thecleanlab-docs
repository. -
When a release is published, a new version of the docs with the corresponding release tag will be built and deployed as a new folder in the
cleanlab-docs
repository. Redirection to thestable
version of the docs will be changed to this newly released one, accessible via a link on the docs' site sidebar. All the older versions will remain available in thecleanlab-docs
repo, accessible by manually entering the subdirectory in the URL. -
When a user manually runs the workflow, one of the above will happen depending on the user's selection to run from a
branch
ortag
.
If you'd like to build our docs locally or remotely yourself, or want to know more about the steps taken in the GitHub Pages workflow, read on!
pip install -r docs/requirements.txt
-
Install Pandoc.
-
[Optional] Create a new branch, make your code changes, and then
git commit
them. ONLY COMMITTED CHANGES WILL BE REFLECTED IN THE DOCS BUILD. -
Build the docs with
sphinx-multiversion
:- If you're building from a branch (usually the
master
branch):
sphinx-multiversion docs/source cleanlab-docs -D smv_branch_whitelist=YOUR_BRANCH_NAME -D smv_tag_whitelist=None
- If you're building from a tag (usually the tag of the stable release):
sphinx-multiversion docs/source cleanlab-docs -D smv_branch_whitelist=None -D smv_tag_whitelist=YOUR_TAG_NAME
Note: To also build docs for another branch or tag, run the above command again changing only the
YOUR_BRANCH_NAME
orYOUR_TAG_NAME
placeholder.Fast build: Executing the Jupyter Notebooks (i.e., the
.ipynb
files) that make up some portion of the docs, such as the tutorials, takes a long time. If you want to skip rendering these, set the environment variableSKIP_NOTEBOOKS=1
. You can either set this usingexport SKIP_NOTEBOOKS=1
or do this inline withSKIP_NOTEBOOKS=1 sphinx-multiversion ...
.While building the docs, your terminal might output:
unknown config value 'smv_branch_whitelist' in override, ignoring
, andunknown config value 'smv_tag_whitelist' in override, ignoring
.
This is because the
smv_branch_whitelist
andsmv_tag_whitelist
config values are only used bysphinx-multiversion
, but may also be checked bysphinx
or other extensions that do not use them. Hence, these can be safely ignored as long as the docs are built correctly. - If you're building from a branch (usually the
-
[Optional] To show dynamic versioning and version warning banners:
-
Copy the
docs/_templates/versioning.js
file to thecleanlab-docs/
directory. -
In the copied
versioning.js
file:-
find
placeholder_version_number
and replace it with the latest release tag name, and -
find
placeholder_commit_hash
and replace it with themaster
branch commit hash.
-
-
-
[Optional] To redirect site visits from
/
or/stable
to the stable version of the docs:-
Create a copy of the
docs/_templates/redirect-to-stable.html
file and rename it asindex.html
. -
In this
index.html
file, findstable_url
and replace it with/cleanlab-docs/YOUR_LATEST_RELEASE_TAG_NAME/index.html
. -
Copy this
index.html
to:-
cleanlab-docs/
, and -
cleanlab-docs/stable/
.
-
-
-
The docs for each branch and/or tag can be found in the
cleanlab-docs/
directory, open any of theindex.html
in your browser to view the docs:
cleanlab-docs
| index.html (redirects to stable release of the docs)
| versioning.js (for dynamic versioning and version warning banner)
|
└───YOUR_BRANCH_NAME (e.g. master)
│ index.html
│ ...
│
└───YOUR_TAG_NAME_1 (e.g. your stable release tag name)
│ index.html
│ ...
│
└───YOUR_TAG_NAME_2 (e.g. an old release tag name)
│ index.html
│ ...
│
└───stable
│ index.html (redirects to stable release of the docs)
│
└───...
-
Fork the
cleanlab
repository. -
Create a new repository named
cleanlab-docs
and a new branch namedmaster
. -
In the
cleanlab-docs
repo, configure GitHub Pages; under the Source section, select themaster
branch and/(root)
folder. Take note of the URL where your site is published. -
Generate SSH deploy key and add them to your repos as such:
- In the
cleanlab-docs
repo, go to Settings > Deploy Keys > Add deploy key and add your public key with the Allow write access - In the
cleanlab
repo, go to Settings > Secrets > New repository secrets and add your private key namedACTIONS_DEPLOY_KEY
- In the
-
In the
cleanlab
repo, check that you have the GitHub Pages workflow under the repo's Actions tab. This should be created automatically from.github\workflows\gh-pages.yaml
. This workflow can be activated by any of the 3 triggers below:- A push to the
master
branch in thecleanlab
repo. - Publish of a new release in the
cleanlab
repo. - Manually run from the Run workflow option and select either the
master
branch or one of the release tag.
- A push to the
-
Activate the workflow with any of the 3 triggers listed above and wait for it to complete.
-
Navigate to the URL where your GitHub Pages site is published in step 3. The default URL should have the format https://repository_owner.github.io/cleanlab-docs/.
We've configured GitHub Actions to run the GitHub Pages workflow (gh-pages.yaml) to build and deploy our docs' static files. Here's a breakdown of what this workflow does in the background:
-
Spin up a Ubuntu server.
-
Install Pandoc, a document converter required by
nbsphinx
to generate static sites from notebooks (.ipynb
). -
Check-out the
cleanlab
repository. -
Setup Python and cache dependencies.
-
Install dependencies for the docs from
docs/requirements.txt
.
- Run Sphinx with the
sphinx-multiversion
wrapper to build the doc's static site files. These files will be outputted to thecleanlab-docs/
directory.
-
Get the latest release tag name and insert it in the
versioning.js
file. Theindex.html
of each doc version will read this as a variable and display it beside the stable hyperlink. -
Insert the latest commit hash in the
versioning.js
file. Theindex.html
of each doc version will read this as a variable and display it beside the developer hyperlink. -
Copy the
versioning.js
file to thecleanlab-docs/
folder.
If the workflow is triggered by a new release, generate the redirecting HTML which redirects site visits to the stable version
-
Insert the relative path to the stable docs in the
redirect-to-stable.html
file AKA the redirecting HTML. -
Create a copy of the
redirect-to-stable.html
file tocleanlab-docs/index.html
andcleanlab-docs/index.html
.
- Deploy
cleanlab-docs/
folder to thecleanlab/cleanlab-docs
repo'smaster branch
.