Skip to main content

Zero-click Appwrite test environments.

Project description

appwrite-lab

Zero-click Appwrite test environments.

Allows you to spin up versioned Appwrite deployments for easy testing via CLI of through code, that can be ran in a sequence of E2E tests.

Installation

pip install appwrite-lab

Appwrite Lab features

  • Spin up ephemeral Appwrite instances with Docker/Podman
  • Automatically grab API keys (for programmatic access)
  • Environment syncing (with appwrite.json)
  • Clean teardowns
  • Test suite

Appwrite Lab (in progress)

  • Appwrite data population

CLI Usage

Help with appwrite-lab CLI

appwrite-lab --help

or

awlab --help

To get started spinning up a lab instance, use:

awlab new lab test --version 1.7.4

Note: This might take a few minutes the first time as its downloading all of the necessary images to launch Appwrite.

Example of additional args:

Additional arguments can be found here.

awlab new lab --help
awlab new lab test --version 1.7.4 --port 8005 --email test@example.com --password xxxxxxx12

To teardown

awlab stop test

Listing Appwrite Labs

awlab list labs
image

Sync an Appwrite lab from your prod lab schema

Run in the same folder where your appwrite.json is located to sync all resources:

awlab sync test

or sync a specific resource:

awlab sync test --resource functions

Python usage

Creating a lab

from appwrite_lab import Labs
from appwrite_lab.automations.models import AppwriteLabCreation

labs = Labs()
lab_res = labs.new(
    name="test",
    version="1.7.4",
    auth=AppwriteLabCreation(
        admin_email="test@example.com",
        admin_password="xxxxxxx12",
        project_id=None, # for auto gen
        project_name=None, # for auto gen
    )
    port=8005
)

assert lab_res.data

Random generation that's compliant

from appwrite_lab.models import AppwriteLabCreation

auth = AppwriteLabCreation.generate()

Syncing a lab

from appwrite_lab import Labs
from appwrite_lab.automations.models import Expiration

Labs().sync_with_appwrite_config(
    name="test",
    appwrite_json="appwrite.json", # if not directly in folder
    sync_type="all",
    expiration=Expiration.THIRTY_DAYS,
)

Known Troubleshooting

Podman support and Selinux

Since I am mimicking the compose file that Appwrite provides, it was not designed to work rootless, but I have adjusted to work also on Fedora. You will need to turn selinux off for now to use.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

appwrite_lab-0.1.1.tar.gz (25.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

appwrite_lab-0.1.1-py3-none-any.whl (33.9 kB view details)

Uploaded Python 3

File details

Details for the file appwrite_lab-0.1.1.tar.gz.

File metadata

  • Download URL: appwrite_lab-0.1.1.tar.gz
  • Upload date:
  • Size: 25.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for appwrite_lab-0.1.1.tar.gz
Algorithm Hash digest
SHA256 5fcbd0e5fbb5e512f9592dc9802514aba977184265461e28d34e0803ba191f7d
MD5 5b0dae5338de7b32c90e7ca1ca14e82b
BLAKE2b-256 dc2a2810d32b7368c0c9fbbdea8788a7a2b12788eee3f732ebd73f6c7ad290ad

See more details on using hashes here.

File details

Details for the file appwrite_lab-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: appwrite_lab-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 33.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for appwrite_lab-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 a355c7e24f6dca6580968ebfdc10509efafa8d19f43323898dd6b11147a74a48
MD5 216d0b41a6108eddb4cc1894f77fac8b
BLAKE2b-256 4b69fd28d7e21e91b3a49432e07359280aad59c32942dc641c4177750ec8c0a5

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page