API Documentation

class honcho.process.Popen(cmd, **kwargs)[source]

Bases: Popen

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

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)[source]
class honcho.environ.Env(config)[source]

Bases: object

property port
property procfile
class honcho.environ.ProcessParams(name, cmd, quiet, env)

Bases: tuple


Alias for field number 1


Alias for field number 3


Alias for field number 0


Alias for field number 2

class honcho.environ.Procfile[source]

Bases: object

A data structure representing a Procfile

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

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.


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

class honcho.manager.Manager(printer=None)[source]

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.


import sys
from honcho.manager import Manager

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

add_process(name, cmd, quiet=False, env=None, cwd=None)[source]

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


Kill all processes managed by this ProcessManager.


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

After loop() finishes, this will contain a return code that can be used with sys.exit.


Terminate all processes managed by this ProcessManager.

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

Bases: object


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

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

Bases: object


Replace any non-word characters with a dash.


Double any % signs.

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

Bases: BaseExport

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

Bases: BaseExport

render(processes, context)[source]