Skip to content

Commit

Permalink
chore: remove sphinx doc build (#631)
Browse files Browse the repository at this point in the history
  • Loading branch information
andrei-stoian-zama authored Apr 23, 2024
1 parent d5883c8 commit 3405978
Show file tree
Hide file tree
Showing 17 changed files with 490 additions and 1,238 deletions.
5 changes: 0 additions & 5 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -72,11 +72,6 @@ instance/
# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_apidoc/
docs/_build/
docs-copy/

# GitBook
docs/references/api/.pages

Expand Down
60 changes: 5 additions & 55 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -401,43 +401,10 @@ docker_clean_volumes:
.PHONY: docker_cv # Docker clean volumes
docker_cv: docker_clean_volumes


.PHONY: docs_no_links # Build docs
docs_no_links: clean_docs check_docs_dollars
@# Rebuild the index from README.md, to have in the home of Sphinx a copy of README.md
echo " .. Warning, auto-generated by \`make docs\`, don\'t edit" > docs/index.rst
echo "" >> docs/index.rst
pandoc --from markdown --to rst docs/README.md >> docs/index.rst
@# To be sure there is a blank line at the end
echo "" >> docs/index.rst
cat docs/index.toc.txt >> docs/index.rst
@# Create _static if nothing is commited in it
mkdir -p docs/_static/
@# Generate the auto summary of documentations
@# Cannot do without specifying top module currently with sphinx-apidoc
poetry run sphinx-apidoc --implicit-namespaces -o docs/_apidoc $(CONCRETE_PACKAGE_PATH)
@# Doing a copy of docs, where we modify files
rm -rf docs-copy
cp -r docs docs-copy
@# Admonitions
./script/make_utils/sphinx_gitbook_admonitions.sh --gitbook_to_sphinx
@# Check that there is no more GitBook hint
! grep -r "hint style" docs-copy
@# Replace $$, $/$ and /$$ by $
./script/make_utils/fix_double_dollars_issues_with_mdformat.sh docs-copy --single_dollar
@# Replace `href="*.md` patterns with `href="*.html` because Sphinx does not handle them
./script/make_utils/fix_md_to_html_conversion_from_sphinx_in_href.sh docs-copy
@# Replace `references/api/README.md` with `_apidoc/modules.html`.
./script/make_utils/fix_api_readme_reference.sh docs-copy
@# Fix not-compatible paths
./script/make_utils/fix_gitbook_paths.sh docs-copy
@# Docs
cd docs-copy && poetry run "$(MAKE)" html SPHINXOPTS='-W --keep-going'
@# Copy images from GitBook
cp docs/.gitbook/assets/*.png docs-copy/_build/html/_images
cp -r use_case_examples docs-copy/_build/
cp -r docs-copy/_build docs/
rm -rf docs-copy
docs_no_links: check_docs_dollars
@# Fix not-compatible paths that are sometimes generated by GitBook edits
./script/make_utils/fix_gitbook_paths.sh docs

.PHONY: docs # Build docs and check links
docs: docs_no_links
Expand All @@ -460,9 +427,6 @@ check_apidocs:
@# Check nothing has changed
./script/doc_utils/check_apidocs.sh

.PHONY: clean_docs # Clean docs build directory
clean_docs:
rm -rf docs/_apidoc docs/_build

.PHONY: check_docs_dollars # Check that latex equations are enclosed by double dollar signs
check_docs_dollars:
Expand All @@ -472,13 +436,6 @@ check_docs_dollars:
# show properly in gitbook
./script/make_utils/check_double_dollars_in_doc.sh

.PHONY: open_docs # Launch docs in a browser
open_docs:
python3 -m webbrowser -t "file://${PWD}/docs/_build/html/index.html"

.PHONY: docs_and_open # Make docs and open them in a browser
docs_and_open: docs open_docs

.PHONY: pydocstyle # Launch syntax checker on source code documentation
pydocstyle:
@# From http://www.pydocstyle.org/en/stable/error_codes.html
Expand Down Expand Up @@ -757,7 +714,7 @@ check_links:
@# To avoid some issues with priviledges and linkcheckmd
find docs/ -name "*.md" -type f | xargs chmod +r

@# Run linkcheck on mardown files. It is mainly used for web links and _api_doc (Sphinx)
@# Run linkcheck on mardown files. It is mainly used for web links
poetry run python -m linkcheckmd docs -local
poetry run python -m linkcheckmd README.md

Expand All @@ -774,20 +731,13 @@ check_links:
@# --ignore-url=https://www.openml.org: this website returns a lots of timeouts
@# --ignore-url=https://github.com/zama-ai/concrete-ml-internal/issues: because issues are
@# private
@# --ignore-url=.gitbook/assets : some gitbook functionalities use links to images to include
@# them in the docs. But sphinx does not copy such as images to the _build dir since
@# they are not included by image tags or sphinx image annotations. We ignore links
@# to gitbook images in the HTML checker. But the images are actually checked by the
@# markdown link checker, `local_link_check.sh`.
@# --ignore-url=https://arxiv.org: this website returns a lots of timeouts
poetry run linkchecker docs --check-extern \
--no-warnings \
--ignore-url=_static/webpack-macros.html \
--ignore-url=https://www.conventionalcommits.org/en/v1.0.0/ \
--ignore-url=https://www.openml.org \
--ignore-url=https://github.com/zama-ai/concrete-ml-internal/issues \
--ignore-url=https://arxiv.org \
--ignore-url=.gitbook/assets
--ignore-url=https://arxiv.org

.PHONY: actionlint # Linter for our github actions
actionlint:
Expand Down
17 changes: 9 additions & 8 deletions deps_licenses/licenses_linux_user.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ Name, Version, License
GitPython, 3.1.41, BSD License
PyYAML, 6.0.1, MIT License
anyio, 3.7.1, MIT License
boto3, 1.34.84, Apache Software License
botocore, 1.34.84, Apache Software License
boto3, 1.34.88, Apache Software License
botocore, 1.34.88, Apache Software License
brevitas, 0.8.0, UNKNOWN
certifi, 2023.7.22, Mozilla Public License 2.0 (MPL 2.0)
charset-normalizer, 3.3.2, MIT License
Expand All @@ -12,7 +12,7 @@ coloredlogs, 15.0.1, MIT License
concrete-python, 2.6.0rc1, BSD-3-Clause
dependencies, 2.0.1, BSD License
dill, 0.3.8, BSD License
exceptiongroup, 1.2.0, MIT License
exceptiongroup, 1.2.1, MIT License
fastapi, 0.103.2, MIT License
filelock, 3.13.4, The Unlicense (Unlicense)
flatbuffers, 24.3.25, Apache Software License
Expand Down Expand Up @@ -42,7 +42,7 @@ onnxoptimizer, 0.3.13, Apache License v2.0
onnxruntime, 1.17.3, MIT License
packaging, 24.0, Apache Software License; BSD License
pandas, 2.0.3, BSD License
pluggy, 1.4.0, MIT License
pluggy, 1.5.0, MIT License
protobuf, 3.20.3, BSD-3-Clause
psutil, 5.9.8, BSD License
pydantic, 1.10.15, MIT License
Expand All @@ -51,7 +51,7 @@ pytest-json-report, 1.5.0, MIT
pytest-metadata, 3.1.1, Mozilla Public License 2.0 (MPL 2.0)
python-dateutil, 2.9.0.post0, Apache Software License; BSD License
pytz, 2024.1, MIT License
regex, 2023.12.25, Apache Software License
regex, 2024.4.16, Apache Software License
requests, 2.31.0, Apache Software License
s3transfer, 0.10.1, Apache Software License
safetensors, 0.4.3, Apache Software License
Expand All @@ -67,14 +67,15 @@ starlette, 0.27.0, BSD License
sympy, 1.12, BSD License
tabulate, 0.8.10, MIT License
threadpoolctl, 3.4.0, BSD License
tokenizers, 0.15.2, Apache Software License
tokenizers, 0.19.1, Apache Software License
tomli, 2.0.1, MIT License
torch, 1.13.1, BSD License
tqdm, 4.66.2, MIT License; Mozilla Public License 2.0 (MPL 2.0)
transformers, 4.39.3, Apache Software License
transformers, 4.40.0, Apache Software License
typing_extensions, 4.5.0, Python Software Foundation License
tzdata, 2024.1, Apache Software License
urllib3, 2.2.1, MIT License
urllib3, 1.26.18, MIT License
uvicorn, 0.21.1, BSD License
xgboost, 1.6.2, Apache Software License
z3-solver, 4.13.0.0, MIT License
zipp, 3.18.1, MIT License
2 changes: 1 addition & 1 deletion deps_licenses/licenses_linux_user.txt.md5
Original file line number Diff line number Diff line change
@@ -1 +1 @@
180ea2b3232d89fc71be20d1707620b4
e672d77021d3214dea6c135c6e33e9a4
20 changes: 0 additions & 20 deletions docs/Makefile

This file was deleted.

140 changes: 0 additions & 140 deletions docs/conf.py

This file was deleted.

22 changes: 0 additions & 22 deletions docs/developer/documenting.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,25 +5,3 @@
Documentation with GitBook is done mainly by pushing content on GitHub. GitBook then pulls the docs from the repository and publishes. In most cases, GitBook is just a mirror of what is available in GitHub.

There are, however, some use-cases where documentation can be modified directly in GitBook (and, then, push the modifications to GitHub), for example when the documentation is modified by a person outside of Zama. In this case, a GitHub branch is created, and a GitHub space is associated to it: modifications are done in this space and automatically pushed to the branch. Once the modifications have been completed, one can simply create a pull-request, to finally merge modifications on the main branch.

## Using Sphinx

Documentation can alternatively be built using Sphinx:

```shell
make docs
```

The documentation contains both files written by hand by developers (the .md files) and files automatically created by parsing the source files.

Then to open it, go to `docs/_build/html/index.html` or use the follwing command:

```shell
make open_docs
```

To build and open the docs at the same time, use:

```shell
make docs_and_open
```
Loading

0 comments on commit 3405978

Please sign in to comment.