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(
    "glootil-examples",
    "Glootil Examples",
    "Example tools from glootils",
)


@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
):
    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": ["amount"],
        "cols": [("year", "Year"), ("amount", "$")],
        "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.2.tar.gz (11.8 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.2-py3-none-any.whl (7.9 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for glootil-0.1.2.tar.gz
Algorithm Hash digest
SHA256 0b70b9b0daa2d2849e9e333540ca7dc2b6f6fd518808e509e0fc6be29b2534d3
MD5 483204c0ac7e9a3a998abd5efe03ee5e
BLAKE2b-256 88c3aedf66389c60c84644c3c85f7091c480676a4d255f8f88e9659757c40870

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for glootil-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 6b8e852497754549d9ddb1eb64b071b8fd7bbfaf2a92e1616b5ce460d50e839b
MD5 fea6fd2205fc6402d1d1d1a9ddc43304
BLAKE2b-256 7514d0707ab1af906f9c4e6b197169077f26f22fcf537915e25eac26ee336629

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