From ee34dd5e2d20768c99cef5eb6ecc7cab1a9c90a3 Mon Sep 17 00:00:00 2001 From: Marquis Kurt Date: Sat, 13 Feb 2021 14:05:00 -0500 Subject: [PATCH] =?UTF-8?q?=F0=9F=93=9D=20[docs]=20Update=20SDK=20document?= =?UTF-8?q?ation?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/99-candella-sdk.md | 48 +++++++++++++++++++++++++++++++++++++---- 1 file changed, 44 insertions(+), 4 deletions(-) diff --git a/docs/99-candella-sdk.md b/docs/99-candella-sdk.md index 4eec484..431c8a5 100644 --- a/docs/99-candella-sdk.md +++ b/docs/99-candella-sdk.md @@ -11,7 +11,7 @@ pip install candella-sdk ``` !!! warning - The Candella is in a pre-release state and isn't available in PyPI yet. You will need to build the project from source to use the SDK. + The Candella SDK is in a pre-release state. Features, methods, and APIs may change over time. ## Build the SDK from source @@ -31,11 +31,51 @@ Then, use `pip install` and point to the resulting wheel file in the `dist` dire ## Creating projects -Currently, the Candella SDK lets you create three different kinds of projects: applications, core services, and frameworks. To create any of these projects, run `candella-sdk --create` and specify the `--type` argument: +Currently, the Candella SDK lets you create three different kinds of projects: applications, core services, and frameworks. To create any of these projects, run `candella-sdk --action create` and specify the `--type` argument: -- `--type application` to create an application. +- `--type app` to create an application. - `--type service` to create a core service. - `--type framework` to create a framework. !!! note - If you choose an open-source license, you will need to supply the LICENSE file with your app. This may be updated in a future release of the SDK. \ No newline at end of file + If you choose an open-source license, you will need to supply the LICENSE file with your app. This may be updated in a future release of the SDK. + +## Validating projects + +The Candella SDK provides a rudimentary validation system for projects to ensure that apps, core services, and frameworks have proper manifests and the materials needed for the project to run in Candella. + +To start validating a project, run `candella-sdk --action validate` and specify the `--project` argument with the path to your project. + +Currently, the SDK will check for the following: + +- That the project is a valid Candella project +- That the project contains a manifest file +- That the project's manifest file contains the required keys and doesn't include invalid keys +- That the project contains the proper iconset if the project is an app or core service + +!!! warning "About project validation" + Remember that project validation is not a substitution for thorough testing, nor does it guarantee that your project will work correctly with Candella. + + Always remember to thoroughly test your projects and how they work in the most recent versions of Candella alongside the most recent versions of the frameworks and core services included. + +## Using Candella SDK programmatically + +The Candella SDK can be imported as a Python module into a script to automate development or to write tests for validating apps. + +Creating a project can be performed by calling `sdk.create` with a single argument that defines the project type: + +```py +from candella_sdk import sdk, CandellaProjectType + +sdk.create(CandellaProjectType.application) +``` + +Likewise, a project can be validated programmatically by calling `sdk.validate` and passing in the path to the project to validate. The validation function returns a tuple containing if the project was validated, and the error in question if the validation failed. + +```py +from candella_sdk import sdk + +validated, error = sdk.validate("path/to/Example.aosapp") +if not validated: + raise Exception(error) +``` \ No newline at end of file