Gramex is now on PyPi. Installing is much easier. Just run:
pip install --verbose gramex
The Guide features more demos of how to use external APIs.
FormHandler supports Vega charts. You can use the full power of Vega and Vega-Lite charts with just configuration. Here’s an example:
<script src="../../formhandler/vega?_format=barchart"></script>
<script src="https://cdn.jsdelivr.net/npm/vega@3.2.1/build/vega.min.js"></script>
FormHandler can go beyond files and databases. Our plan it to integrate with Spark, cloud APIs and other sources. For now, you can browse files in directories, converting FormHandler into a simple file explorer.
Alerts now support previews. You can see what alert emails look like before sending them out. We plan to improve this app into a full-fledged mailing and scheduling application.
Note: Until Gramex 1.30, emails without a schedule were sent on startup. Now, emails are sent only if they have an explicit schedule, or are triggered manually.
Log viewer ignores static content (like images, JS/CSS scripts, etc), and displays more friendly HTTP statuses.
When 2 URLs from different applications have the same key, only one of them work. You can use YAML wildcard keys which generate random key names to prevent this.
url:
my-app-$*: # The '$*' is replaced by a random value
pattern: ...
Also, if the developer specifies an invalid URL regular expression, like
/dir/*
, Gramex mentions this as an error and continues. (It used to stop
processing all configurations earlier.)
When you have a URL pattern with regular expression wild cards like this:
url:
path:
pattern: /path/(.*)
...
… this matches any URL beginning with /path/
, e.g. /path/abc
. To access
the abc
, use handler.path_args[0]
. This lets you create flexible
alternatives to URL query parameters in FunctionHandler. For example:
/sales?city=London
can be converted to /sales/London
/sales?country=UK&city=London
can be /sales/UK/London
This is available to all handlers. FormHandler also allows its use as part of
its parameters. For example, with
pattern: /sales/(\w+)
, you can use this query:
query: SELECT {_0}, SUM(revenue) FROM sales GROUP BY {_0}
The {_0}
refers to the portion after /sales/
. So /sales/city
returns the
revenue by the city
column, while /sales/country
returns the revenue by the
country
column.
The default HTTP 500 error handler (raised when the server makes a mistake) displays a reason code, if one is available. Gramex now consistently uses HTTP reason codes for error reporting.
We also have a template for HTTP 400 errors - which are raised when the user sends a bad request.
The Google Font Lato is now available on the Gramex UI components.
The Gramex code base has moved from
s.anand/gramex to
cto/gramex. If you have any git repos
pointing to Gramex, edit the .git/config
file and update the location.
To upgrade Gramex, run:
pip install --verbose gramex==1.31
This downloads Chromium and other front-end dependencies. That may take time.