Skip to content

Commit

Permalink
docs(frontend-python): write examples guide
Browse files Browse the repository at this point in the history
  • Loading branch information
umut-sahin committed Sep 24, 2024
1 parent 65fc4f7 commit 52636e4
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 0 deletions.
1 change: 1 addition & 0 deletions docs/SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@
* [SDFG dialect](explanations/SDFGDialect.md)
* [Call FHE circuits from other languages](explanations/call_from_other_language.md)
* [Benchmarking](dev/benchmarking.md)
* [Examples](dev/examples.md)
* [Making a release](explanations/releasing.md)
* [Release note](https://github.com/zama-ai/concrete/releases)
* [Feature request](https://github.com/zama-ai/concrete/issues/new?assignees=\&labels=feature\&projects=\&template=features.md)
Expand Down
26 changes: 26 additions & 0 deletions docs/dev/examples.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Examples

This document gives an overview of the structure of the examples, which are tutorials containing more or less elaborated usages of Concrete, to showcase its functionality on practical use cases. Examples are either provided as a Python script or a Jupyter notebook.

## Concrete Python

### How to create an example?

#### Jupyter notebook example

- Create `examples/foo/foo.ipynb`
- Write the example in the notebook
- The notebook will be executed in the CI with `make test-notebooks` target

#### Python script example

- Create `examples/foo/foo.py`
- Write the example in the script
- Example should contain a class called `Foo`
- `Foo` should have the following arguments in its `__init__`:
- configuration: Optional\[fhe.Configuration] = None
- compiled: bool = True
- It should compile the circuit with an appropriate inputset using the given configuration if compiled is true
- It should have any additional common utilities (e.g., encoding/decoding) shared between the tests and the benchmarks
- Then, add tests for the implementation in `tests/execution/test_examples.py`
- Optionally, create `benchmarks/foo.py` and [add benchmarks](benchmarking.md#how-to-add-new-benchmarks).

0 comments on commit 52636e4

Please sign in to comment.