Skip to main content
# Log as append-only source package

[![Build Status](https://travis-ci.org/BlackHC/laaos.svg?branch=master)](https://travis-ci.org/BlackHC/laaos)

Logs as append-only source: write your ML training results in Python without having to worry about crashes. Loading is a breeze: the logs are native Python code. The package supports unstructured data. The data can easily be imported into Jupyter notebooks or elsewhere.

## Installation

To install using pip, use:

```
pip install blackhc.laaos
```

To run the tests, use:

```
python setup.py test
```

## Append-only source logs

Storing training results as Python dictionaries or JSON files is problematic because the formats are not append-only,
which means that you have to rewrite the file every time something changes. (Or you only write results at the end,
which does not play well with interruptions or intermediate failures.)

Alternatively, we can simply write the operations that create a structure to a file in an append-only fashion.
If the data structure itself is growing and not mutated, this only increases file-size by a constant factor.

The advantage of this library is that the file format is very simple: it's valid Python code.

The only requirement is that you only store primitive types, lists, sets, dicts and immutable types.

Custom wrappers can be added by registering `TypeHandler`s. See `WeakEnumHandler` and `StrEnumHandler`.

## Example

```python
from blackhc.laaos import create_file_store, safe_load_store
store = create_file_store('test', suffix='')

store['losses'] = []
losses = store['losses']

for i in range(1, 10):
losses.append(1/i)

store.close()
```

The resulting file `laaos/test.py` looks as follows:

```python
store = {}
store['losses']=[]
store['losses'].append(1.0)
store['losses'].append(0.5)
store['losses'].append(0.3333333333333333)
store['losses'].append(0.25)
store['losses'].append(0.2)
store['losses'].append(0.16666666666666666)
store['losses'].append(0.14285714285714285)
store['losses'].append(0.125)
store['losses'].append(0.1111111111111111)
```

It can be loaded either with:

```python
form laaos.test import store
```

or with the more secure:

```python
safe_load('laaos/test.py')
```


Metadata

Release files for blackhc.laaos 0.1.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distribution (wheel)

Table of built distributions (wheels) for blackhc.laaos 0.1.2
File Interpreter ABI Platform
blackhc.laaos-0.1.2-py3-none-any.whl Python 3 none any Details

Release files / blackhc.laaos-0.1.2-py3-none-any.whl

Download URL blackhc.laaos-0.1.2-py3-none-any.whl
Size 6.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d75147c6b844886a316f1341eeecdad88c6b35614630abeabcda2fa166b30d78
BLAKE2b-256 checksum
How to use checksums
21c1ad13bf214d235b67b761142a38a7593f8173ab5f78defe09de8d89137486
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.6.8

Security for blackhc.laaos 0.1.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page