Skip to main content

Babble Cloud

Babble is a tool that enables beginner programmers to rapidly deploy serverless applications to AWS through a readable, low-code, Python-based YAML configuration file.

Table of Contents

Requirements
Installation
Usage
Configuration
Demonstration

Requirements

Python
Docker
AWS

Installation

To install Babble, run the following command:

  pip install babble-cloud

Usage

To start a new project, run the following command:

  babble create

To set the configuration file for a project, run the following command:

  babble push <source file>

To retrieve the configuration file from a project, run the following command:

  babble pull <destination file>

To view the current configuration of a project, run the following command:

  babble view

To activate a project, run the following command:

  babble activate

To deactivate your project, run the following command:

  babble deactivate

To delete your project, run the following command:

  babble delete

Note:  Upon running the commands babble activate, babble deactivate, and in some cases babble delete, you will be prompted for your AWS account credentials in order to add or remove the necessary resources from your AWS account. For information about obtaining these credentials, please refer to the AWS documentation on getting IAM role credentials.

Configuration

To configure your application infrastructure, you will need to create a YAML configuration file containing your resources. Currently, resources fall under five categories: tables, folders, packages, modules, and endpoints.

Tables

Table definitions are used to deploy DynamoDB tables to the user's AWS account. The following methods can be accessed via dot notation from module and endpoint source code:

put_item(item: dict) - Creates a new item in the table, or replaces an old item with a new item. It is required that the item contains the "key" attribute specified in the table's configuration. If an item that has the same "key" attribute as the new item already exists in the table, the new item completely replaces the existing item. Otherwise, an entirely new item will be created.

get_item(item: dict) - Retrieves an item from the table. It is required that the item contains the "key" attribute specified in the table's configuration. If there is no matching item, get_item will return an empty dict ({}).

delete_item(item: dict) - Retrieves an item from the table. It is required that the item contains the "key" attribute specified in the table's configuration.

scan() - Performs a full table scan, returning a list of all items in the table.

tables:
    <table name>:
        key: <key name>
    <table name>:
        key: <key name>
    ...

Folders

Folder definitions are used to deploy S3 buckets to the user's AWS account. The following methods can be accessed via dot notation from module and endpoint source code:

open(path: str, mode: str) -

url(path: str) -

folders:
    <folder name>:
    <folder name>:
    ...

Packages

Package definitions are used to include external packages in both module and endpoint source code. These packages can be sourced from the Python Standard Library (lib), or packages from the Python Package Index (pip).

packages:
    <package name>:
        source: <lib or pip>
        version: <version number or "~">
    <package name>:
        source: <lib or pip>
        version: <version number or "~">
    ...

Modules

Module definitions are used to write source code for the application. All functions, classes, and variables defined within these modules can be accessed via dot notation from module and endpoint source code. Please note that all imports are handled implicitly and there is no need for any import statements. All tables, folders, packages, and other modules can be accessed via dot notation.

modules:
    <module name>:
        content: |
            # source code goes here
    <module name>:
        content: |
            # source code goes here
    ...

Endpoints

Endpoint definitions are used to write source code that processes the request data and determines the response data. Please note that all imports are handled implicitly and there is no need for any import statements. All tables, folders, packages, and modules can be accessed via dot notation. It is imperative that all endpoints contain a function named request with the parameters headers, path, query, and body as shown below.

endpoints:
    <endpoint method> <endpoint path>:
        content: |
            def request(headers, path, query, body):
                # source code goes here
                return response
    <endpoint method> <endpoint path>:
        content: |
            def request(headers, path, query, body):
                # source code goes here
                return response

Demonstration

Creation and Activation

Step 1: Create a new project. Upon running this command, you will be prompted for a name for your new project.

babble create

Step 2: Push your YAML configuration file to the project. Upon running this command, you will be prompted to select a project you previously created.

babble push <filename>

Step 3: Activate your project. Upon running this command, you will be prompted to select a project you previously created.

babble activate

Deactivation and Deletion

Step 1: Deactivate your project. Upon running this command, you will be prompted to select a project you previously created.

babble deactivate

Step 2: Delete your project. Upon running this command, you will be prompted to select a project you previously created. If the selected project is not deactivated, it will be deactivated automatically.

babble delete

Configuration File

Here is an example of a configuration file that can be used with Babble to deploy a serverless application:

tables:
  my_table:
    key: my_key
folders:
  my_folder:
packages:
  pandas:
    source: pip
    version: 1.5.3
  json:
    source: lib
    version: ~
modules:
  my_module:
    content: |
      def get_item(item_key):
        return my_table.get_item({"my_key": item_key})
      def put_item(item_key, body):
        item = json.loads(body)
        item["my_key"] = item_key
        my_table.put_item(item)
      def delete_item(item_key):
        my_table.delete_item({"my_key": item_key})
      def get_items():
        items = my_table.scan()
        df = pandas.DataFrame.from_dict(items)
        with my_folder.open("output.txt", "w") as fp:
          fp.write(df.to_string())
        return my_folder.url("output.txt")
endpoints:
  GET /items/{item_key}:
    content: |
      def request(headers, path, query, body):
        return my_module.get_item(path["item_key"])
  PUT /items/{item_key}:
    content: |
      def request(headers, path, query, body):
        return my_module.put_item(path["item_key"], body)
  DELETE /items/{item_key}:
    content: |
      def request(headers, path, query, body):
        return my_module.delete_item(path["item_key"])
  GET /items:
    content: |
      def request(headers, path, query, body):
        return my_module.get_items()

Metadata

Release files for babble-cloud-cli 0.1.21

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for babble-cloud-cli 0.1.21
File Size Uploaded Provenance
babble_cloud_cli-0.1.21.tar.gz 13.8 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for babble-cloud-cli 0.1.21
File Interpreter ABI Platform
babble_cloud_cli-0.1.21-py3-none-any.whl Python 3 none any Details

Total release size: 28.7 kB

Release files / babble_cloud_cli-0.1.21.tar.gz

Download URL babble_cloud_cli-0.1.21.tar.gz
Size 13.8 kB
Tags Source
SHA-256 checksum
How to use checksums
23dafef0c042d18114db48a06bc4062b248dfbeefb87d41766bb3410138704d4
BLAKE2b-256 checksum
How to use checksums
337b64900d271cb7d8555e2735d1647d65f211eb7761e271f35ad5b604d0d2a0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.3.2 CPython/3.10.9 Darwin/21.4.0

Release files / babble_cloud_cli-0.1.21-py3-none-any.whl

Download URL babble_cloud_cli-0.1.21-py3-none-any.whl
Size 14.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a6a7cb664886b1bf4a3434465f3d46952c856997d977de97c97ee55c3b786e05
BLAKE2b-256 checksum
How to use checksums
7f57b381c7d1bbcdf32e5c003adf1844ddc4daccb7af33d28c1559bfd1ddd8f7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.3.2 CPython/3.10.9 Darwin/21.4.0

Security for babble-cloud-cli 0.1.21

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page