Gramex 1.73 release notes

Gramex 1.73 introduces UIFactory events, InfluxDB support, Comicgen icons and more.

UIFactory

UIFactory is now out of beta. Version 1.20 is packaged in Gramex 1.73, and features a simpler way to add events and create blocks.

UIFactory events

You can write event listener code inside <script $onclick>...</script>, like this:

<template $name="count-button" count:number="0" step:number="2">
  <button>Click here</button>
  <span>Count: ${count}</span>
  <script $onclick="button">
    this.count += step;
  </script>
</template>

Now, <count-button></count-button> renders this:

count-button event output

UIFactory blocks

To re-use HTML later, add it into a <script type="text/html" $block="blockname">...</script>. For example:

<template $name="block-example" greeting="hello">
  <script type="text/html" $block="one">
    one says ${greeting}.
  </script>
  <script type="text/html" $block="two">
    two says ${greeting}.
  </script>

  <%= one() %> <%= two({ greeting: 'Ola' }) %>
</template>

When you add the component to your page:

<block-example></block-example>

… it renders this output:

one says hello. two says Ola.

Comicgen icons

Comicgen supports two new icon libraries that can be used as props.

  1. Microsoft’s FXEmoji with over 1,000 icons
  2. Google’s Noto Emoji with over 2,000 icons

FXEmoji

Noto

OpenAPIHandler supports FormHandlers

You can expose a FormHandler via OpenAPIHandler. You must explicitly specify the columns, like this:

url:
  flagdata:
    pattern: flagdata
    handler: FormHandler
    kwargs:
      url: flags.csv
      columns: [Name, Continent, Symbols, Shapes, Stripes]

This lets you render a user interface for FormHandler-based data APIs:

OpenAPI UI for FormHandler

FormHandler InfluxDB support

FormHandler can read from and write into InfluxDB, a time series database.

url:
  influxdb:
    pattern: /data
    handler: FormHandler
    kwargs:
      url: "mongodb://$USER:$PASS@$HOST:27017"
      token: ... # token for authorization
      org: ... # default organization to connect to

LogViewer supports custom KPIs

LogViewer lets you add new KPIs using LOGVIEWER_CUSTOM_DIMENSIONS.

logviewer:
  LOGVIEWER_CUSTOM_DIMENSIONS:
    # Create a 'slow' column to log slow requests
    slow: df['duration'] > 100

Custom KPIs for LogViewer

Gramex Roadmap

The Gramex Roadmap is now a live dashboard showing what’s planned for Gramex in the next few months, and the status of these items.

Gramex Roaadmap

Bug fixes

Backward compatibility & security

Gramex 1.73 is backward compatible with previous releases unless the release notes say otherwise. Automated builds test this.

Every Gramex release is tested for security vulnerabilities using the following tools.

  1. Bandit tests for back-end Python vulnerabilities. See Bandit results
  2. npm-audit tests for front-end JavaScript vulnerabilities. See npm-audit results
  3. Snyk for front-end and back-end vulnerabiliti es. See Synk results
  4. ClamAV for anti-virus scans. See ClamAV results

Statistics

The Gramex code base has:

How to install

See the Gramex installation and upgrade instructions.

Note: Gramex 1.73 does not work with Python 3.8 or 3.9. We recommend Python 3.7.