Factum
What if every function remembered its own output, and knew when and where to acquire its own inputs?
Factum is a simple agent-inspired framework for computational DAG composition and execution.
Theory
Object Oriented Programming (OOP) was originally conceived, at least in part, as an abstraction of the actor model of distributed functional programming in a serial computing environment.
Factum represents a simple return to that vision. It's a functional paradigm facilitated by an object oriented implementation.
Core to the idea is the Fact object: a class that defines inputs, a function and an output. The inputs can change, but they're not meant to. Thus the Factum represents the function in a particular context: a fact - it always represents the same information.
It's basically a function that is responsible for gathering its own inputs and caching its output (so other function objects can efficiently gather their own inputs).
These Fact objects, taken together are wired up to require inputs from each other and generally form a directed acyclic graph, though there is no mechanism to enforce a DAG structure.
Use
from factum import Fact
def a_node():
print('A running!')
return 1
def b_node():
print('B running!')
return 2
def c_node(*args):
print('C running!')
return args[0] + args[1]
def d_node(self, **kwargs):
return self._transformation(**kwargs)
def _transformation(self, cthing):
print('D running!')
return cthing + 1
# Fact(function, inputs, name)
a = Fact(a_node)
b = Fact(b_node, None, 'Beta')
c = Fact(c_node)
a > c
b > c
d = Fact(d_node, {'cthing': c})
d.add_method(_transformation)
d.run()
>>> A running!
>>> B running!
>>> C running!
>>> D running!
>>> 4
# cached
d.run()
>>> 4
b.run(-1)
>>> B running!
>>> 2
# re-runs downstream of change
d.run()
>>> C running!
>>> D running!
>>> 4
d.visualize()
Metadata
Release files for factum 0.0.5
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| factum-0.0.5.tar.gz | 10.3 kB | Without provenance | Details for factum-0.0.5.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| factum-0.0.5-py3-none-any.whl | Python 3 | none | any | Details for factum-0.0.5-py3-none-any.whl |
Total release size: 24.0 kB
Release files / factum-0.0.5.tar.gz
| Download URL | factum-0.0.5.tar.gz |
|---|---|
| Size | 10.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
884361f280dfb1b4b803916bc25c94fe8ac12e6bd2ff5097504311c64c33a0e0
|
|
BLAKE2b-256 checksum How to use checksums |
909e32da804c1e9e2f22687991c363724e98c4ebaf81ace05c7ea052d1cadd8d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.48.0 CPython/3.8.4
|
Release files / factum-0.0.5-py3-none-any.whl
| Download URL | factum-0.0.5-py3-none-any.whl |
|---|---|
| Size | 13.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
fe12012d3b680ad950b1e305a6bc4b304319d43727655d58c73cca510ec13c3c
|
|
BLAKE2b-256 checksum How to use checksums |
64c06bb3d481b67303f4781cf400c103dc6dfd0903f76ddfe52a8980d2f9e3d8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.48.0 CPython/3.8.4
|
Security for factum 0.0.5
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.
To learn more about protecting yourself from malicious actors, visit our package security documentation.