Skip to main content

Data-driven templating

Project description

nouns: Data-deterministic, structure-driven (very experimental) templating

nouns does templating a bit differently - the templating itself is quite primitive, with most of the gruntwork taking place in the preprocessing layer.

This layer converts all the templating data into a very general form that ensures the data is renderable by the templates no matter the structure of the data.

Hello world

Do traditional template-and-data templating as follows:

>>> from nouns import template
>>> template(dict(name='World'), 'Hello $name!')
Hello World!

But the more interesting/intended use is to not explicitly pass in a template. Instead, just pass in the data - let the templating engine itself figure out which templates to use.

The in-built templates are designed to give you something close to what you probably want.

Pass in a table of data, you'll get a table back. Pass in a dictionary/mapping, you'll get the key/value pairs templated in a table. Pass in a list, you'll get each list item templated out.

Experimental status

This templating system is an experiment in how to craft the most data-driven templating system, where the output is dependent on the things ("nouns") you pass in.

We will initially use if for rendering data in notebooks, but it's definitely not production-ready for web applications or otherwise rendering untrusted data, without a lot of extra customization and filters set up.

Hopefully it will continue to evolve toward production-ready status.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

nouns-0.1.1.tar.gz (8.7 kB view details)

Uploaded Source

Built Distribution

nouns-0.1.1-py3-none-any.whl (10.9 kB view details)

Uploaded Python 3

File details

Details for the file nouns-0.1.1.tar.gz.

File metadata

  • Download URL: nouns-0.1.1.tar.gz
  • Upload date:
  • Size: 8.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.0.0 CPython/3.8.1 Darwin/18.7.0

File hashes

Hashes for nouns-0.1.1.tar.gz
Algorithm Hash digest
SHA256 055f5ca0ced5984f07f91fc265dc62fae3fda9dc4c640a7f6110dfdb99542a51
MD5 bf0b109b23ebdaec648c5de528035899
BLAKE2b-256 207ad3449d1ebbc6bb8e307f9f89772bacf5167d36374a6708d8136b951dd77e

See more details on using hashes here.

File details

Details for the file nouns-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: nouns-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 10.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.0.0 CPython/3.8.1 Darwin/18.7.0

File hashes

Hashes for nouns-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 3b6426b5f7a590fc6971d1664f623916cf448102e250ccfc25dbd85fe90b7295
MD5 37d26e58b23c283b72bb67419b06b728
BLAKE2b-256 d8af5991744837306e8553dba375d49b8059d11f14ff31eb7f80c97d80f6c908

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page