From ff40ec71390ac04a089a43824a32f809f7faa56b Mon Sep 17 00:00:00 2001 From: augray Date: Wed, 8 Jan 2025 07:43:15 -0800 Subject: [PATCH] remove references to in-repo bazel examples --- docs/contribute-example.md | 36 ++----------------- sematic/examples/README.md | 4 +-- sematic/examples/bazel/__init__.py | 0 sematic/examples/bazel/bazel.py | 22 ------------ sematic/examples/bazel/pipeline.py | 33 ----------------- sematic/examples/cifar_classifier/README.md | 11 ------ .../hackernews_summarization/README.md | 4 --- sematic/examples/lightning_resnet/README.md | 11 ------ sematic/examples/testing_pipeline/README.md | 11 ------ 9 files changed, 4 insertions(+), 128 deletions(-) delete mode 100644 sematic/examples/bazel/__init__.py delete mode 100644 sematic/examples/bazel/bazel.py delete mode 100644 sematic/examples/bazel/pipeline.py diff --git a/docs/contribute-example.md b/docs/contribute-example.md index 9b174500d..6faea6fc8 100644 --- a/docs/contribute-example.md +++ b/docs/contribute-example.md @@ -56,44 +56,12 @@ to from sematic.examples.my_package.pipeline import pipeline ``` -### Integrate in the build system. - -The Sematic codebase uses [Bazel](https://bazel.build/) as a build system. - -Don't worry, you don't have to learn its details. Simply add a `BUILD` file at -the root of your package: - -``` -# sematic/examples/my_package/BUILD - -sematic_example( - name = "my_package", - requirements = [ - # List of third-party requirements - # e.g. "torch", "pandas" - ], - data = [ - # If your example uses local data files (e.g. CSV files) - # Add a relative path to them here. - ] -) -``` - -Then you should be able to run (after [installing Bazel](https://bazel.build/install)): - -```shell -$ bazel run //sematic/examples/my_package -``` - ### Third-party requirements -As a monorepo, Sematic keeps a centralized list of third-party requirements at -[requirements/requirements.in](https://github.com/sematic-ai/sematic/blob/main/requirements/requirements.in). +Sematic keeps a centralized list of third-party requirements in its pyproject.toml If the third-party libraries required by your new examples are not in there -(Bazel will let you know), add them to -[requirements/requirements.in](https://github.com/sematic-ai/sematic/blob/main/requirements/requirements.in), -under the `# Examples` section. +, add them under the `examples` optional dependencies. Don't worry, your third-party dependencies will not be added to the Sematic pip wheel. diff --git a/sematic/examples/README.md b/sematic/examples/README.md index e5bd95065..abbc69219 100644 --- a/sematic/examples/README.md +++ b/sematic/examples/README.md @@ -6,8 +6,8 @@ You can run these examples using the Sematic CLI: $ sematic run examples/add ``` -Examples are shorthand simple pipelines declared using the `sematic_pipeline` -Bazel rule, which expects a `__main__.py` file as the execution entry point. +Examples are shorthand simple pipelines +which expect a `__main__.py` file as the execution entry point. They can only be executed locally. For cloud execution, you will need to declare your own entry points which invoke execution using `CloudRunner`. diff --git a/sematic/examples/bazel/__init__.py b/sematic/examples/bazel/__init__.py deleted file mode 100644 index e69de29bb..000000000 diff --git a/sematic/examples/bazel/bazel.py b/sematic/examples/bazel/bazel.py deleted file mode 100644 index 580598f91..000000000 --- a/sematic/examples/bazel/bazel.py +++ /dev/null @@ -1,22 +0,0 @@ -# Standard Library -import argparse -import logging - -# Sematic -import sematic -from sematic.examples.bazel.pipeline import pipeline - - -logging.basicConfig(level=logging.INFO) -logger = logging.getLogger(__name__) - - -if __name__ == "__main__": - parser = argparse.ArgumentParser("Bazel Example") - parser.add_argument("--detach", default=False, action="store_true") - - args = parser.parse_args() - - logger.info("Starting bazel example...") - future = pipeline(1, 2, 3) - sematic.CloudRunner(detach=args.detach).run(future) diff --git a/sematic/examples/bazel/pipeline.py b/sematic/examples/bazel/pipeline.py deleted file mode 100644 index 6c165e501..000000000 --- a/sematic/examples/bazel/pipeline.py +++ /dev/null @@ -1,33 +0,0 @@ -# Standard Library -import time - -# Sematic -import sematic - - -@sematic.func(standalone=True) -def add(a: float, b: float) -> float: - time.sleep(5) - return a + b - - -@sematic.func(standalone=True) -def add3(a: float, b: float, c: float) -> float: - return add(add(a, b), c) - - -@sematic.func(standalone=True) -def fail() -> float: - return fail_nested() - - -@sematic.func(standalone=True) -def fail_nested() -> float: - raise ValueError("Some exception") - - -@sematic.func -def pipeline(a: float, b: float, c: float) -> float: - # return add(add3(a, b, c), add(a, b)) - # return add(a, b) - return fail() diff --git a/sematic/examples/cifar_classifier/README.md b/sematic/examples/cifar_classifier/README.md index 1a58eb855..13ddb0530 100644 --- a/sematic/examples/cifar_classifier/README.md +++ b/sematic/examples/cifar_classifier/README.md @@ -26,17 +26,6 @@ context. ## Running -### Bazel - -After updating [BUILD](./BUILD) with your own registry and repository, you can -launch the pipeline with: - -```bash -$ bazel run sematic/examples/cifar_classifier:main -- --cloud -``` - -### Native Docker - After updating [main.yaml](./main.yaml) with your own registry and repository, you can launch the pipeline with: diff --git a/sematic/examples/hackernews_summarization/README.md b/sematic/examples/hackernews_summarization/README.md index bedc64051..478912c1c 100644 --- a/sematic/examples/hackernews_summarization/README.md +++ b/sematic/examples/hackernews_summarization/README.md @@ -28,10 +28,6 @@ Arguments Example usage: -```shell -$ bazel run sematic/examples/hackernews_summarization:hackernews_summarization -- --query llm --openai-api-key '' -``` - ```shell $ sematic run examples/hackernews_summarization --query llm --openai-api-key '' ``` diff --git a/sematic/examples/lightning_resnet/README.md b/sematic/examples/lightning_resnet/README.md index f6ccebd45..a11fc0ae3 100644 --- a/sematic/examples/lightning_resnet/README.md +++ b/sematic/examples/lightning_resnet/README.md @@ -34,17 +34,6 @@ mid-execution from a programming error. See [`test_pipeline.py`](./tests/test_pi ## Running -### Bazel - -After updating [BUILD](./BUILD) with your own registry and repository, you can -launch the pipeline with: - -```bash -$ bazel run sematic/examples/lightning_resnet:main -- --cloud -``` - -### Native Docker - After updating [main.yaml](./main.yaml) with your own registry and repository, you can launch the pipeline with: diff --git a/sematic/examples/testing_pipeline/README.md b/sematic/examples/testing_pipeline/README.md index 0f2d25811..c0470c63f 100644 --- a/sematic/examples/testing_pipeline/README.md +++ b/sematic/examples/testing_pipeline/README.md @@ -8,17 +8,6 @@ reduced. ## Running -### Bazel - -After updating [BUILD](./BUILD) with your own registry and repository, you can -launch the pipeline with: - -```bash -$ bazel run sematic/examples/testing_pipeline:__main__ -- --cloud -``` - -### Native Docker - After updating [main.yaml](./__main__.yaml) with your own registry and repository, you can launch the pipeline with: