Jules API

class jules.JulesEngine(src_path)
add_bundles(bundles, replace=False)

Add additional bundles into the engine, mapping key->bundle.

find_bundles()

Find all bundles in the input directories, load them, and prepare them.

get_bundle(*args, **kwargs)

With the same parameters as get_bundles_by() find exactly one bundle, and raise ValueError if 0 or more than 1 are found.

get_bundles_by(*args, **kwargs)

Find bundles in the engine filtered and ordered as needed.

order_key: The name of a meta field to order the results by order: ‘asc’ or ‘desc’ (default: ‘asc’) limit: The number of resuls to return (default: unlimited)

Any additional keyword arguments are taken as meta field values which bundles must match in order to be matched.

For example, to find all published bundles and give the most recent first:

engine.get_bundles_by(‘updated_time’, ‘desc’, status=’published’)
get_template(name)

Load one template by name.

load_config()

Populates engine.config with the site configuration.

load_plugins(ns='jules.plugins')

Load engine plugins, and sort them by their plugin_order attribute.

middleware(method, *args, **kwargs)

Call each loaded plugin with the same method, if it exists.

pipeline(method, first, *args, **kwargs)

Call each loaded plugin with the same method, if it exists, passing the return value of each as the first argument of the next.

prepare()

Prepare a site by loading configuration, plugins, packs, and bundles.

prepare_bundles()

Prepare the bundles, allow plugins to process them.

render_site(output_dir)

Render all bundles to the output directory.

walk_bundles()

Iterate over (key, bundle) pairs in the engine, continuing to yield new bundles if they are added to the engine during the process of walking over the bundles.

class jules.Bundle(key, defaults=None)

Each bundle is a collection of input files, properties, and meta data.

add(input_dir, directory, filename)

Add a single file to the bundle.

by_ext(ext)

Find one file in the bundle with the given extension, or return None

content = None
get_bundles()
meta

Bundle meta data loaded from a YAML file in the bundle.

parts
prepare(engine)

Prepare the bundle for the engine.

recent

The updated, published, or created time. The first to exist is given.

render(engine, output_dir)

Render the bundle to the output. “Render” can mean rendering a Jinja2 template or simply copying files, depending on the bundle and configuration.

url()

Find the url the bundle will be rendered to.

write_meta()

Writes any changes in the meta data back to the YAML file.

Project Versions

Previous topic

Getting Started

Next topic

Template API

This Page