tunel package

Subpackages

Submodules

tunel.apps module

class tunel.apps.App(app_config, app_dir, validate=True)[source]

Bases: object

add_args(extras)[source]

Extra is a list of args, in either format:

–name=value –flag

They must start with – to be considered.

property app_dir
docgen(out=None, outdir=None)[source]

Render documentation for an app.

get(key, default=None)[source]
get_script()[source]
property has_xserver

Boolean to indicate if an application has an xserver

property job_name
property launchers
load(validate=True)[source]
load_template()[source]

Given an app, load the template script for it.

This also provides the app directory for any relative template scripts.

property name
property post_command

Get a post command, if it exists

print_pretty()[source]

Print the app (and args, etc) pretty to the terminal.

property relative_dir
property relative_path
validate()[source]

Validate the loaded settings with jsonschema

tunel.apps.get_app(name, extra=None)[source]

Given an app name, get the loaded app for it

tunel.apps.list_apps(settings_file=None, validate=False)[source]

Given the user settings,

tunel.defaults module

tunel.logger module

class tunel.logger.ColorizingStreamHandler(nocolor=False, stream=<_io.TextIOWrapper name='<stderr>' mode='w' encoding='utf-8'>, use_threads=False)[source]

Bases: StreamHandler

BLACK = 0
BLUE = 4
BOLD_SEQ = '\x1b[1m'
COLOR_SEQ = '\x1b[%dm'
CYAN = 6
GREEN = 2
MAGENTA = 5
RED = 1
RESET_SEQ = '\x1b[0m'
WHITE = 7
YELLOW = 3
can_color_tty()[source]
colors = {'CRITICAL': 1, 'DEBUG': 4, 'ERROR': 1, 'INFO': 2, 'WARNING': 3}
decorate(record)[source]
emit(record)[source]

Emit a record.

If a formatter is specified, it is used to format the record. The record is then written to the stream with a trailing newline. If exception information is present, it is formatted using traceback.print_exception and appended to the stream. If the stream has an ‘encoding’ attribute, it is used to determine how to do the output to the stream.

property is_tty
class tunel.logger.Logger[source]

Bases: object

cleanup()[source]
cyan(msg)[source]
debug(msg)[source]
error(msg)[source]
exit(msg, return_code=1)[source]
handler(msg)[source]
info(msg)[source]
location(msg)[source]
panel_group(msgs)[source]

Input is a dictionary of colors (for panel background) and corresponding messages.

print_pretty(obj)[source]

Print a dict (and nested content) pretty.

progress(done=None, total=None)[source]
purple(msg)[source]
set_level(level)[source]
set_stream_handler(stream_handler)[source]
shellcmd(msg)[source]
text_handler(msg)[source]

The default handler prints output to the console. :param msg: the log message dictionary :type msg: dict

warning(msg)[source]
tunel.logger.setup_logger(quiet=False, printshellcmds=False, nocolor=False, stdout=False, debug=False, use_threads=False, wms_monitor=None)[source]

tunel.schemas module

tunel.settings module

class tunel.settings.Settings(settings_file, validate=True)[source]

Bases: SettingsBase

The settings class is a wrapper for easily parsing a settings.yml file.

We parse into a query-able class. It also gives us control to update settings, meaning we change the values and then write them to file. It’s basically a dictionary-like class with extra functions.

class tunel.settings.SettingsBase[source]

Bases: object

change_validate(key, value)[source]

A courtesy function to validate a new config addition.

delete(key)[source]
edit()[source]

Interactively edit a config file.

get(key, default=None)[source]

Get a settings value, doing appropriate substitution and expansion.

get_settings_file(settings_file=None)[source]

Get the preferred used settings file.

load(settings_file=None)[source]

Load the settings file into the settings object

save(filename=None)[source]

Save settings, but do not change order of anything.

validate()[source]

Validate the loaded settings with jsonschema

tunel.template module

class tunel.template.Template[source]

Bases: object

Supporting functions for loading any kind of apps template

get(template_name, template_dir=None)[source]

Get a template from templates

load(template_name, template_dir=None)[source]

Load the default module template.

tunel.version module

Module contents