Modules

The main modules in this python package are:
  • trellopy.py - consisting of one Controller class
  • boards.py - consisting of one Board, BoardList and BoardListCard classs
  • members.py - consisting of one Member class
  • backend.py - consisting of one Operator class

trellopy.py

The controller object is the main interface to the entire package. Use this to make new boards, get boards, add new members, show all boards, and to show all members.

Start by importing the python package:

>>> import trellopy

Get an instance of the controller like so:

>>> controller = trellopy.Controller()
class trellopy.trellopy.Controller[source]
__init__()[source]

Initializes a Controller class. It consists of a single _operator instance:

self._operator = Operator()
get_board(board_name)[source]

Get the board that has the name board_name.

Parameters:board_name – The name of the board you want to get.
Returns:A Board class, with Board.board populated with board data.
get_member(member_name)[source]

Get existing member with name member_name

Parameters:member_name – The name of the member.
Returns:A Member class, with Members.person populated with name.
new_board(board_name)[source]

Create a new board with name board_name.

Parameters:board_name – The name you want the board to have.
Returns:A Board class, with name attribute board_name.
new_member(member_name)[source]

Add a new member with name member_name

Parameters:member_name – The name of the member.
Returns:A Member class, with Members.person populated with name.
show_boards()[source]

Show all the boards in the database.

Param:Takes no arguments, call it like it is.
Returns:A somewhat human-friendly listing of all boards.
show_members()[source]

Show all members in the database.

Param:Takes no arguments, call it like it is.
Returns:A somewhat human-friendly listing of all members.

boards.py

Once we have an instance of Controller as described above, operations of boards can be done. When a new board is initialized, a simple dict is saved to the database. The names of the boards must be unique.

>>> import trellopy
>>> controller = trellopy.Controller()
>>> board_1 = controller.new_board('Board')
>>> board_2 = controller.get_board('Bored')
class trellopy.boards.Board(name, data=None)[source]
__init__(name, data=None)[source]

Initializes an Operator instance. The entire board is represented as a dict with the following attributes and defaults:

self.board = {}
self.board['name']        : Name of the board
self.board['lists']       : initialized as "None"
self.board['archived']    : initialized as "False"
self.board['labels']      : initialized as "None"
Parameters:
  • name (str.) – Name of the board
  • data (dict.) – Populate the board with data
add_label(label_name)[source]

Add a label to the board

Parameters:label_name (str.) – The name of label
add_list(list_name)[source]

Add a list to the board. This method updates the board.

Parameters:list_name (str.) – Name of the list
Returns:List as an instance of BoardList
archive()[source]

Sets the archived flag to True. This method updates the board.

Parameters:None – Call it like it is.
get_list(list_name)[source]

Get a list from the board

Parameters:list_name (str.) – Name of the list
Returns:List as an instance of BoardList
get_order()[source]

Get the order of the lists in board

Parameters:None – Call it like it is.
in_database(name)[source]

Check if baord is already in the database

Parameters:name (str.) – Name of the board
Returns:True if board exists, False if it does not.
rename(new_name)[source]

Renames the board. This method updates the board.

Parameters:new_name (str.) – The new name of board.
rename_label(label, new_name)[source]

Rename the label on the board

Parameters:
  • label (str.) – The original name of label
  • new_name (str.) – The new name of label
reorder(new_order)[source]

Reorder the lists in the board.

>>> board.reorder([2,4,5,1])
Parameters:new_order (list.) – A list of indices
save()[source]

Update the board in dictionary. Call this function to update lists.

A List class is represented as follows in the database.

>>> import trellopy
>>> controller = trellopy.Controller()
>>> board_1 = controller.new_board('Board')
>>> list_1 = board_1.get_list('List')
class trellopy.boards.BoardList(from_dict=None, *tuples, **dicts)[source]
__init__(from_dict=None, *tuples, **dicts)[source]

Represents each list in a board. Cards tied to this list is implemented as a list of dicts. The list object itself is represented as a dict too.

self.lizt = {}
self.lizt['board']      : Board the list belongs to
self.lizt['name']       : Name of the list
self.lizt['cards']      : List of cards associated. Default is None
self.lizt['archived']   : The archive flag. Default is False.
Parameters:from_dict (dict.) – If the list is to be pre-populated from a dict.
add_card(card)[source]

Add a card to the list. If the card is of type string, a new card is created. If it is an instance of BoardListCard then a copy of it appended to the current list of cards.

>>> list_one = board_one.get_list('Simplist')
>>> list_two = board_two.get_list('Unlisted')
>>> card_one = list_one.get_card('Simple Card')
>>> list_two.add_card(card_one)
>>> list_two.add_card('Another Card')
Parameters:card (str. or BoardListCard) – A card instance or name of card
archive()[source]

Sets the value of key archive to True

Parameters:None – Call it like it is.
get_card(card_name)[source]

Get a card from the list

Parameters:card_name (str.) – The name of card
Returns:Instance of BoardListCard
get_order()[source]

Get order of cards in list

>>> sample_list.get_order()
0 Card A
1 Another Card
2 Cardigan
3 Red Card
Parameters:None – Call it like it is.
Returns:An output of lists
rename(new_name)[source]

Sets the value of key name to new_name

reorder(new_order)[source]

Reorder the cards in list

Parameters:new_order (list.) – New order of cards, as a list of indices.
save()[source]

Save the list to the board

This is implemented as a simple dict. The property “name” must exist, as all cards must have a name.

>>> import trellopy
>>> controller = trellopy.Controller()
>>> board_1 = controller.new_board('Board')
>>> list_1 = board_1.get_list('List')
>>> card_1 = list_1.get_card('Card')
class trellopy.boards.BoardListCard(name, data=None)[source]
__init__(name, data=None)[source]

Initializes the card as a dict.

self.card  = {}
self.card['name']       : Name of card
self.card['archived']   : Archive flag.
                          Default is False
self.card['labeled']    : Label attached to card.
                          Default is None
self.card['assigned']   : List of members the card is assigned to.
                          Default is None.
Parameters:
  • name (str) – Name of card
  • data (dict) – Data to be pre-populated
archive()[source]

Sets the value of key archived to True

assign(member)[source]

Assign card to a member

label(label_name)[source]

Attach label to card

rename(new_name)[source]

Sets the value of key name to new_name

members.py

class trellopy.members.Member(member_name)[source]

Represents a member in the trellopy system.

__init__(member_name)[source]

Initialize a member class

archive()[source]

archive the member

in_database(member_name)[source]

Check if member already exists

rename(new_name)[source]

Rename the member

backend.py

class trellopy.backend.Operator[source]

This is the database operator. Currently only supports MongoDB.

__init__()[source]

Make a connection to the database

get_board(board_name)[source]

Get a board from the database

get_member(member_name)[source]

Get a member from the database

gimme_everybody()[source]

Fetch every member in the database

gimme_everything()[source]

Fetch every board in the database

new_member(member_dict)[source]

Add a member to the database

save_board(board_dict)[source]

Save the board to the database

update_board(board_data, board_name=None)[source]

Update the board in the database

update_member(member_data, member_name=None)[source]

Update a member in database