![](https://content.amatino.io/blog/wp-content/uploads/2019/03/27142021/20190327_AM_Python_0.0.13.jpg)
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<strong> catastrophically breaking</strong>, 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 <code>Session</code> independent of an <code>Entity</code>, despite that <code>Entity</code> having ready access to the <code>Session</code> used when it was itself initialised. This redundancy was needlessly verbose.
<ul>
<li>Add new <code>UserList</code> class</li>
<li>Add <code>User.delete()</code>, <code>.create()</code>, and <code>.create_many()</code> method</li>
<li>Add <code>TransactionVersionList</code> class</li>
<li>Conform <code>Ledger</code> to <code>collections.Sequence</code></li>
<li>Simplify <code>Ledger</code>, <code>Balance</code>, <code>Account</code>, and <code>Transaction</code> method signatures: No more <code>Session</code> requirement</li>
<li>Publicise <code>User.decode_many()</code> method</li>
<li>Conform <code>Transaction</code> to <code>collections.Sequence</code></li>
<li>Add <code>Transaction.magnitude</code> property</li>
<li>Conform <code>Balance</code> and <code>RecursiveBalance</code> to <code>Denominated</code> protocol</li>
<li>Conform <code>Ledger</code> and <code>RecursiveLedger</code> to <code>Denominated</code> protocol</li>
</ul>
<code>Ledger</code> and <code>Transaction</code> may be now be directly iterated over, revealing constituent <code>LedgerRows</code> and <code>Entries</code> respectively. They may also be subscripted.
An example using <code>Ledger</code>:
python
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 <code>Transaction</code>:
python
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 <code>State</code> enum to refine the retrieval to all, deleted, or active users.
python
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 <code>Transaction</code> using the <code>TransactionVersionList</code>.
python
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 <a href="https://github.com/amatino-code/amatino-python/wiki/Documentation">Amatino Python Documentation</a>.
You can install <a href="https://pypi.org/project/amatino/">Amatino via PyPi</a>:
<pre>$ pip install amatino</pre>
Or, if you already have Amatino Python installed, upgrade:
<pre>$ pip install --upgrade amatino</pre>
Your feedback is most welcome on the <a href="https://amatino.io/discussion">Amatino discussion forums</a>, or <a href="https://twitter.com/amatinoapi">on Twitter</a>.