An open API service indexing awesome lists of open source software.

https://github.com/kentwait/picklenote

Pickle an object together with a short note about it
https://github.com/kentwait/picklenote

Last synced: 3 months ago
JSON representation

Pickle an object together with a short note about it

Awesome Lists containing this project

README

          

# picklenote
Pickle an object together with a short note about it

## Quickstart
```python
import picklenote as pkl

data = [0, 1, 2, 3, 4]
note = "A list of 5 integers from 0"

# Dumps the object `data`, the annotation about the object `note`, and the filename where to save the pickle
pkl.dump(data, note, 'int_list.pickle')

# Loads the pickle as a PickleNote object with `.obj` and `.note` attributes
annotated_data = pkl.load('int_list.pickle')

# Returns the pickled object `[0, 1, 2, 3, 4]`
annotated_data.obj

# Returns the note:
# A list of 5 integers from 0
annotated_data.note

# Can also be loaded using regular pickle
# Loads as a dictionary `{'obj': ..., 'note': ...}
import pickle

picklenote_dict = pickle.load(open('int_list.pickle', 'wb'))

```