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.0.tar.gz (8.7 kB view details)

Uploaded Source

Built Distribution

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

Uploaded Python 3

File details

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

File metadata

  • Download URL: nouns-0.1.0.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.0.tar.gz
Algorithm Hash digest
SHA256 a43d5114cc6fafcb7f313d0c1ae89992385395f4ba3e22251e92d66266f509a4
MD5 efa5c4cfad080818af1cfbe0c9afa641
BLAKE2b-256 e4e2b168eb03234e196607d2aaa3628560a728dcf722969dc07371676177ff5d

See more details on using hashes here.

File details

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

File metadata

  • Download URL: nouns-0.1.0-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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 8611a1621f0620bee37211a3511df291d89ab1eadd78319198a86b3b8ea90fc7
MD5 e7cde39db3276a8023adc921cd446381
BLAKE2b-256 e89afa2ebefb214def8c8ea8ef17845d65b6553149a1a1b575ddd0794faf15dc

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