From 3ba18deaed316da32d42700d1d9ea57956bbed1e Mon Sep 17 00:00:00 2001 From: Bourgerie Quentin Date: Mon, 12 Aug 2024 15:43:59 +0200 Subject: [PATCH] chore(frontend-python/release): Check concrete-python API docs before releasing --- .github/workflows/concrete_python_release.yml | 13 ++- ci/scripts/make_apidocs.sh | 32 +++--- docs/dev/api/README.md | 108 +++++++++--------- .../api/concrete.compiler.library_support.md | 2 +- docs/dev/api/concrete.fhe.mlir.context.md | 18 +-- docs/dev/api/concrete.fhe.version.md | 4 +- 6 files changed, 98 insertions(+), 79 deletions(-) diff --git a/.github/workflows/concrete_python_release.yml b/.github/workflows/concrete_python_release.yml index 750cbe4fb1..8d45958eae 100644 --- a/.github/workflows/concrete_python_release.yml +++ b/.github/workflows/concrete_python_release.yml @@ -30,6 +30,17 @@ env: RELEASE_TYPE: ${{ inputs.user_inputs }} jobs: + release-checks: + runs-on: ${{ github.event.inputs.runner_name }} + steps: + - name: Checkout + uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + with: + submodules: recursive + fetch-depth: 0 + - name: Check python api doc is up to date + run: ci/scripts/make_apidocs.sh + build-linux-x86: strategy: matrix: @@ -227,7 +238,7 @@ jobs: base64-subjects: ${{ needs.hash.outputs.hash }} push: - needs: [build-linux-x86, build-macos, provenance] + needs: [release-checks, build-linux-x86, build-macos, provenance] runs-on: ubuntu-latest steps: - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 diff --git a/ci/scripts/make_apidocs.sh b/ci/scripts/make_apidocs.sh index 378fc6879b..10d5b3a070 100755 --- a/ci/scripts/make_apidocs.sh +++ b/ci/scripts/make_apidocs.sh @@ -36,26 +36,32 @@ rm -rf "$FRESH_DIRECTORY" # New files? echo "Warning. You might have new API-doc files to git add & push, don't forget" +SED_OPT='-i' +if [ $(uname) == "Darwin" ]; then + SED_OPT='-i ""' +fi + # 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 +sed $SED_OPT -e "s@../../$FRESH_DIRECTORY/.venvtrash/lib.*/python$WHICH_PYTHON_VERSION/site-packages/@../../../compilers/concrete-compiler/compiler/lib/Bindings/Python/@g" docs/dev/api/concrete.compiler*.md docs/dev/api/concrete.lang*.md +sed $SED_OPT -e "s@../../$FRESH_DIRECTORY/.venvtrash/lib.*/python$WHICH_PYTHON_VERSION/site-packages/@../../frontends/concrete-python/@g" docs/dev/api/concrete.fhe*.md + +# Fixing absolute path in doc +sed $SED_OPT -e "s@$PWD/$FRESH_DIRECTORY/@./@g" docs/dev/api/concrete.compiler.library_support.md # Fixing the links in README.md, which fails (missing .'s for some reason): remove the #headers -sed -i "" -e "s@.md#module-.*)@.md)@g" docs/dev/api/README.md -sed -i "" -e "s@.md#function-.*)@.md)@g" docs/dev/api/README.md -sed -i "" -e "s@.md#class-.*)@.md)@g" docs/dev/api/README.md +sed $SED_OPT -e "s@.md#module-.*)@.md)@g" docs/dev/api/README.md +sed $SED_OPT -e "s@.md#function-.*)@.md)@g" docs/dev/api/README.md +sed $SED_OPT -e "s@.md#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 +sed $SED_OPT -e "s@object at 0x[a-zA-Z0-9]*@object at ADDRESS@g" docs/*.md +sed $SED_OPT -e "s@object at 0x[a-zA-Z0-9]*@object at ADDRESS@g" docs/*/*.md +sed $SED_OPT -e "s@object at 0x[a-zA-Z0-9]*@object 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 +sed $SED_OPT -e "s@function Int at 0x[a-zA-Z0-9]*@function Int at ADDRESS@g" docs/*.md +sed $SED_OPT -e "s@function Int at 0x[a-zA-Z0-9]*@function Int at ADDRESS@g" docs/*/*.md +sed $SED_OPT -e "s@function Int at 0x[a-zA-Z0-9]*@function Int at ADDRESS@g" docs/*/*/*.md # Was there changes? if diff -r docs docs-copy; then diff --git a/docs/dev/api/README.md b/docs/dev/api/README.md index eb9bcfe741..09e7844ad7 100644 --- a/docs/dev/api/README.md +++ b/docs/dev/api/README.md @@ -4,6 +4,31 @@ ## Modules +- [`concrete.compiler`](./concrete.compiler.md): Compiler submodule. +- [`concrete.compiler.client_parameters`](./concrete.compiler.client_parameters.md): Client parameters. +- [`concrete.compiler.client_support`](./concrete.compiler.client_support.md): Client support. +- [`concrete.compiler.compilation_context`](./concrete.compiler.compilation_context.md): CompilationContext. +- [`concrete.compiler.compilation_feedback`](./concrete.compiler.compilation_feedback.md): Compilation feedback. +- [`concrete.compiler.compilation_options`](./concrete.compiler.compilation_options.md): CompilationOptions. +- [`concrete.compiler.evaluation_keys`](./concrete.compiler.evaluation_keys.md): EvaluationKeys. +- [`concrete.compiler.key_set`](./concrete.compiler.key_set.md): KeySet. +- [`concrete.compiler.key_set_cache`](./concrete.compiler.key_set_cache.md): KeySetCache. +- [`concrete.compiler.lambda_argument`](./concrete.compiler.lambda_argument.md): LambdaArgument. +- [`concrete.compiler.library_compilation_result`](./concrete.compiler.library_compilation_result.md): LibraryCompilationResult. +- [`concrete.compiler.library_lambda`](./concrete.compiler.library_lambda.md): LibraryLambda. +- [`concrete.compiler.library_support`](./concrete.compiler.library_support.md): LibrarySupport. +- [`concrete.compiler.parameter`](./concrete.compiler.parameter.md): Parameter. +- [`concrete.compiler.public_arguments`](./concrete.compiler.public_arguments.md): PublicArguments. +- [`concrete.compiler.public_result`](./concrete.compiler.public_result.md): PublicResult. +- [`concrete.compiler.server_circuit`](./concrete.compiler.server_circuit.md): ServerCircuit. +- [`concrete.compiler.server_program`](./concrete.compiler.server_program.md): ServerProgram. +- [`concrete.compiler.simulated_value_decrypter`](./concrete.compiler.simulated_value_decrypter.md): SimulatedValueDecrypter. +- [`concrete.compiler.simulated_value_exporter`](./concrete.compiler.simulated_value_exporter.md): SimulatedValueExporter. +- [`concrete.compiler.utils`](./concrete.compiler.utils.md): Common utils for the compiler submodule. +- [`concrete.compiler.value`](./concrete.compiler.value.md): Value. +- [`concrete.compiler.value_decrypter`](./concrete.compiler.value_decrypter.md): ValueDecrypter. +- [`concrete.compiler.value_exporter`](./concrete.compiler.value_exporter.md): ValueExporter. +- [`concrete.compiler.wrapper`](./concrete.compiler.wrapper.md): Wrapper for native Cpp objects. - [`concrete.fhe`](./concrete.fhe.md): Concrete. - [`concrete.fhe.compilation`](./concrete.fhe.compilation.md): Glue the compilation process together. - [`concrete.fhe.compilation.artifacts`](./concrete.fhe.compilation.artifacts.md): Declaration of `DebugArtifacts` class. @@ -70,32 +95,7 @@ - [`concrete.fhe.values.scalar`](./concrete.fhe.values.scalar.md): Declaration of `ClearScalar` and `EncryptedScalar` wrappers. - [`concrete.fhe.values.tensor`](./concrete.fhe.values.tensor.md): Declaration of `ClearTensor` and `EncryptedTensor` wrappers. - [`concrete.fhe.values.value_description`](./concrete.fhe.values.value_description.md): Declaration of `ValueDescription` class. -- [`concrete.fhe.version`](./concrete.fhe.version.md): Version of the project, which is updated automatically by the CI right before releasing. -- [`concrete.compiler`](./concrete.compiler.md): Compiler submodule. -- [`concrete.compiler.client_parameters`](./concrete.compiler.client_parameters.md): Client parameters. -- [`concrete.compiler.client_support`](./concrete.compiler.client_support.md): Client support. -- [`concrete.compiler.compilation_context`](./concrete.compiler.compilation_context.md): CompilationContext. -- [`concrete.compiler.compilation_feedback`](./concrete.compiler.compilation_feedback.md): Compilation feedback. -- [`concrete.compiler.compilation_options`](./concrete.compiler.compilation_options.md): CompilationOptions. -- [`concrete.compiler.evaluation_keys`](./concrete.compiler.evaluation_keys.md): EvaluationKeys. -- [`concrete.compiler.key_set`](./concrete.compiler.key_set.md): KeySet. -- [`concrete.compiler.key_set_cache`](./concrete.compiler.key_set_cache.md): KeySetCache. -- [`concrete.compiler.lambda_argument`](./concrete.compiler.lambda_argument.md): LambdaArgument. -- [`concrete.compiler.library_compilation_result`](./concrete.compiler.library_compilation_result.md): LibraryCompilationResult. -- [`concrete.compiler.library_lambda`](./concrete.compiler.library_lambda.md): LibraryLambda. -- [`concrete.compiler.library_support`](./concrete.compiler.library_support.md): LibrarySupport. -- [`concrete.compiler.parameter`](./concrete.compiler.parameter.md): Parameter. -- [`concrete.compiler.public_arguments`](./concrete.compiler.public_arguments.md): PublicArguments. -- [`concrete.compiler.public_result`](./concrete.compiler.public_result.md): PublicResult. -- [`concrete.compiler.server_circuit`](./concrete.compiler.server_circuit.md): ServerCircuit. -- [`concrete.compiler.server_program`](./concrete.compiler.server_program.md): ServerProgram. -- [`concrete.compiler.simulated_value_decrypter`](./concrete.compiler.simulated_value_decrypter.md): SimulatedValueDecrypter. -- [`concrete.compiler.simulated_value_exporter`](./concrete.compiler.simulated_value_exporter.md): SimulatedValueExporter. -- [`concrete.compiler.utils`](./concrete.compiler.utils.md): Common utils for the compiler submodule. -- [`concrete.compiler.value`](./concrete.compiler.value.md): Value. -- [`concrete.compiler.value_decrypter`](./concrete.compiler.value_decrypter.md): ValueDecrypter. -- [`concrete.compiler.value_exporter`](./concrete.compiler.value_exporter.md): ValueExporter. -- [`concrete.compiler.wrapper`](./concrete.compiler.wrapper.md): Wrapper for native Cpp objects. +- [`concrete.fhe.version`](./concrete.fhe.version.md) - [`concrete.lang`](./concrete.lang.md): Concretelang python module - [`concrete.lang.dialects`](./concrete.lang.dialects.md) - [`concrete.lang.dialects.fhe`](./concrete.lang.dialects.fhe.md): FHE dialect module @@ -104,6 +104,30 @@ ## Classes +- [`client_parameters.ClientParameters`](./concrete.compiler.client_parameters.md): ClientParameters are public parameters used for key generation. +- [`client_support.ClientSupport`](./concrete.compiler.client_support.md): Client interface for doing key generation and encryption. +- [`compilation_context.CompilationContext`](./concrete.compiler.compilation_context.md): Support class for compilation context. +- [`compilation_feedback.CircuitCompilationFeedback`](./concrete.compiler.compilation_feedback.md): CircuitCompilationFeedback is a set of hint computed by the compiler engine for a circuit. +- [`compilation_feedback.ProgramCompilationFeedback`](./concrete.compiler.compilation_feedback.md): CompilationFeedback is a set of hint computed by the compiler engine. +- [`compilation_options.CompilationOptions`](./concrete.compiler.compilation_options.md): CompilationOptions holds different flags and options of the compilation process. +- [`evaluation_keys.EvaluationKeys`](./concrete.compiler.evaluation_keys.md): EvaluationKeys required for execution. +- [`key_set.KeySet`](./concrete.compiler.key_set.md): KeySet stores the different keys required for an encrypted computation. +- [`key_set_cache.KeySetCache`](./concrete.compiler.key_set_cache.md): KeySetCache is a cache for KeySet to avoid generating similar keys multiple times. +- [`lambda_argument.LambdaArgument`](./concrete.compiler.lambda_argument.md): LambdaArgument holds scalar or tensor values. +- [`library_compilation_result.LibraryCompilationResult`](./concrete.compiler.library_compilation_result.md): LibraryCompilationResult holds the result of the library compilation. +- [`library_lambda.LibraryLambda`](./concrete.compiler.library_lambda.md): LibraryLambda reference a compiled library and can be ran using LibrarySupport. +- [`library_support.LibrarySupport`](./concrete.compiler.library_support.md): Support class for library compilation and execution. +- [`parameter.Parameter`](./concrete.compiler.parameter.md): An FHE parameter. +- [`public_arguments.PublicArguments`](./concrete.compiler.public_arguments.md): PublicArguments holds encrypted and plain arguments, as well as public materials. +- [`public_result.PublicResult`](./concrete.compiler.public_result.md): PublicResult holds the result of an encrypted execution and can be decrypted using ClientSupport. +- [`server_circuit.ServerCircuit`](./concrete.compiler.server_circuit.md): ServerCircuit references a circuit that can be called for execution and simulation. +- [`server_program.ServerProgram`](./concrete.compiler.server_program.md): ServerProgram references compiled circuit objects. +- [`simulated_value_decrypter.SimulatedValueDecrypter`](./concrete.compiler.simulated_value_decrypter.md): A helper class to decrypt `Value`s. +- [`simulated_value_exporter.SimulatedValueExporter`](./concrete.compiler.simulated_value_exporter.md): A helper class to create `Value`s. +- [`value.Value`](./concrete.compiler.value.md): An encrypted/clear value which can be scalar/tensor. +- [`value_decrypter.ValueDecrypter`](./concrete.compiler.value_decrypter.md): A helper class to decrypt `Value`s. +- [`value_exporter.ValueExporter`](./concrete.compiler.value_exporter.md): A helper class to create `Value`s. +- [`wrapper.WrapperCpp`](./concrete.compiler.wrapper.md): Wrapper base class for native Cpp objects. - [`artifacts.DebugArtifacts`](./concrete.fhe.compilation.artifacts.md): DebugArtifacts class, to export information about the compilation process for single function. - [`artifacts.FunctionDebugArtifacts`](./concrete.fhe.compilation.artifacts.md): An object containing debug artifacts for a certain function in an fhe module. - [`artifacts.ModuleDebugArtifacts`](./concrete.fhe.compilation.artifacts.md): An object containing debug artifacts for an fhe module. @@ -312,33 +336,13 @@ - [`typing.uint8`](./concrete.fhe.tracing.typing.md): Scalar uint8 annotation. - [`typing.uint9`](./concrete.fhe.tracing.typing.md): Scalar uint9 annotation. - [`value_description.ValueDescription`](./concrete.fhe.values.value_description.md): ValueDescription class, to combine data type, shape, and encryption status into a single object. -- [`client_parameters.ClientParameters`](./concrete.compiler.client_parameters.md): ClientParameters are public parameters used for key generation. -- [`client_support.ClientSupport`](./concrete.compiler.client_support.md): Client interface for doing key generation and encryption. -- [`compilation_context.CompilationContext`](./concrete.compiler.compilation_context.md): Support class for compilation context. -- [`compilation_feedback.CircuitCompilationFeedback`](./concrete.compiler.compilation_feedback.md): CircuitCompilationFeedback is a set of hint computed by the compiler engine for a circuit. -- [`compilation_feedback.ProgramCompilationFeedback`](./concrete.compiler.compilation_feedback.md): CompilationFeedback is a set of hint computed by the compiler engine. -- [`compilation_options.CompilationOptions`](./concrete.compiler.compilation_options.md): CompilationOptions holds different flags and options of the compilation process. -- [`evaluation_keys.EvaluationKeys`](./concrete.compiler.evaluation_keys.md): EvaluationKeys required for execution. -- [`key_set.KeySet`](./concrete.compiler.key_set.md): KeySet stores the different keys required for an encrypted computation. -- [`key_set_cache.KeySetCache`](./concrete.compiler.key_set_cache.md): KeySetCache is a cache for KeySet to avoid generating similar keys multiple times. -- [`lambda_argument.LambdaArgument`](./concrete.compiler.lambda_argument.md): LambdaArgument holds scalar or tensor values. -- [`library_compilation_result.LibraryCompilationResult`](./concrete.compiler.library_compilation_result.md): LibraryCompilationResult holds the result of the library compilation. -- [`library_lambda.LibraryLambda`](./concrete.compiler.library_lambda.md): LibraryLambda reference a compiled library and can be ran using LibrarySupport. -- [`library_support.LibrarySupport`](./concrete.compiler.library_support.md): Support class for library compilation and execution. -- [`parameter.Parameter`](./concrete.compiler.parameter.md): An FHE parameter. -- [`public_arguments.PublicArguments`](./concrete.compiler.public_arguments.md): PublicArguments holds encrypted and plain arguments, as well as public materials. -- [`public_result.PublicResult`](./concrete.compiler.public_result.md): PublicResult holds the result of an encrypted execution and can be decrypted using ClientSupport. -- [`server_circuit.ServerCircuit`](./concrete.compiler.server_circuit.md): ServerCircuit references a circuit that can be called for execution and simulation. -- [`server_program.ServerProgram`](./concrete.compiler.server_program.md): ServerProgram references compiled circuit objects. -- [`simulated_value_decrypter.SimulatedValueDecrypter`](./concrete.compiler.simulated_value_decrypter.md): A helper class to decrypt `Value`s. -- [`simulated_value_exporter.SimulatedValueExporter`](./concrete.compiler.simulated_value_exporter.md): A helper class to create `Value`s. -- [`value.Value`](./concrete.compiler.value.md): An encrypted/clear value which can be scalar/tensor. -- [`value_decrypter.ValueDecrypter`](./concrete.compiler.value_decrypter.md): A helper class to decrypt `Value`s. -- [`value_exporter.ValueExporter`](./concrete.compiler.value_exporter.md): A helper class to create `Value`s. -- [`wrapper.WrapperCpp`](./concrete.compiler.wrapper.md): Wrapper base class for native Cpp objects. ## Functions +- [`compiler.init_dfr`](./concrete.compiler.md): Initialize dataflow parallelization. +- [`compiler.round_trip`](./concrete.compiler.md): Parse the MLIR input, then return it back. +- [`compilation_feedback.tag_from_location`](./concrete.compiler.compilation_feedback.md): Extract tag of the operation from its location. +- [`utils.lookup_runtime_lib`](./concrete.compiler.utils.md): Try to find the absolute path to the runtime library. - [`decorators.circuit`](./concrete.fhe.compilation.decorators.md): Provide a direct interface for compilation of single circuit programs. - [`decorators.compiler`](./concrete.fhe.compilation.decorators.md): Provide an easy interface for the compilation of single-circuit programs. - [`decorators.function`](./concrete.fhe.compilation.decorators.md): Provide an easy interface to define a function within an fhe module. @@ -393,7 +397,3 @@ - [`tensor.encrypted_tensor_builder`](./concrete.fhe.values.tensor.md): Build an encrypted tensor value. - [`tensor.clear_tensor_builder`](./concrete.fhe.values.tensor.md): Build a clear tensor value. - [`tensor.encrypted_tensor_builder`](./concrete.fhe.values.tensor.md): Build an encrypted tensor value. -- [`compiler.init_dfr`](./concrete.compiler.md): Initialize dataflow parallelization. -- [`compiler.round_trip`](./concrete.compiler.md): Parse the MLIR input, then return it back. -- [`compilation_feedback.tag_from_location`](./concrete.compiler.compilation_feedback.md): Extract tag of the operation from its location. -- [`utils.lookup_runtime_lib`](./concrete.compiler.utils.md): Try to find the absolute path to the runtime library. diff --git a/docs/dev/api/concrete.compiler.library_support.md b/docs/dev/api/concrete.compiler.library_support.md index a60e313a3c..c4cbf3fdc5 100644 --- a/docs/dev/api/concrete.compiler.library_support.md +++ b/docs/dev/api/concrete.compiler.library_support.md @@ -230,7 +230,7 @@ Load the server lambda for a given circuit from the library compilation result. ```python new( - output_path: str = '/Users/benoitchevalliermames/Documents/Zama/Git/concrete/tempdirectoryforapidocs/concrete-compiler_compilation_artifacts', + output_path: str = './concrete-compiler_compilation_artifacts', runtime_library_path: Optional[str] = None, generateSharedLib: bool = True, generateStaticLib: bool = False, diff --git a/docs/dev/api/concrete.fhe.mlir.context.md b/docs/dev/api/concrete.fhe.mlir.context.md index 734522360f..2bbd045d61 100644 --- a/docs/dev/api/concrete.fhe.mlir.context.md +++ b/docs/dev/api/concrete.fhe.mlir.context.md @@ -1193,7 +1193,7 @@ Packs inputs of multivariate table lookups. --- - + ### method `reinterpret` @@ -1380,7 +1380,7 @@ tlu(resulting_type: ConversionType, on: Conversion, table: Sequence[int]) --- - + ### method `to_signed` @@ -1394,7 +1394,7 @@ to_signed(x: Conversion) → Conversion --- - + ### method `to_signedness` @@ -1408,7 +1408,7 @@ to_signedness(x: Conversion, of: ConversionType) → Conversion --- - + ### method `to_unsigned` @@ -1422,7 +1422,7 @@ to_unsigned(x: Conversion) → Conversion --- - + ### method `transpose` @@ -1440,7 +1440,7 @@ transpose( --- - + ### method `tree_add` @@ -1454,7 +1454,7 @@ tree_add(resulting_type: ConversionType, xs: List[Conversion]) → Conversion --- - + ### method `truncate_bit_pattern` @@ -1509,7 +1509,7 @@ Get type corresponding to a value or a node. --- - + ### method `where` @@ -1528,7 +1528,7 @@ where( --- - + ### method `zeros` diff --git a/docs/dev/api/concrete.fhe.version.md b/docs/dev/api/concrete.fhe.version.md index d6b4955cdc..374226348a 100644 --- a/docs/dev/api/concrete.fhe.version.md +++ b/docs/dev/api/concrete.fhe.version.md @@ -3,7 +3,9 @@ # module `concrete.fhe.version` -Version of the project, which is updated automatically by the CI right before releasing. + + +