appyter package

Subpackages

Submodules

appyter.cli module

appyter.context module

appyter.context.filter_blueprints(m, k, v)[source]
appyter.context.find_blueprints(config=None)[source]
appyter.context.find_blueprints_dir_mappings(config=None)[source]
appyter.context.find_fields(config=None)[source]
appyter.context.find_fields_dir_mappings(config=None)[source]
appyter.context.find_filters(config=None)[source]
appyter.context.find_filters_dir_mappings(config=None)[source]
appyter.context.find_templates_dir(config=None)[source]
appyter.context.get_appyter_directory(path)[source]
appyter.context.get_env(**kwargs)[source]

Try various methods to grab the application config (different based on whether we’re in a flask thread/somewhere else)

appyter.context.get_env_from_click()[source]

Traverse click context and use params for get_env_from_kwargs

appyter.context.get_env_from_flask()[source]

If we’re running in flask, current_app.config should be available

appyter.context.get_env_from_kwargs(**kwargs)[source]
appyter.context.get_extra_files(config=None)[source]
appyter.context.get_jinja2_env(context={}, config=None, session='')[source]

appyter.fields module

This module contains appyter.fields.Field, the base class for all fields defined in appyter.profiles.default.fields.

class appyter.fields.Field(name=None, label=None, description=None, choices=[], required=False, default=None, value=None, section=None, _env=None, **kwargs)[source]

Bases: dict

Base field for which all fields derive Base class for all Field objects representing a value that will later be provided via a front-end form. See appyter.profiles.default.fields for the actual fields.

property args

Get the raw args, the values used to initialize this field

property choices

Potential values to choose from

constraint()[source]

Return true if the received args.value satisfies constraints. Should be overridden by subclasses.

property field

Field name

property js_url

Template to use for rendering field

prepare(req)[source]

Given a flask request, capture relevant variables for this field

property raw_value

(UNSAFE) Raw value of the field

render(**kwargs)[source]

Return a rendered version of the field (form)

Parameters:

**kwargs

The instance values of the form e.g. Field.render(**field.args)

property render_value

(SAFE) Effective safe value ready to be displayed, specifically for Markdown output.

property safe_value

(SAFE) Effective safe value for use in code, we use repr to escape values as necessary

property template

Template to use for rendering field

to_click()[source]
to_cwl()[source]
to_cwl_value()[source]
to_jsonschema()[source]
property value

(SEMI-SAFE) Effective raw value of the field when parsed and constraints are asserted. When instantiating code, you should use safe_value.

exception appyter.fields.FieldConstraintException(field, field_name, value, message=None)[source]

Bases: Exception

as_dict()[source]
class appyter.fields.PartialField(field, **kwargs)[source]

Bases: object

Partial instantiation of a field Replaces a decorator so that we can still identify it as a callable which will produce a field.

appyter.fields.build_fields(fields, context={}, env=None)[source]

INTERNAL: Build a dictionary of Field instances

appyter.magic module

IPython magic for making templating easy~. This basically just allows our jinja-type language to be executed in place injecting the defaults into the environment so we can easily debug the notebook at the same time as building the appyter.

The same call structure is used during preprocess and at runtime but performing different tasks–this way setting up a notebook is as simple as running it with different nbtemplate’s being provided for import.

Usage (put the following in the first cell):

#%%appyter init
from appyter import magic
magic.init(lambda _=globals: _())
appyter.magic.init(_globals, verbose=False, ipynb='app.ipynb', mode='magic', safe_mode=False, **kwargs)[source]

Initialize appyter magic.

Sets up a jinj2 environment and injects %%appyter magic into your environment.

Parameters:
  • _globals – (Dict[str, Any]) A callable with your globals for the purpose of injection, basically just: lambda _=globals: _()

  • verbose – (Optional[bool]) Expand exception reporting to be more verbose

Module contents

This module enables you to turn your jupyter notebook into a jinja2 template-driven web application. Or just parse for other purposes.