- pycape.experimental.cli.deploy(deploy_path, url=None, public=False)[source]#
Deploy a directory or a zip file containing a Cape function declared in an app.py script.
This method calls cape deploy and cape token from the Cape CLI to deploy a Cape function then returns a ~.function_ref.FunctionRef representing the deployed function. This ~.function_ref.FunctionRef will hold a function ID or function name, and a function checksum. Note that the
deploy_pathhas to point to a directory or a zip file containing a Cape function declared in an app.py file and the size of its content is currently limited to 1GB.
PathLike]) – A path pointing to a directory or a zip file containing a Cape function declared in an app.py script.
str]) – The Cape platform’s websocket URL, which is responsible for forwarding client requests to the proper enclave instances. If None, tries to load value from the
CAPE_ENCLAVE_HOSTenvironment variable. If no such variable value is supplied, defaults to
bool) – Boolean determining if the function should be publicly accessible or not.
- Return type:
FunctionRefrepresenting the deployed Cape function.
RuntimeError – if the websocket response or the enclave attestation doc is malformed, if the function path is not pointing to a directory or a zip file, if folder size exceeds 1GB, or if the Cape CLI cannot be found on the device.
- pycape.experimental.cli.token(name=None, description=None, expiry=None)[source]#
Generate a Personal Access Token.
This method calls cape token from the Cape CLI to generate a Personal Access Token. Tokens can be created statically (long expiration and bundled with your application) or created dynamically (short-lived) and have an owner-specified expiration. This PAT is required along with the function name or function ID when calling a Cape function.
str]) – Optional name for the token.
str]) – Optional description for the token.
str]) – Amount of time in seconds until the function token expires. Defaults to 1h.
- Return type:
Tokenrepresenting the PAT.
RuntimeError – if the Cape CLI cannot be found on the device, if the CLI failed to generate the token, or if PyCape failed to parse the token from the CLI’s output.