Skip to main content

A Python library for defining and annotating class attributes with custom metadata for appwrite.

Project description

Appwrite Annotations

A Python library for defining and annotating class attributes with custom metadata for appwrite.

Appwrite Annotations is a Python package that simplifies the creation of collections and attributes in Appwrite. Instead of manually creating collections and attributes through the Appwrite dashboard, users can now simply write Python model classes with custom annotations. This package allows users to define collections and attributes in their code, and with a single script execution, all the collections and attributes will be automatically created in Appwrite.

Why Use Appwrite Annotations?

When building an app with Appwrite, defining collections and their attributes is a time-consuming process. Typically, developers:

  • Write the front-end data model classes.
  • Then, they navigate to the Appwrite dashboard to manually create collections and add attributes.

This package eliminates that repetitive process. With Appwrite Annotations, you only need to annotate your Python model classes, and the package will handle the rest, creating the corresponding collections and attributes in Appwrite. You just need to run a script as given below:

Key Features

  • Automatically create collections and attributes in Appwrite based on Python class annotations.
  • Support for a variety of attribute types, including String, Integer, Float, Boolean, Datetime, Enum, Relationship, Email, and IP Address.
  • Define validation rules, default values, and constraints directly in your model classes.
  • Handle both simple and complex attributes like arrays and relationships between collections.

Installation

pip install appwrite_annotations

How It Works

1. Define Your Model Classes

Write your model classes in Python and annotate their attributes using the provided classes from Appwrite Annotations.

2. Run the Script

Once the model classes are written, run the provided script to automatically sync your data models with Appwrite. The script will create collections and attributes based on the annotations in your Python classes.

Example Usage

1. Define Your Model Classe

from appwrite_annotations import StringAttribute, IntegerAttribute, BooleanAttribute

@dataclass
class Student:
    student_id: IntegerAttribute = IntegerAttribute(attribute_key="studentId", required=True)
    name: StringAttribute = StringAttribute(attribute_key="name", required=True, size=100)
    age: IntegerAttribute = IntegerAttribute(attribute_key="age", required=True, min=18, max=100)
    is_active: BooleanAttribute = BooleanAttribute(attribute_key="isActive", default=True)

Developed by Zia Ur Rahman

Email: ziaurrahmanchoudhary@gmail.com

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_annotations-0.3.0.tar.gz (8.2 kB view details)

Uploaded Source

Built Distribution

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

appwrite_annotations-0.3.0-py3-none-any.whl (13.1 kB view details)

Uploaded Python 3

File details

Details for the file appwrite_annotations-0.3.0.tar.gz.

File metadata

  • Download URL: appwrite_annotations-0.3.0.tar.gz
  • Upload date:
  • Size: 8.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.11.4

File hashes

Hashes for appwrite_annotations-0.3.0.tar.gz
Algorithm Hash digest
SHA256 19f10c1f44fbd948b42d3dfebce3ad67b14ce808412fe7c3f0351b0e4e72e7dc
MD5 095c134f4696ba16a1cc80256609c237
BLAKE2b-256 38e2578ef0a414af4d7cc60be0d5ac85f075d1c925c8aa4340428432908637e8

See more details on using hashes here.

File details

Details for the file appwrite_annotations-0.3.0-py3-none-any.whl.

File metadata

File hashes

Hashes for appwrite_annotations-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 84e71fc0bcab0c2fe9143fb122d2e2d8ef6ade886db9177868f4e0afe186390c
MD5 f450fbf69f8b124861a3b0ba7a555fa7
BLAKE2b-256 26af1345a8967c60b369294e36e88070cc30f5597711f1850d6e44a44f755b9c

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