babelizer.render module

babelizer.render.as_cwd(path)

Change directory context.

Parameters

path (str) – Path-like object to a directory.

babelizer.render.blacken_file(filepath)

Format a Python file with black.

Parameters

filepath (str) – Path-like object to a Python file.

babelizer.render.prettify_python(path_to_repo)

Format files in babelized project with black.

Parameters

path_to_repo (str) – Path-like object to babelized project.

babelizer.render.render(plugin_metadata, output, template=None, clobber=False, version='0.1')

Generate a babelized library.

Parameters
  • plugin_metadata (BabelMetadata obj) – The metadata used to babelize the library.

  • output (str) – Name of the directory that will be the new repository.

  • template (str, optional) – Path (or URL) to the cookiecutter template to use. Defaults to None.

  • clobber (bool, optional) – If a like-named repository already exists, overwrite it. Defaults to False.

  • version (str, optional) – Version of babelized library. Defaults to “0.1”.

Raises

OutputDirExistsError – Raised if output directory exists and clobber is not set.

Returns

Path to babelized library

Return type

str

babelizer.render.render_plugin_repo(template, context=None, output_dir='.', clobber=False)

Render a repository for a pymt plugin.

Parameters
  • template (str) – Path (or URL) to the cookiecutter template to use.

  • context (dict, optional) – Context for the new repository.

  • output_dir (str, optional) – Name of the directory that will be the new repository.

  • clobber (bool, optional) – If a like-named repository already exists, overwrite it.

Returns

Absolute path to the newly-created repository.

Return type

path