Skip to content

Commit

Permalink
Merge pull request #16 from ForeverWintr/dev
Browse files Browse the repository at this point in the history
v1.1.0
  • Loading branch information
ForeverWintr authored Jan 28, 2018
2 parents 035c5ee + 8a0749c commit e9c6e51
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 7 deletions.
20 changes: 14 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# MetaFunctions
[![Build Status](https://travis-ci.org/ForeverWintr/metafunctions.svg?branch=master)](https://travis-ci.org/ForeverWintr/metafunctions) [![Codecov](https://codecov.io/gh/ForeverWintr/metafunctions/coverage.svg?branch=master)](https://codecov.io/gh/ForeverWintr/metafunctions)
[![Build Status](https://travis-ci.org/ForeverWintr/metafunctions.svg?branch=master)](https://travis-ci.org/ForeverWintr/metafunctions) [![Build status](https://ci.appveyor.com/api/projects/status/8120lqx7e9ys2m0u/branch/master?svg=true)](https://ci.appveyor.com/project/ForeverWintr/metafunctions/branch/master) [![Codecov](https://codecov.io/gh/ForeverWintr/metafunctions/coverage.svg?branch=master)](https://codecov.io/gh/ForeverWintr/metafunctions)




## Metafunctions is a function composition and data pipelining library.
It allows for data pipeline creation separate from execution, so instead of writing:

Expand Down Expand Up @@ -50,13 +54,19 @@ Well you may not *need* a new syntax, but the ability to compose a data pipeline
result = pipeline(data)
```

## Installation

MetaFunctions supports python 3.5+

`pip install metafunctions`

## How does it work?

Conceptually, a MetaFunction is a function that contains other functions. When you call a MetaFunction, the MetaFunction calls the functions it contains.

You can create a MetaFunction using the `node` decorator:
```python
from metafunctions.decorators import node
from metafunctions import node

@node
def get_name(prompt):
Expand Down Expand Up @@ -124,8 +134,6 @@ builtins.ValueError: could not convert string to float: '$800'
Occured in the following function: ((query_volume | float) + (query_price | ->float<-))
```

*Note:* This behavior can be disabled by specifying `modify_tracebacks=False` in the `node` decorator.

### Advanced Pipeline Construction Tools

Metafunctions provides utilities for constructing advanced function pipelines.
Expand Down Expand Up @@ -171,10 +179,10 @@ Metafunctions provides utilities for constructing advanced function pipelines.
process_companies = get_company_data | filter | process
process_customers = get_customer_data | filter | process

do_large_calculation = process_companies + process_customers
process_all = process_companies & process_customers
```

Assuming the component functions in the `do_large_calculation` MetaFunction follow good functional practices and do not have side effects, it's easy to see that `process_companies` and `process_customers` are independent of each other. If that's the case, we can safely execute them in parallel. The `concurrent` metafunction decorator allows you to specify steps in the function pipeline to execute in parallel:
Assuming the component functions in the `process_all` MetaFunction follow good functional practices and do not have side effects, it's easy to see that `process_companies` and `process_customers` are independent of each other. If that's the case, we can safely execute them in parallel. The `concurrent` metafunction decorator allows you to specify steps in the function pipeline to execute in parallel:

```python
from metafunctions import concurrent
Expand Down
2 changes: 1 addition & 1 deletion metafunctions/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
__version__ = '1.0.1'
__version__ = '1.1.0'

from metafunctions.api import (node, bind_call_state, star, store, recall, concurrent, mmap,
locate_error)

0 comments on commit e9c6e51

Please sign in to comment.