API#

core.py#

This module contains the base class Ballad.

class ballad.core.Ballad#

Contains all the functions necessary for Ballad’s core operations.

lockfile_name#

The filename of the lockfile.

Type

str

install_quiet_flag#

If not verbose in install_identifier, then what flag to use to make it quiet.

Type

str

environment#

Can be development or production. Decides which dependencies to install.

Type

str

get_identifier(table: dict)str#

Reads lockfile table and returns an identifier.

Parameters

table (dict) – Read from parsed lockfile

Returns

String to be appended to pip install command

Return type

str

install(quiet: bool = False)#

Loops through lockfile and installs dependencies.

Recommended method of installing from lockfile.

Parameters

quiet (bool, optional) – If true it will not notify which dependencies it installs.

install_identifier(table: dict, verbose: bool = False)#

Installs specific dependency from item in lockfile table.

This is used for a single specific dependecy. Parse a lockfile with Tomlkit, then run this function with a specific item in that list. If you wish to just install the entire lockfile, used Ballad.install() instead.

Parameters
  • table (dict) – Item in lockfile table

  • verbose (bool, optional) – Whether to show PIP installation process.

lockfile()tomlkit.items.AoT#

Loads a Poetry lockfile and returns an array of tables.

Returns

List of dictionaries

Return type

tomlkit.items.AoT

utils.py#

This module includes various utilities that are handy for the development process and debugging. Feel free to poke around!

ballad.utils.convert_lock(lock: str = 'poetry.lock', output: str = 'poetry.json')#

Loads lockfile converts it to JSON.

Parameters
  • lock (str) – Filename of lockfile

  • output (str) – Filename to write JSON to

Raises

FileNotFoundError – Cannot find the lockfile