Skip to main content

Library to build Gloodata extensions

Project description

Glootil

A Python 3 library to create gloodata extensions.

Usage

mkdir gd-finances
cd gd-finances
uv init
uv add glootil uvicorn fastapi

edit main.py to contain:

from datetime import datetime
from glootil import DynEnum, Toolbox

tb = Toolbox(
    "finances",
    "Finances",
    "Provides tools to do financial calculations",
)


@tb.tool(
    name="Compound Interest Rate Calculator",
    ui_prefix="Compound Interest Rate",
    args={
        "principal": "Principal",
        "interest_rate": "Interest Rate",
        "years": "Years",
    },
    examples=[
        "calculate compound interest for initial 1500 dollars, 2.5% interests for 8 years"
    ],
)
def compound_interest_calculator(
    principal: float = 1.0, interest_rate: float = 3.0, years: int = 5
):
    cols = [("year", "Year"), ("amount", "$")]
    val_cols = ["amount"]
    year = datetime.now().year
    amount = principal
    rows = []

    for i in range(0, years + 1):
        rows.append((year + i, amount))
        amount += amount * (interest_rate / 100)

    return {
        "type": "Series",
        "title": "Compound Interest by Year",
        "xColTitle": "Year",
        "yColTitle": "$",
        "xCol": "year",
        "valCols": val_cols,
        "cols": cols,
        "rows": rows,
    }


tb.serve(port=8087)

Start:

uv run main.py

On gloodata write in the prompt bar:

Add extension Fincance at port 8087

Click Test and then Save

Now in the prompt bar write something like:

calculate compound interest for initial 2500 dollars, 3.5% interests for 15 years

License

MIT, see LICENSE file for details

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

glootil-0.1.1.tar.gz (11.7 kB view details)

Uploaded Source

Built Distribution

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

glootil-0.1.1-py3-none-any.whl (7.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: glootil-0.1.1.tar.gz
  • Upload date:
  • Size: 11.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.6.9

File hashes

Hashes for glootil-0.1.1.tar.gz
Algorithm Hash digest
SHA256 a5ad56f62d778943261e38aef356cb45fca3649ca0b9fe8ae9d80f102c5cc154
MD5 0396692e70902f958f6d4ce8fedeb4fa
BLAKE2b-256 8c82961bfe05e615f39fa1c4ff257f013e3b874774c9a584cf5c2a11638e164d

See more details on using hashes here.

File details

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

File metadata

  • Download URL: glootil-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 7.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.6.9

File hashes

Hashes for glootil-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 1d64fcfffb6f40936b6433e4a8358bcfecb883461afdd1a65716e12db35e66ee
MD5 ee454d7f3f294fa3e6065431ef9c23b4
BLAKE2b-256 72bc4dd40f5696b9bad40e729002c281f29341c2532c462e96df8156b91e039c

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