Gramex 1.70 release notes

Gramex 1.70 introduces support for MongoDB, Bootstrap 5, VueJS, minimal scaffolding, and more.

MongoDB support

FormHandler now supports MongoDB as a data source.

MongoDB logo

To use it, create a FormHandler with this configuration:

url:
  mongodb-data:
    pattern: /data
    handler: FileHandler
    kwargs:
      url: plugin:mongodb://localhost:27017
      database: database-name
      collection: collection-name

The contents of the collection can be queried via the /data URL. You can also use FormHandler query feature to construct complex queries.

Bootstrap 5 support

Bootstrap 5 is released, and Gramex is ready. You can use floating labels, offcanvas, custom switches and more.

Bootstrap logo

The full list of UI Components is available for Bootstrap 5. So, instead of adding the default Bootstrap 4 theme to your HTML:

<link rel="stylesheet" href="ui/theme/default.scss" />

… add the Bootstrap 5 theme instead:

<link rel="stylesheet" href="ui/theme/bootstrap5.scss" />

That’s it. All Bootstrap 5 styles are available.

VueJS support

FileHandler can compile Vue single-file components. The default FileHandler compiles any .vue file into CSS. For example, this hello-world.vue file:

<template>
  <p>{{ greeting }} World!</p>
</template>

<script>
  module.exports = {
    data: function () {
      return {
        greeting: "Hello",
      };
    },
  };
</script>

<style scoped>
  p {
    font-size: 2em;
    text-align: center;
  }
</style>

is rendered as:

(function(t){var e={};function n(r){if(e[r]) /* JS contents trimmed */

To enable this in your FileHandler, add:

kwargs:
    ...
    vue: '*.vue'    # Compile .vue files into JS

Minimal scaffolding

To install the minimal files required to run Gramex, run gramex init minimal (instead of gramex init) on your terminal.

It initializes a git repository and creates these files:

Other improvements

Bug fixes

Statistics

The Gramex code base has:

Credits

How to install

See the Gramex installation and upgrade instructions.

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