Gramex 1.73 introduces UIFactory events, InfluxDB support, Comicgen icons and more.
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.
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:
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 supports two new icon libraries that can be used as props.
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:
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 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
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.
cache.memory.size
in gramex.yaml
. Earlier, it reported that it
couldn’t cache, not why.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.
The Gramex code base has:
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.