API Documentation

class honcho.process.Popen(cmd, **kwargs)

Bases: subprocess.Popen

class honcho.process.Process(cmd, name=None, colour=None, quiet=False, env=None, cwd=None)

Bases: object

A simple utility wrapper around a subprocess.Popen that stores a number of attributes needed by Honcho and supports forwarding process lifecycle events and output to a queue.

run(events=None, ignore_signals=False)
class honcho.environ.Env

Bases: object

kill(pid)
now()
terminate(pid)
class honcho.environ.ProcessParams(name, cmd, quiet, env)

Bases: tuple

cmd

Alias for field number 1

env

Alias for field number 3

name

Alias for field number 0

quiet

Alias for field number 2

class honcho.environ.Procfile

Bases: object

A data structure representing a Procfile

add_process(name, command)
honcho.environ.expand_processes(processes, concurrency=None, env=None, quiet=None, port=None)

Get a list of the processes that need to be started given the specified list of process types, concurrency, environment, quietness, and base port number.

Returns a list of ProcessParams objects, which have name, cmd, env, and quiet attributes, corresponding to the parameters to the constructor of honcho.process.Process.

honcho.environ.parse(content)

Parse the content of a .env file (a line-delimited KEY=value format) into a dictionary mapping keys to values.

honcho.environ.parse_procfile(contents)
class honcho.manager.Manager(printer=None)

Bases: object

Manager is responsible for running multiple external processes in parallel managing the events that result (starting, stopping, printing). By default it relays printed lines to a printer that prints to STDOUT.

Example:

import sys
from honcho.manager import Manager

m = Manager()
m.add_process('server', 'ruby server.rb')
m.add_process('worker', 'python worker.py')
m.loop()

sys.exit(m.returncode)
add_process(name, cmd, quiet=False, env=None, cwd=None)

Add a process to this manager instance. The process will not be started until loop() is called.

kill()

Kill all processes managed by this ProcessManager.

loop()

Start all the added processes and multiplex their output onto the bound printer (which by default will print to STDOUT).

If one process terminates, all the others will be terminated by Honcho, and loop() will return.

This method will block until all the processes have terminated.

returncode = None
terminate()

Terminate all processes managed by this ProcessManager.

class honcho.export.base.BaseExport(template_dir=None, template_env=None)

Bases: object

get_template(path)

Retrieve the template at the specified path. Returns an instance of Jinja2.Template by default, but may be overridden by subclasses.

get_template_loader()
render(processes, context)
class honcho.export.base.File(name, content, executable=False)

Bases: object

honcho.export.base.dashrepl(value)

Replace any non-word characters with a dash.

honcho.export.base.percentescape(value)

Double any % signs.

class honcho.export.supervisord.Export(template_dir=None, template_env=None)

Bases: honcho.export.base.BaseExport

get_template_loader()
render(processes, context)
class honcho.export.upstart.Export(template_dir=None, template_env=None)

Bases: honcho.export.base.BaseExport

get_template_loader()
render(processes, context)