Skip to content

Commit

Permalink
docs(compiler): adding API doc
Browse files Browse the repository at this point in the history
  • Loading branch information
bcm-at-zama committed Mar 13, 2024
1 parent 9dcf1c4 commit 8fef8d1
Show file tree
Hide file tree
Showing 333 changed files with 17,055 additions and 244 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/scripts/check_for_license.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ for file in $files
do
cmp <(head -n 4 $file) <(echo "// Part of the Concrete Compiler Project, under the BSD3 License with Zama
// Exceptions. See
// https://github.com/zama-ai/concrete-compiler-internal/blob/main/LICENSE.txt
// https://github.com/zama-ai/concrete/blob/main/LICENSE.txt
// for license information.") || print_and_exit $file
done

Expand All @@ -23,5 +23,5 @@ files=$(find ./compiler/{include,lib,src} -iregex '^.*\.\(py\)$' ! -path ./compi
for file in $files
do
cmp <(head -n 2 $file) <(echo "# Part of the Concrete Compiler Project, under the BSD3 License with Zama Exceptions.
# See https://github.com/zama-ai/concrete-compiler-internal/blob/main/LICENSE.txt for license information.") || print_and_exit $file
# See https://github.com/zama-ai/concrete/blob/main/LICENSE.txt for license information.") || print_and_exit $file
done
18 changes: 18 additions & 0 deletions .github/workflows/testing_doc_is_updated.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Check that the documentation is up to date
name: Check that the documentation is up to date

on:
# Nightly Release @ 3AM after each work day
- cron: "0 3 * * 2-6"

jobs:
check-doc:
name: Check that the documentation is up to date
runs-on: ubuntu-20.04
steps:
- name: Check that the documentation is up to date
shell: bash
run: |
set +e
./ci/scripts/make_apidocs.sh
95 changes: 95 additions & 0 deletions ci/scripts/make_apidocs.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
#!/usr/bin/env bash

# In this script, we:
# create a fresh directory
# create a fresh venv
# download the last CP
# make API docs for it

FRESH_DIRECTORY="tempdirectoryforapidocs"

# Keep a copy of the doc, to check changes
rm -rf docs-copy
cp -r docs docs-copy

# Remote old files
rm docs/dev/api/*.md

set -e

# Make a new fresh venv, and install the last public CP there (hence, the --isolated to not take
# nightlies)
rm -rf "$FRESH_DIRECTORY"
mkdir "$FRESH_DIRECTORY"
cd "$FRESH_DIRECTORY"
python3 -m venv .venvtrash
source .venvtrash/bin/activate
pip install concrete-python --index-url https://pypi.org/simple --isolated
pip install lazydocs

# Make API doc files
.venvtrash/bin/lazydocs --output-path="../docs/dev/api" --overview-file="README.md" --src-base-url="../../" --no-watermark concrete
cd -

# Add the files in the summary
FILES=$(cd docs && find dev/api -name "*.md")

TMP_FILE=$(mktemp /tmp/apidocs.XXXXXX)
rm -rf "$TMP_FILE"
touch "$TMP_FILE"

for f in $FILES
do
filename=$(echo "$f" | rev | cut -d '/' -f 1 | rev)

echo " - [$filename]($f)" >> "$TMP_FILE"
done

FINAL_FILE="docs/SUMMARY.md"
NEW_FINAL_FILE="docs/SUMMARY.md.tmp"

grep "<!-- auto-created, do not edit, begin -->" $FINAL_FILE -B 100000 > $NEW_FINAL_FILE
sort "$TMP_FILE" | grep -v "\[README.md\]" >> $NEW_FINAL_FILE
grep "<!-- auto-created, do not edit, end -->" $FINAL_FILE -A 100000 >> $NEW_FINAL_FILE

mv $NEW_FINAL_FILE $FINAL_FILE

rm -rf "$FRESH_DIRECTORY"

# New files?
echo "Warning. You might have new API-doc files to git add & push, don't forget"

# Fixing the path issues, to point on files in GitHub
WHICH_PYTHON_VERSION=$(python3 --version | cut -f 2 -d " " | cut -f 1-2 -d ".")
sed -i "" -e "s@../../$FRESH_DIRECTORY/.venvtrash/lib/python$WHICH_PYTHON_VERSION/site-packages/@../../../compilers/concrete-compiler/compiler/lib/Bindings/Python/@g" docs/dev/api/*.md

# Fixing the links in README.md, which fails (missing .'s for some reason): remove the #headers
sed -i "" -e "[email protected]#module-.*)@.md)@g" docs/dev/api/README.md
sed -i "" -e "[email protected]#function-.*)@.md)@g" docs/dev/api/README.md
sed -i "" -e "[email protected]#class-.*)@.md)@g" docs/dev/api/README.md

# Removed the "object addresses" and "function addresses", since they are not constant
sed -i "" -e "s@object at 0x[a-zA-z0-9]*@object at ADDRESS@g" docs/*.md
sed -i "" -e "s@object at 0x[a-zA-z0-9]*@object at ADDRESS@g" docs/*/*.md
sed -i "" -e "s@object at 0x[a-zA-z0-9]*@object at ADDRESS@g" docs/*/*/*.md

sed -i "" -e "s@function Int at 0x[a-zA-z0-9]*@function Int at ADDRESS@g" docs/*.md
sed -i "" -e "s@function Int at 0x[a-zA-z0-9]*@function Int at ADDRESS@g" docs/*/*.md
sed -i "" -e "s@function Int at 0x[a-zA-z0-9]*@function Int at ADDRESS@g" docs/*/*/*.md

# FIXME: remove this once the PR has been merged once
sed -i "" -e "s@https://github.com/zama-ai/concrete-compiler-internal/blob/main/LICENSE.txt@https://github.com/zama-ai/concrete/blob/main/LICENSE.txt@g" ./docs/dev/api/concrete.lang.dialects.md ./docs/dev/api/concrete.compiler.md ./docs/dev/api/concrete.lang.md

# Was there changes?
if diff -r docs docs-copy; then
echo ""
else
echo "There is a difference in the docs, please commit the changes"
exit -1
fi

# If there were changes, the previous command will stop, thanks to set -e
rm -rf docs-copy

echo "Successful end"

Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Part of the Concrete Compiler Project, under the BSD3 License with Zama
// Exceptions. See
// https://github.com/zama-ai/concrete-compiler-internal/blob/main/LICENSE.txt
// https://github.com/zama-ai/concrete/blob/main/LICENSE.txt
// for license information.

#ifndef CONCRETELANG_BOOST_OUTCOME_H
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Part of the Concrete Compiler Project, under the BSD3 License with Zama
// Exceptions. See
// https://github.com/zama-ai/concrete-compiler-internal/blob/main/LICENSE.txt
// https://github.com/zama-ai/concrete/blob/main/LICENSE.txt
// for license information.

// Infrastructure for type inference
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Part of the Concrete Compiler Project, under the BSD3 License with Zama
// Exceptions. See
// https://github.com/zama-ai/concrete-compiler-internal/blob/main/LICENSE.txt
// https://github.com/zama-ai/concrete/blob/main/LICENSE.txt
// for license information.

#ifndef CONCRETELANG_ANALYSIS_UTILS_H
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Part of the Concrete Compiler Project, under the BSD3 License with Zama
// Exceptions. See
// https://github.com/zama-ai/concrete-compiler-internal/blob/main/LICENSE.txt
// https://github.com/zama-ai/concrete/blob/main/LICENSE.txt
// for license information.

#ifndef CONCRETELANG_BINDINGS_PYTHON_COMPILER_API_MODULE_H
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Part of the Concrete Compiler Project, under the BSD3 License with Zama
// Exceptions. See
// https://github.com/zama-ai/concrete-compiler-internal/blob/main/LICENSE.txt
// https://github.com/zama-ai/concrete/blob/main/LICENSE.txt
// for license information.

#ifndef CONCRETELANG_BINDINGS_PYTHON_DIALECTMODULES_H
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Part of the Concrete Compiler Project, under the BSD3 License with Zama
// Exceptions. See
// https://github.com/zama-ai/concrete-compiler-internal/blob/main/LICENSE.txt
// https://github.com/zama-ai/concrete/blob/main/LICENSE.txt
// for license information.

#ifndef CONCRETELANG_CAPI_WRAPPERS_H
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Part of the Concrete Compiler Project, under the BSD3 License with Zama
// Exceptions. See
// https://github.com/zama-ai/concrete-compiler-internal/blob/main/LICENSE.txt
// https://github.com/zama-ai/concrete/blob/main/LICENSE.txt
// for license information.

#ifndef CONCRETELANG_CLIENTLIB_REFACTORED_H
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Part of the Concrete Compiler Project, under the BSD3 License with Zama
// Exceptions. See
// https://github.com/zama-ai/concrete-compiler-internal/blob/main/LICENSE.txt
// https://github.com/zama-ai/concrete/blob/main/LICENSE.txt
// for license information.

#ifndef CONCRETELANG_COMMON_CRT_H_
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Part of the Concrete Compiler Project, under the BSD3 License with Zama
// Exceptions. See
// https://github.com/zama-ai/concrete-compiler-internal/blob/main/LICENSE.txt
// https://github.com/zama-ai/concrete/blob/main/LICENSE.txt
// for license information.
//
// NOTE:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Part of the Concrete Compiler Project, under the BSD3 License with Zama
// Exceptions. See
// https://github.com/zama-ai/concrete-compiler-internal/blob/main/LICENSE.txt
// https://github.com/zama-ai/concrete/blob/main/LICENSE.txt
// for license information.

#ifndef CONCRETELANG_COMMON_CSPRNG_H
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Part of the Concrete Compiler Project, under the BSD3 License with Zama
// Exceptions. See
// https://github.com/zama-ai/concrete-compiler-internal/blob/main/LICENSE.txt
// https://github.com/zama-ai/concrete/blob/main/LICENSE.txt
// for license information.
#ifndef CONCRETELANG_COMMON_ERROR_H
#define CONCRETELANG_COMMON_ERROR_H
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Part of the Concrete Compiler Project, under the BSD3 License with Zama
// Exceptions. See
// https://github.com/zama-ai/concrete-compiler-internal/blob/main/LICENSE.txt
// https://github.com/zama-ai/concrete/blob/main/LICENSE.txt
// for license information.

#ifndef CONCRETELANG_COMMON_KEYS_H
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Part of the Concrete Compiler Project, under the BSD3 License with Zama
// Exceptions. See
// https://github.com/zama-ai/concrete-compiler-internal/blob/main/LICENSE.txt
// https://github.com/zama-ai/concrete/blob/main/LICENSE.txt
// for license information.

#ifndef CONCRETELANG_COMMON_KEYSETS_H
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Part of the Concrete Compiler Project, under the BSD3 License with Zama
// Exceptions. See
// https://github.com/zama-ai/concrete-compiler-internal/blob/main/LICENSE.txt
// https://github.com/zama-ai/concrete/blob/main/LICENSE.txt
// for license information.

#ifndef CONCRETELANG_COMMON_PROTOCOL_H
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Part of the Concrete Compiler Project, under the BSD3 License with Zama
// Exceptions. See
// https://github.com/zama-ai/concrete-compiler-internal/blob/main/LICENSE.txt
// https://github.com/zama-ai/concrete/blob/main/LICENSE.txt
// for license information.

#ifndef CONCRETELANG_COMMON_TRANSFORMERS_H
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Part of the Concrete Compiler Project, under the BSD3 License with Zama
// Exceptions. See
// https://github.com/zama-ai/concrete-compiler-internal/blob/main/LICENSE.txt
// https://github.com/zama-ai/concrete/blob/main/LICENSE.txt
// for license information.

#ifndef CONCRETELANG_COMMON_VALUES_H
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Part of the Concrete Compiler Project, under the BSD3 License with Zama
// Exceptions. See
// https://github.com/zama-ai/concrete-compiler-internal/blob/main/LICENSE.txt
// https://github.com/zama-ai/concrete/blob/main/LICENSE.txt
// for license information.

#ifndef ZAMALANG_CONVERSION_CONCRETETOCAPI_PASS_H_
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Part of the Concrete Compiler Project, under the BSD3 License with Zama
// Exceptions. See
// https://github.com/zama-ai/concrete-compiler-internal/blob/main/LICENSE.txt
// https://github.com/zama-ai/concrete/blob/main/LICENSE.txt
// for license information.

#ifndef CONCRETELANG_CONVERSION_EXTRACTSDFGOPS_PASS_H_
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Part of the Concrete Compiler Project, under the BSD3 License with Zama
// Exceptions. See
// https://github.com/zama-ai/concrete-compiler-internal/blob/main/LICENSE.txt
// https://github.com/zama-ai/concrete/blob/main/LICENSE.txt
// for license information.

#ifndef CONCRETELANG_CONVERSION_FHETENSOROPSTOLINALG_PASS_H_
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Part of the Concrete Compiler Project, under the BSD3 License with Zama
// Exceptions. See
// https://github.com/zama-ai/concrete-compiler-internal/blob/main/LICENSE.txt
// https://github.com/zama-ai/concrete/blob/main/LICENSE.txt
// for license information.

#ifndef CONCRETELANG_CONVERSION_FHETOTFHECRT_PASS_H_
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Part of the Concrete Compiler Project, under the BSD3 License with Zama
// Exceptions. See
// https://github.com/zama-ai/concrete-compiler-internal/blob/main/LICENSE.txt
// https://github.com/zama-ai/concrete/blob/main/LICENSE.txt
// for license information.

#ifndef CONCRETELANG_CONVERSION_FHETOTFHESCALAR_PASS_H_
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Part of the Concrete Compiler Project, under the BSD3 License with Zama
// Exceptions. See
// https://github.com/zama-ai/concrete-compiler-internal/blob/main/LICENSE.txt
// https://github.com/zama-ai/concrete/blob/main/LICENSE.txt
// for license information.

#ifndef ZAMALANG_CONVERSION_LINALGEXTRAS_PASS_H_
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Part of the Concrete Compiler Project, under the BSD3 License with Zama
// Exceptions. See
// https://github.com/zama-ai/concrete-compiler-internal/blob/main/LICENSE.txt
// https://github.com/zama-ai/concrete/blob/main/LICENSE.txt
// for license information.

#ifndef CONCRETELANG_CONVERSION_MLIRLOWERABLEDIALECTSTOLLVM_PASS_H_
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Part of the Concrete Compiler Project, under the BSD3 License with Zama
// Exceptions. See
// https://github.com/zama-ai/concrete-compiler-internal/blob/main/LICENSE.txt
// https://github.com/zama-ai/concrete/blob/main/LICENSE.txt
// for license information.

#ifndef CONCRETELANG_TRANSFORMS_PASSES_H
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Part of the Concrete Compiler Project, under the BSD3 License with Zama
// Exceptions. See
// https://github.com/zama-ai/concrete-compiler-internal/blob/main/LICENSE.txt
// https://github.com/zama-ai/concrete/blob/main/LICENSE.txt
// for license information.

#ifndef ZAMALANG_CONVERSION_SDFGTOSTREAMEMULATOR_PASS_H_
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Part of the Concrete Compiler Project, under the BSD3 License with Zama
// Exceptions. See
// https://github.com/zama-ai/concrete-compiler-internal/blob/main/LICENSE.txt
// https://github.com/zama-ai/concrete/blob/main/LICENSE.txt
// for license information.

#ifndef CONCRETELANG_CONVERSION_SIMULATE_TFHE_PASS_H_
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Part of the Concrete Compiler Project, under the BSD3 License with Zama
// Exceptions. See
// https://github.com/zama-ai/concrete-compiler-internal/blob/main/LICENSE.txt
// https://github.com/zama-ai/concrete/blob/main/LICENSE.txt
// for license information.

#ifndef CONCRETELANG_CONVERSION_TFHEGLOBALPARAMETRIZATION_PASS_H_
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Part of the Concrete Compiler Project, under the BSD3 License with Zama
// Exceptions. See
// https://github.com/zama-ai/concrete-compiler-internal/blob/main/LICENSE.txt
// https://github.com/zama-ai/concrete/blob/main/LICENSE.txt
// for license information.

#ifndef CONCRETELANG_CONVERSION_TFHEKEYNORMALIZATION_PASS_H_
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Part of the Concrete Compiler Project, under the BSD3 License with Zama
// Exceptions. See
// https://github.com/zama-ai/concrete-compiler-internal/blob/main/LICENSE.txt
// https://github.com/zama-ai/concrete/blob/main/LICENSE.txt
// for license information.

#ifndef CONCRETELANG_CONVERSION_TFHETOCONCRETE_PASS_H_
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Part of the Concrete Compiler Project, under the BSD3 License with Zama
// Exceptions. See
// https://github.com/zama-ai/concrete-compiler-internal/blob/main/LICENSE.txt
// https://github.com/zama-ai/concrete/blob/main/LICENSE.txt
// for license information.

#include "mlir/IR/PatternMatch.h"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Part of the Concrete Compiler Project, under the BSD3 License with Zama
// Exceptions. See
// https://github.com/zama-ai/concrete-compiler-internal/blob/main/LICENSE.txt
// https://github.com/zama-ai/concrete/blob/main/LICENSE.txt
// for license information.

#ifndef ZAMALANG_CONVERSION_TRACINGTOCAPI_PASS_H_
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Part of the Concrete Compiler Project, under the BSD3 License with Zama
// Exceptions. See
// https://github.com/zama-ai/concrete-compiler-internal/blob/main/LICENSE.txt
// https://github.com/zama-ai/concrete/blob/main/LICENSE.txt
// for license information.

#ifndef CONCRETELANG_CONVERSION_UTILS_DIALECTS_SCF_H_
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Part of the Concrete Compiler Project, under the BSD3 License with Zama
// Exceptions. See
// https://github.com/zama-ai/concrete-compiler-internal/blob/main/LICENSE.txt
// https://github.com/zama-ai/concrete/blob/main/LICENSE.txt
// for license information.

#ifndef CONCRETELANG_CONVERSION_UTILS_DIALECTS_TENSOR_H_
Expand Down
Loading

0 comments on commit 8fef8d1

Please sign in to comment.