Skip to main content

Build Google Workspace add-ons in Python 🐍 !!!

***

Build Status Deployment Code Quality License Contribution PR


📝 Table of Contents

❗ What is GAPPS?

GAPPS is a library that allows developers to easily and flexibly build add-ons for Google Workspace using Python 🐍. With GAPPS, you can create powerful tools and integrations for Gmail, Google Chat, Calendar, Sheets, Drive, Docs and other Google Workspace apps, that can streamline your workflow and automate common tasks.

⚡ Key Features

  • A simple and easy-to-use API for building Google Workspace add-ons.
  • Flexible interface that can be used for a variety of use cases.
  • Built-in support for Gmail, Google Calendar, Google Drive and other Google Workspace apps.
  • Well-documented, well-maintained codebase and easy to contribute.

🏁 Getting Started

🚜 Installation

This client is hosted at PyPi under the name gapps, to install it, simply run

pip install gapps

or install dev version:

git clone https://github.com/skoudoro/gapps.git
pip install -e .

⚙️ CardService: Choose your coding style!

GAPPS allows you to build extensions by following your favorite coding style

Appscript Style

from gapps import CardService

def create_cat_card(text):
    # Use the "Cat as a service" API to get the cat image. Add a "time" URL
    # parameter to act as a cache buster.
    now = datetime.now()
    caption = text.replace('/', ' ')
    imageUrl = f'https://cataas.com/cat/says/{caption}?time={now.timestamp()}'

    image = CardService.newImage() \
        .setImageUrl(imageUrl)  \
        .setAltText('Meow')

    # Create a button that changes the cat image when pressed.
    # Note: Action parameter keys and values must be strings.
    action = CardService.newAction()  \
        .setFunctionName('on_change_cat') \
        .setParameters({'text': text, 'is_homepage': str(is_homepage)})

    button = CardService.newTextButton()  \
        .setText('Change cat')  \
        .setOnClickAction(action)  \
        .setTextButtonStyle(CardService.TextButtonStyle.FILLED)

    buttonSet = CardService.newButtonSet()  \
        .addButton(button)

    # Assemble the widgets and return the card.
    section = CardService.newCardSection()  \
        .addWidget(image)  \
        .addWidget(buttonSet)

    card = CardService.newCardBuilder()  \
        .addSection(section)

    return card.build()

Pythonic Style

from gapps import CardService

def create_cat_card(text):
    # Use the "Cat as a service" API to get the cat image. Add a "time" URL
    # parameter to act as a cache buster.
    now = datetime.now()
    caption = text.replace('/', ' ')
    imageUrl = f'https://cataas.com/cat/says/{caption}?time={now.timestamp()}'

    image = CardService.Image(image_url=imageUrl, alt_text='Meow')
    action = CardService.Action(
        function_name='on_change_cat',
        parameters={'text': text, 'is_homepage': str(is_homepage)})
    button = CardService.TextButton(
        text='Change cat', action=action,
        text_button_style=CardService.TextButtonStyle.FILLED)
    button_set = CardService.ButtonSet(button=button)
    section = CardService.CardSection(widget=[image, button_set])

    card = CardService.CardBuilder(section=section)

    return card.build()

⛏️ Card Builder

The online Card builder can help you prototype your app's interface.

🚀 Demos

Check out the examples folder for sample codes. It contains the following examples:

  • cats.py: Mirror of google Cats example. Compatible with Gmail, Google Calendar, Google Drive, Google Docs and Google sheets
  • simple_demo.py: minimalistic example to show how to build a basic card.
  • card_builder.py: This example show how to reproduce all the templates from the online Card builder. It can help you prototype your app's interface.

💬 Tutorials

Coming soon...

📄 Methods reference

CardService: For the complete reference, visit the official Google Workspace Add Ons API reference.

⚠️ Notes

We still need to handle some widgets/builders but 90% of them are working correctly

✅ Tests

  • Step 1: Install pytest
  pip install pytest
  • Step 2: Run the tests
  pytest -svv gapps

✨ Contribute

We love contributions!

You've discovered a bug or something else you want to change - excellent! Create an issue!

You've worked out a way to fix it – even better! Submit a Pull Request!

Start with the contributing guide!

Do you like GAPPS?

Show us with a star on github...

Star GAPPS

🎓 License

Project under MIT license, more information here

Metadata

Release files for gapps 0.1.1

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

Source distribution (sdist)

Source distribution for gapps 0.1.1
File Size Uploaded
gapps-0.1.1.tar.gz 274.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for gapps 0.1.1
File Interpreter ABI Platform
gapps-0.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 294.3 kB

Release files / gapps-0.1.1.tar.gz

Download URL gapps-0.1.1.tar.gz
Size 274.4 kB
Tags Source
SHA-256 checksum
How to use checksums
2565a120898f539d5ffe72e481d4736141c77397af02d9221532b439602289cb
BLAKE2b-256 checksum
How to use checksums
e8513ef97fc5d77709eff75fe44535211bdc4005a694fba07705495c38f111af
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.9.18

Release files / gapps-0.1.1-py3-none-any.whl

Download URL gapps-0.1.1-py3-none-any.whl
Size 19.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8bdb672c85a2f1532fd4dfeedd7f825db15cf7a19c2361f417003463a840e1fc
BLAKE2b-256 checksum
How to use checksums
6ffe82d6d66bbb03a274f8a3fc7499438e6ae33986c74b9d4f8c0975cfa69315
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.9.18
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