Amatino Python 0.0.13 Released

Rejoice, Pythonistas! A new version of the Amatino Python library is now available. 0.0.13 adds new capabilities. Amatino Python is now nearing initial feature completion, with almost all existing API classes covered. Watch out, 0.0.13 is catastrophically breaking, many method signatures have changed and code written for 0.0.12 will not work.

Why all the breaks? Many methods in 0.0.12 required the provision of a Session independent of an Entity, despite that Entity having ready access to the Session used when it was itself initialised. This redundancy was needlessly verbose.

  • Add new UserList class
  • Add User.delete(), .create(), and .create_many() method
  • Add TransactionVersionList class
  • Conform Ledger to collections.Sequence
  • Simplify Ledger, Balance, Account, and Transaction method signatures: No more Session requirement
  • Publicise User.decode_many() method
  • Conform Transaction to collections.Sequence
  • Add Transaction.magnitude property
  • Conform Balance and RecursiveBalance to Denominated protocol
  • Conform Ledger and RecursiveLedger to Denominated protocol

Ledger and Transaction may be now be directly iterated over, revealing constituent LedgerRows and Entries respectively. They may also be subscripted.

An example using Ledger:

ledger = Ledger.retrieve(
   entity=mega_corp,
   account=revenue
)

for row in ledger:
   print("[{date}] {balance}".format(
      date=row.transaction.time.strftime("%Y-%m-%d"),
      balance='{:,.2f}'.format(row.balance)
   ))

print("Last row balance: {balance}".format(
   balance='{:,.2f}'.format(ledger[-1].balance)
))

And Transaction:

sale = Transaction.retrieve(
   entity=mega_corp,
   id_=42,
   denomination=USD
)

print("Largest single entry: {amount}".format(
   amount='{:,2f}'.format(
      max([entry.amount for entry in sale])
   )
))

The new UserList allows you to retrieve all white-labels managed by your billing account. Draw on the State enum to refine the retrieval to all, deleted, or active users.

active_users = UserList(
   session=session,
   state=State.active
)

print("Currently paying for {num} users".format(
   num=str(len(active_users))
))

Review the history of modifications to a Transaction using the TransactionVersionList.

versions = TransactionVersionList.retrieve(
   entity=mega_corp,
   transaction=big_sale
)

for version in versions:
   print("{time}: {magnitude}".format(
      time=version.version_time.strftime("%Y-%m-%d"),
      magnitude='{:,2f}'.format(version.magnitude)
   )

For detailed documentation of the properties and methods of all Amatino classes, check out the Amatino Python Documentation.

You can install Amatino via PyPi:

$ pip install amatino

Or, if you already have Amatino Python installed, upgrade:

$ pip install --upgrade amatino

Your feedback is most welcome on the Amatino discussion forums, or on Twitter.