-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathREADME.md.in
67 lines (49 loc) · 2.35 KB
/
README.md.in
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
![coverage](https://codecov.io/gh/stagedml/pylightnix/branch/master/graph/badge.svg)
Pylightnix
==========
Pylightnix is a minimalistic Python library for managing filesystem-based
immutable data objects, inspired by [Purely Functional Software Deployment Model
thesis by Eelco Dolstra](https://edolstra.github.io/pubs/phd-thesis.pdf) and the
[Nix](https://nixos.org) package manager.
The library may be thought as of low-level API for creating caching wrappers
for a subset of Python functions. In particular, Pylightnix allows user to
* Prepare (or, in our terms - **instantiate**) the computation plan aimed at
creating a tree of linked immutable stage objects, stored in the filesystem.
* Implement (in our terms - **realize**) the prepared computation plan, access
the resulting artifacts. Pylightnix is able to handle **non-deterministic**
results of the computation.
* Handle changes in the computation plan, re-use the existing artifacts
whenever possible.
* Gain full control over all aspects of the cached data including the
garbage-collection.
```{.python .cb.nb live_output=true}
import numpy as np
from pylightnix import *
fsinit('_pylightnix',use_as_default=True)
with current_registry(mkregistry()):
@autostage(A=100,out=[selfref,'dataset.npy'])
def stage_dataset(build,A,out):
np.save(out,np.arange(0,A))
@autostage(DS=stage_dataset(),out=[selfref,'model.npy'],nouts=10)
def stage_train(build,rindex,DS,out):
ds=np.load(DS.out)
np.save(out,rindex)
# TODO
rrefs=realizeMany(instantiate(stage_train))
assert len(rrefs)>=10
```
Documentation
-------------
QuickStart [[PDF]](https://raw.github.com/stagedml/pylightnix-docs/master/Pylightnix-QuickStart-latest.pdf) |
API Referece [[MD]](./docs/Reference.md)
Demos:
* [GNU Hello](./docs/demos/HELLO.md), turn Pylightnix into a toy
package manager to build the GNU Hello from sources.
* [MDRUN](./docs/demos/MDRUN.py), evaluate code sections of a Markdown document,
cache the results between runs.
(Outdated)
Manual [[PDF]](https://raw.github.com/stagedml/pylightnix-docs/master/Pylightnix-Manual-latest.pdf)
* [Ultimatum tutorial](https://github.com/grwlf/ultimatum-game/blob/master/docs/Pylightnix.md),
managing experiments.
* [MNIST demo](./docs/demos/MNIST.md) shows some machine learning specific.
* [REPL demo](./docs/demos/REPL.md) illustrates how to debug stage sequences.