util - project utilities

console - Interactive REPL / web console

class pybald.util.console.Console(project_name, package_name=None, app=None, additional_symbols=None)

Pybald console including history buffer per project.


Start the console with the project, controllers, and models defined in the console’s namespace.

pybald.util.console.start_console(app, options=None)

Start a console with a particular app.

  • app – wsgi application passed in
  • options – an object or named tuple containing the options for the web server such as host and port. Generally an argparser object is passed in for command line invokation

A pybald application must be configured before starting a console.

static_serve - Simple debugging static server

class pybald.util.static_serve.StaticServer(application, path, browser_caching=False)

A very simple static asset server. Do not use in production, just for test or development use.

StaticServer is a WSGI application that can be included in the WSGI pipeline to intercept static requests (and perform file system lookups). If the file lookup fails, the pipeline is allowed to continue to any dynamic components.

  • application – is the remaining WSGI pipeline to connect to.
  • path – is directory where static files are stored
  • browser_caching – whether to send 30d expires future headers
send_file(file_path, size)

Read a file from the filesystem and yield 64k chunks of the file as a generator / iterable.

text - text processing helper functions


Convert CamelCase text into underscore_separated text.


Returns the ordinal suffix of an interger (1st, 2nd, 3rd).


Returns a pluralized from of the input text following simple naive english language pluralization rules.

Smart enough to turn fox into foxes and quiz into quizzes. Does not catch all pluralization rules, however.


Strip diacriticals from characters. This will change the meaning of words but for places where unicode can’t be used (or ASCII only) francais looks better than fran-ais or fran?ais.


Convert underscore_separated text into CamelCase text.

pybald.util.text.unicode(txt, errors=None)