Skip to main content

Glootil

A Python 3 library to create gloodata extensions.

Usage

mkdir my-gd-ext
cd my-gd-ext
uv init
uv add glootil uvicorn fastapi

edit main.py to contain:

from datetime import datetime
from enum import Enum

from glootil import Toolbox

tb = Toolbox("my-gd-ext", "My Extension", "My Utility Tools")


@tb.enum(icon="visible")
class DisplayFormat(Enum):
    LINE = "Line"
    TABLE = "Table"
    TEXT = "Text"


@tb.tool(
    name="Compound Interest Rate Calculator",
    ui_prefix="Compound Interest Rate",
    args={
        "principal": "Principal",
        "interest_rate": "Interest Rate",
        "years": "Years",
        "display_format": "Format",
    },
    examples=[
        "calculate compound interest for initial 1500 dollars, 2.5% interests for 8 years in line chart",
        "compound interst for $2000 at 3.5% interests for 10 years as a table",
    ],
)
def compound_interest_calculator(
    principal: float = 1.0,
    interest_rate: float = 3.0,
    years: int = 5,
    display_format: DisplayFormat = DisplayFormat.LINE,
):
    year = datetime.now().year
    amount = principal
    cols = [("year", "Year"), ("amount", "Amount"), ("interest", "Interest")]
    rows = []

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

    if display_format == DisplayFormat.TABLE:
        return {
            "type": "Table",
            "columns": cols,
            "rows": rows,
        }
    elif display_format == DisplayFormat.TEXT:
        lines = [
            f"- {year}: ${amount} (${interest} interests)"
            for (year, amount, interest) in rows
        ]
        return "\n".join(lines)
    else:
        return {
            "type": "Series",
            "title": "Compound Interest by Year",
            "xColTitle": "Year",
            "yColTitle": "$",
            "xCol": "year",
            "valCols": ["amount", "interest"],
            "cols": cols,
            "rows": rows,
        }


tb.serve(host="127.0.0.1", 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

Check the examples folder for more.

License

MIT, see LICENSE file for details

Metadata

Release files for glootil 0.2.5

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

Source distribution (sdist)

Source distribution for glootil 0.2.5
File Size Uploaded Provenance
glootil-0.2.5.tar.gz 21.3 kB Without provenance Details

Built distribution (wheel)

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

Total release size: 34.2 kB

Release files / glootil-0.2.5.tar.gz

Download URL glootil-0.2.5.tar.gz
Size 21.3 kB
Tags Source
SHA-256 checksum
How to use checksums
cb9c9ad85fc708ec6c6109d944660bcb73ca3322173e7bd477ff1b8d175c801a
BLAKE2b-256 checksum
How to use checksums
304bdbc2e0de7f7c49d1d31051476ddb31259133d2ad4731d1dea31b7356bb54
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.7.10

Release files / glootil-0.2.5-py3-none-any.whl

Download URL glootil-0.2.5-py3-none-any.whl
Size 13.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8cec48114557f8b40cbe761b7305024fce92d38879c43a22565dee73d17b358d
BLAKE2b-256 checksum
How to use checksums
e1595808f4e4fb68d2794344db5f1091da6ec1011fe104d71ccfe30c322833fd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.7.10

Security for glootil 0.2.5

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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