vartrix


Namevartrix JSON
Version 0.4.0 PyPI version JSON
download
home_pagehttps://github.com/pythoro/vartrix.git
SummaryEasily manange and automate variables and parameters.
upload_time2023-01-26 06:57:46
maintainer
docs_urlNone
authorReuben Rusk
requires_python
license
keywords parameters variables parametric automation automate
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # vartrix

Vartrix is about managing and automating parameters used in code. The name 'vartrix' is short for 'variable tricks'.

You might like vartrix if:

* You're worried about the growing complexity of all the parameters in your code and you'd like to use a robust, scalable approach from the start.
* Tracking all the parameters in your code has become difficult.
* You need parameters to be traceable so you are confident that the right ones are used
* You need to change parameters in a simple, robust and traceable way to ensure you haven't got an undetected coding error.
* You need to be able to snapshot parameters and store them.
* You've created ugly, fragile code to step through sets of parameters and run bits of code for each set.
* You pass around a lot of parameters between classes in your code, making it bloated, difficult to maintain, and fragile


## Quickstart tutorial - basic usage

Install using:

```
pip install vartrix
```

Then in your code, import vartrix to get started:

```python
import vartrix
```

### Containers
A container is a dictionary-like object that contains a set of parameters.

```python
dct = {
    'apple': 5,
    'banana': 7,
    'grape': 11,
    'fig': 13,
    'pear': 17,
    'orange': 19}}
container = vartrix.Container(dct)
print(container)
# {'apple': 5, 'banana': 7, 'grape': 11, 'fig': 13, 'pear': 17, 'orange': 19}
```

### Name spaces

Usually, we set containers up using a Name_Space instance. You can use the default:
```python
container = vartrix.get_container('example_name')
```

Or, set up your own:
```python
ns = vartrix.Name_Space()
container = ns.create('example_name_2', dct=dct)
```

Initialise it with a dictionary, like the above, or load one into it. A short way to set up a container is like this, as new containers are created if required:
```python
ns['tutorial_1'].load(dct)
```


### Using parameters
To get the current value of a key, simply use a dictionary-style get:

```python
container = ns['tutorial_1']
container['A']
```

### Attribute-style parameters
If you want both dictionary-style key access and attribute-style access to parameters, you can wrap any dictionary in an Attrdict:
```python
from vartrix.utils import Attrdict
any_dict = {'a': 5}
d = Attrdict(any_dict)
print(d['a'])
# 5
print(d.a)
# 5
```


## Quickstart tutorial - automation

### Setup

Let's set up a function to make a very simple Container first:
```python
import vartrix

ns = vartrix.Name_Space()

def setup_container():
    dct = {'apple': 1,
           'orange': 2,
           'fig': 3}
    container = ns['tutorial_2']
    container.load(dct)
```

Let's run it and check it's worked:

```python
setup_container()
print(ns['tutorial_2'])
# {'apple': 1, 'orange': 2, 'fig': 3}
```

### Sequences
Now, let's create a a set of automation parameters. They need to be a nested dictionary structure. We'll use a Yaml file to set them up.

You can build automation sets manually from dictionaries and classes in the automate module, but it's easier to use an input file. 

tutorial_2.yml
```yaml
aliases:
    alias_1: apple
    alias_2: orange
    alias_3: fig
set_1:
    vectors:
        vec_1:
            alias_1: [5, 10, 15]
        vec_2:
            labels:  ['a', 'b', 'c']
            alias_2: [  2,   3,   4]
            alias_3: [  6,   7,   8]
    sequences:
        seq_1:
            method_a: [vec_1, vec_2]
```

There are some key things about the structure:

* The first key is for aliases - these are optional. They simply enable you to use shorter names for parameters if you want.
* Remaining top level keys are for automation sets. Each is independent, and needs:
	* **vectors:** Dictionary where each key is the name of a vector. It's value is another dictionary. The aliases must exist in the `aliases` dictionary. There are multiple formats, as described below.
	* **sequences:** A dictionary where each key is the name of a sequence. Inside each sequence, there are keys that correspond to method names in the class that we're going to use for the automation. The values are lists of vector names that must exist in the `vectors` dictionary. The way they work is described below.
	
#### How sequences work
Inside each sequence is a list of methods (the keys) and their corresponding list of vector names. The automator takes the list of vector names and interates over their values in a nested fashion. For example, `[vec_1, vec_2]` means the outer loop iterates over the set of values in `vec_1`, while the inner loop iterates over the values in `vec_2`. There is no limit to how many vectors you use, but since the total number of steps in the overall sequence grows exponentially, don't use too many.

#### Vectors
Vectors specify what values to iterate over for one or more aliases. There are many ways to specify them, as described below.

**Simple vector.** Labels of [0, 1, 2] will be automatically created. The `style` key-value pair is optional for this style.
```yaml
        vec_1:
            style: value_lists
            alias_1: [5, 10, 15]
```

**Value lists.** Here, we'll specify the labels in a separate vector. On the first iteration, the first values of each vector will be used. The second iteration will use the second values, and so on. The `style` key-value pair is optional for this style.
```yaml
        vec_2:
            style: value_lists
            labels:  ['a', 'b', 'c']
            alias_2: [  2,   3,   4]
            alias_3: [  6,   7,   8]
```

**Value dictionaries.** We could achieve the same `vec_2` as above using the format below:
```yaml
        vec_2:
            style: value_dictionaries
            a:  {alias_2: 2, alias_3: 6},
            b:  {alias_2: 3, alias_3: 7},
            c:  {alias_2: 4, alias_3: 8},
```

**Csv file.** We could achieve the same `vec_2` as above using a csv file combined with the format below. The filename is joined with the path at `vartrix.automate.root`, which can be set by calling `vartrix.automate.set_root(path)`.
```yaml
        vec_2:
            style: csv
            filename: tutorial_2.csv
```

tutorial_2.csv:

index | alias_2 | alias_3
----- | ------- | -------
'a' | 2 | 6
'b' | 3 | 7
'c' | 4 | 8


**Custom.** You can even use your own vector interpreter. Here's how:
* Inherit `vartrix.automate.Vector` and define a method called `setup`. It needs to accept one argument - a dictionary of data that excludes the `style` key-value pair. It needs to return a list of labels (strings), and a list of dictionaries that contain key-value pairs for the aliases and thier corresponding values (e.g. `[{'alias_1': 4, 'alias_2': 5}, {'alias_1': 8, 'alias_2': 9}]`).
* Add your style, by calling `vartrix.automate.Vector_Factor.set_style(style_name, vec_cls)`. The *style_name* is a string you specify. The *vec_cls* is the class you just created.
* Use *style_name* as the `style` value for any vectors that use your new style.
 


#### Initialisation

To initialise, just pass in a Container instance and the filename to load from:

```python
import os
root = os.path.dirname(__file__)
fname = os.path.join(root, 'tutorial_2.yml')
automator = vartrix.Automator(ns['tutorial_2'], fname)
```

### Automated classes

The vartrix Automator calls the method(s) specified in each sequence at each iteration through the nested vector loops. In addition, there are several methods that provide hooks:

* prepare(): Called at the start of the set
* prepare_sequence(seq_name): Called at the start of each sequence
* prepare_method(method_name): Called before starting to call `method_name` at each iteration
* method_name(seq_name, val_dct, label_dct): The only required method - the name must match that in the sequence dictionary.
* finish_method(method_name): Called after after calling `method_name` at each iteration
* finish_sequence(seq_name): Called at the end of each sequence
* finish(): Called at the end of the set

For this tutorial, we'll create two simple classes like this:

```python
class Widget():
    def __init__(self):
        container = ns['tutorial_2']
        self.params = {'apple': container['apple'],
                       'orange': container['orange']}
    

class Automated():
    def __init__(self):
        pass
        
    def prepare(self):
        print('preparing...')

    def prepare_sequence(self, seq_name):
        print('running sequence: ' + seq_name)

    def prepare_method(self, method_name):
        print('running method: ' + method_name)

    def method_a(self, seq_name, val_dct, label_dct):
        print('calling method_a:')
        widget = Widget()
        print('current labels: ' + str(label_dct))
        print('current widget params: ' + str(widget.params))
        print('current val_dct: ' + str(val_dct))

    def finish_method(self, method_name):
        print('finishing method: ' + method_name)

    def finish_sequence(self, seq_name):
        print('finishing sequence: ' + seq_name)

    def finish(self):
        self.finish = True
```

### Execution

Now for the easy part. We can simply create an instance of our Automated class and pass it into the automator with the set name.

```python
automated = Automated()
automator.run('set_1', automated)
```

The output looks like this (as we used print statements):
```python
{'apple': 1, 'orange': 2, 'fig': 3}
preparing...
running sequence: seq_1
running method: method_a
calling method_a:
current labels: {'vec_1': 5, 'vec_2': 'a'}
current widget params: {'apple': 5, 'orange': 2}
current val_dct: {'apple': 5, 'orange': 2, 'fig': 6}
calling method_a:
current labels: {'vec_1': 5, 'vec_2': 'b'}
current widget params: {'apple': 5, 'orange': 3}
current val_dct: {'apple': 5, 'orange': 3, 'fig': 7}
calling method_a:
current labels: {'vec_1': 5, 'vec_2': 'c'}
current widget params: {'apple': 5, 'orange': 4}
current val_dct: {'apple': 5, 'orange': 4, 'fig': 8}
calling method_a:
current labels: {'vec_1': 10, 'vec_2': 'a'}
current widget params: {'apple': 10, 'orange': 2}
current val_dct: {'apple': 10, 'orange': 2, 'fig': 6}
calling method_a:
current labels: {'vec_1': 10, 'vec_2': 'b'}
current widget params: {'apple': 10, 'orange': 3}
current val_dct: {'apple': 10, 'orange': 3, 'fig': 7}
calling method_a:
current labels: {'vec_1': 10, 'vec_2': 'c'}
current widget params: {'apple': 10, 'orange': 4}
current val_dct: {'apple': 10, 'orange': 4, 'fig': 8}
calling method_a:
current labels: {'vec_1': 15, 'vec_2': 'a'}
current widget params: {'apple': 15, 'orange': 2}
current val_dct: {'apple': 15, 'orange': 2, 'fig': 6}
calling method_a:
current labels: {'vec_1': 15, 'vec_2': 'b'}
current widget params: {'apple': 15, 'orange': 3}
current val_dct: {'apple': 15, 'orange': 3, 'fig': 7}
calling method_a:
current labels: {'vec_1': 15, 'vec_2': 'c'}
current widget params: {'apple': 15, 'orange': 4}
current val_dct: {'apple': 15, 'orange': 4, 'fig': 8}
finishing method: method_a
finishing sequence: seq_1
```

The values in the Container are changed automatically by the Automator before calling `method_a`. But, the automator also passes in `val_dct`, a dictionary of automated key-value pairs, in case they are convenient. It's also often desirable to have shorter, simpler labels at each iteration for each vector, and the automator passes in `label_dct` for that purpose as well.

If we want to change the way we automate the parameters, now we only need to change the specification in our yaml file (`tutorial_2.yml`) - there's no need for manual coding of the automation. This approach has a number of advantages:

* Faster creation of iterative sequences
* Fewer mistakes
* Easier management of parameters
* Full traceability of how parameters are changed
* Flexble, loosely coupled code. The classes that use the values in the Container need no knowledge of the automation, and the automation needs no knowledge of them.


## Related packages

Other packages exist that overlap with vartrix in functionality. You might want to look at:

* parameters
* param
* paranormal
* traits
* traitlets
* attrs
* pypet

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/pythoro/vartrix.git",
    "name": "vartrix",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "PARAMETERS,VARIABLES,PARAMETRIC,AUTOMATION,AUTOMATE",
    "author": "Reuben Rusk",
    "author_email": "",
    "download_url": "https://files.pythonhosted.org/packages/3c/de/16df8d9299a3b12215e21e611c752f23aa864e842459c3d42703a3d1dfb0/vartrix-0.4.0.tar.gz",
    "platform": null,
    "description": "# vartrix\r\n\r\nVartrix is about managing and automating parameters used in code. The name 'vartrix' is short for 'variable tricks'.\r\n\r\nYou might like vartrix if:\r\n\r\n* You're worried about the growing complexity of all the parameters in your code and you'd like to use a robust, scalable approach from the start.\r\n* Tracking all the parameters in your code has become difficult.\r\n* You need parameters to be traceable so you are confident that the right ones are used\r\n* You need to change parameters in a simple, robust and traceable way to ensure you haven't got an undetected coding error.\r\n* You need to be able to snapshot parameters and store them.\r\n* You've created ugly, fragile code to step through sets of parameters and run bits of code for each set.\r\n* You pass around a lot of parameters between classes in your code, making it bloated, difficult to maintain, and fragile\r\n\r\n\r\n## Quickstart tutorial - basic usage\r\n\r\nInstall using:\r\n\r\n```\r\npip install vartrix\r\n```\r\n\r\nThen in your code, import vartrix to get started:\r\n\r\n```python\r\nimport vartrix\r\n```\r\n\r\n### Containers\r\nA container is a dictionary-like object that contains a set of parameters.\r\n\r\n```python\r\ndct = {\r\n    'apple': 5,\r\n    'banana': 7,\r\n    'grape': 11,\r\n    'fig': 13,\r\n    'pear': 17,\r\n    'orange': 19}}\r\ncontainer = vartrix.Container(dct)\r\nprint(container)\r\n# {'apple': 5, 'banana': 7, 'grape': 11, 'fig': 13, 'pear': 17, 'orange': 19}\r\n```\r\n\r\n### Name spaces\r\n\r\nUsually, we set containers up using a Name_Space instance. You can use the default:\r\n```python\r\ncontainer = vartrix.get_container('example_name')\r\n```\r\n\r\nOr, set up your own:\r\n```python\r\nns = vartrix.Name_Space()\r\ncontainer = ns.create('example_name_2', dct=dct)\r\n```\r\n\r\nInitialise it with a dictionary, like the above, or load one into it. A short way to set up a container is like this, as new containers are created if required:\r\n```python\r\nns['tutorial_1'].load(dct)\r\n```\r\n\r\n\r\n### Using parameters\r\nTo get the current value of a key, simply use a dictionary-style get:\r\n\r\n```python\r\ncontainer = ns['tutorial_1']\r\ncontainer['A']\r\n```\r\n\r\n### Attribute-style parameters\r\nIf you want both dictionary-style key access and attribute-style access to parameters, you can wrap any dictionary in an Attrdict:\r\n```python\r\nfrom vartrix.utils import Attrdict\r\nany_dict = {'a': 5}\r\nd = Attrdict(any_dict)\r\nprint(d['a'])\r\n# 5\r\nprint(d.a)\r\n# 5\r\n```\r\n\r\n\r\n## Quickstart tutorial - automation\r\n\r\n### Setup\r\n\r\nLet's set up a function to make a very simple Container first:\r\n```python\r\nimport vartrix\r\n\r\nns = vartrix.Name_Space()\r\n\r\ndef setup_container():\r\n    dct = {'apple': 1,\r\n           'orange': 2,\r\n           'fig': 3}\r\n    container = ns['tutorial_2']\r\n    container.load(dct)\r\n```\r\n\r\nLet's run it and check it's worked:\r\n\r\n```python\r\nsetup_container()\r\nprint(ns['tutorial_2'])\r\n# {'apple': 1, 'orange': 2, 'fig': 3}\r\n```\r\n\r\n### Sequences\r\nNow, let's create a a set of automation parameters. They need to be a nested dictionary structure. We'll use a Yaml file to set them up.\r\n\r\nYou can build automation sets manually from dictionaries and classes in the automate module, but it's easier to use an input file. \r\n\r\ntutorial_2.yml\r\n```yaml\r\naliases:\r\n    alias_1: apple\r\n    alias_2: orange\r\n    alias_3: fig\r\nset_1:\r\n    vectors:\r\n        vec_1:\r\n            alias_1: [5, 10, 15]\r\n        vec_2:\r\n            labels:  ['a', 'b', 'c']\r\n            alias_2: [  2,   3,   4]\r\n            alias_3: [  6,   7,   8]\r\n    sequences:\r\n        seq_1:\r\n            method_a: [vec_1, vec_2]\r\n```\r\n\r\nThere are some key things about the structure:\r\n\r\n* The first key is for aliases - these are optional. They simply enable you to use shorter names for parameters if you want.\r\n* Remaining top level keys are for automation sets. Each is independent, and needs:\r\n\t* **vectors:** Dictionary where each key is the name of a vector. It's value is another dictionary. The aliases must exist in the `aliases` dictionary. There are multiple formats, as described below.\r\n\t* **sequences:** A dictionary where each key is the name of a sequence. Inside each sequence, there are keys that correspond to method names in the class that we're going to use for the automation. The values are lists of vector names that must exist in the `vectors` dictionary. The way they work is described below.\r\n\t\r\n#### How sequences work\r\nInside each sequence is a list of methods (the keys) and their corresponding list of vector names. The automator takes the list of vector names and interates over their values in a nested fashion. For example, `[vec_1, vec_2]` means the outer loop iterates over the set of values in `vec_1`, while the inner loop iterates over the values in `vec_2`. There is no limit to how many vectors you use, but since the total number of steps in the overall sequence grows exponentially, don't use too many.\r\n\r\n#### Vectors\r\nVectors specify what values to iterate over for one or more aliases. There are many ways to specify them, as described below.\r\n\r\n**Simple vector.** Labels of [0, 1, 2] will be automatically created. The `style` key-value pair is optional for this style.\r\n```yaml\r\n        vec_1:\r\n            style: value_lists\r\n            alias_1: [5, 10, 15]\r\n```\r\n\r\n**Value lists.** Here, we'll specify the labels in a separate vector. On the first iteration, the first values of each vector will be used. The second iteration will use the second values, and so on. The `style` key-value pair is optional for this style.\r\n```yaml\r\n        vec_2:\r\n            style: value_lists\r\n            labels:  ['a', 'b', 'c']\r\n            alias_2: [  2,   3,   4]\r\n            alias_3: [  6,   7,   8]\r\n```\r\n\r\n**Value dictionaries.** We could achieve the same `vec_2` as above using the format below:\r\n```yaml\r\n        vec_2:\r\n            style: value_dictionaries\r\n            a:  {alias_2: 2, alias_3: 6},\r\n            b:  {alias_2: 3, alias_3: 7},\r\n            c:  {alias_2: 4, alias_3: 8},\r\n```\r\n\r\n**Csv file.** We could achieve the same `vec_2` as above using a csv file combined with the format below. The filename is joined with the path at `vartrix.automate.root`, which can be set by calling `vartrix.automate.set_root(path)`.\r\n```yaml\r\n        vec_2:\r\n            style: csv\r\n            filename: tutorial_2.csv\r\n```\r\n\r\ntutorial_2.csv:\r\n\r\nindex | alias_2 | alias_3\r\n----- | ------- | -------\r\n'a' | 2 | 6\r\n'b' | 3 | 7\r\n'c' | 4 | 8\r\n\r\n\r\n**Custom.** You can even use your own vector interpreter. Here's how:\r\n* Inherit `vartrix.automate.Vector` and define a method called `setup`. It needs to accept one argument - a dictionary of data that excludes the `style` key-value pair. It needs to return a list of labels (strings), and a list of dictionaries that contain key-value pairs for the aliases and thier corresponding values (e.g. `[{'alias_1': 4, 'alias_2': 5}, {'alias_1': 8, 'alias_2': 9}]`).\r\n* Add your style, by calling `vartrix.automate.Vector_Factor.set_style(style_name, vec_cls)`. The *style_name* is a string you specify. The *vec_cls* is the class you just created.\r\n* Use *style_name* as the `style` value for any vectors that use your new style.\r\n \r\n\r\n\r\n#### Initialisation\r\n\r\nTo initialise, just pass in a Container instance and the filename to load from:\r\n\r\n```python\r\nimport os\r\nroot = os.path.dirname(__file__)\r\nfname = os.path.join(root, 'tutorial_2.yml')\r\nautomator = vartrix.Automator(ns['tutorial_2'], fname)\r\n```\r\n\r\n### Automated classes\r\n\r\nThe vartrix Automator calls the method(s) specified in each sequence at each iteration through the nested vector loops. In addition, there are several methods that provide hooks:\r\n\r\n* prepare(): Called at the start of the set\r\n* prepare_sequence(seq_name): Called at the start of each sequence\r\n* prepare_method(method_name): Called before starting to call `method_name` at each iteration\r\n* method_name(seq_name, val_dct, label_dct): The only required method - the name must match that in the sequence dictionary.\r\n* finish_method(method_name): Called after after calling `method_name` at each iteration\r\n* finish_sequence(seq_name): Called at the end of each sequence\r\n* finish(): Called at the end of the set\r\n\r\nFor this tutorial, we'll create two simple classes like this:\r\n\r\n```python\r\nclass Widget():\r\n    def __init__(self):\r\n        container = ns['tutorial_2']\r\n        self.params = {'apple': container['apple'],\r\n                       'orange': container['orange']}\r\n    \r\n\r\nclass Automated():\r\n    def __init__(self):\r\n        pass\r\n        \r\n    def prepare(self):\r\n        print('preparing...')\r\n\r\n    def prepare_sequence(self, seq_name):\r\n        print('running sequence: ' + seq_name)\r\n\r\n    def prepare_method(self, method_name):\r\n        print('running method: ' + method_name)\r\n\r\n    def method_a(self, seq_name, val_dct, label_dct):\r\n        print('calling method_a:')\r\n        widget = Widget()\r\n        print('current labels: ' + str(label_dct))\r\n        print('current widget params: ' + str(widget.params))\r\n        print('current val_dct: ' + str(val_dct))\r\n\r\n    def finish_method(self, method_name):\r\n        print('finishing method: ' + method_name)\r\n\r\n    def finish_sequence(self, seq_name):\r\n        print('finishing sequence: ' + seq_name)\r\n\r\n    def finish(self):\r\n        self.finish = True\r\n```\r\n\r\n### Execution\r\n\r\nNow for the easy part. We can simply create an instance of our Automated class and pass it into the automator with the set name.\r\n\r\n```python\r\nautomated = Automated()\r\nautomator.run('set_1', automated)\r\n```\r\n\r\nThe output looks like this (as we used print statements):\r\n```python\r\n{'apple': 1, 'orange': 2, 'fig': 3}\r\npreparing...\r\nrunning sequence: seq_1\r\nrunning method: method_a\r\ncalling method_a:\r\ncurrent labels: {'vec_1': 5, 'vec_2': 'a'}\r\ncurrent widget params: {'apple': 5, 'orange': 2}\r\ncurrent val_dct: {'apple': 5, 'orange': 2, 'fig': 6}\r\ncalling method_a:\r\ncurrent labels: {'vec_1': 5, 'vec_2': 'b'}\r\ncurrent widget params: {'apple': 5, 'orange': 3}\r\ncurrent val_dct: {'apple': 5, 'orange': 3, 'fig': 7}\r\ncalling method_a:\r\ncurrent labels: {'vec_1': 5, 'vec_2': 'c'}\r\ncurrent widget params: {'apple': 5, 'orange': 4}\r\ncurrent val_dct: {'apple': 5, 'orange': 4, 'fig': 8}\r\ncalling method_a:\r\ncurrent labels: {'vec_1': 10, 'vec_2': 'a'}\r\ncurrent widget params: {'apple': 10, 'orange': 2}\r\ncurrent val_dct: {'apple': 10, 'orange': 2, 'fig': 6}\r\ncalling method_a:\r\ncurrent labels: {'vec_1': 10, 'vec_2': 'b'}\r\ncurrent widget params: {'apple': 10, 'orange': 3}\r\ncurrent val_dct: {'apple': 10, 'orange': 3, 'fig': 7}\r\ncalling method_a:\r\ncurrent labels: {'vec_1': 10, 'vec_2': 'c'}\r\ncurrent widget params: {'apple': 10, 'orange': 4}\r\ncurrent val_dct: {'apple': 10, 'orange': 4, 'fig': 8}\r\ncalling method_a:\r\ncurrent labels: {'vec_1': 15, 'vec_2': 'a'}\r\ncurrent widget params: {'apple': 15, 'orange': 2}\r\ncurrent val_dct: {'apple': 15, 'orange': 2, 'fig': 6}\r\ncalling method_a:\r\ncurrent labels: {'vec_1': 15, 'vec_2': 'b'}\r\ncurrent widget params: {'apple': 15, 'orange': 3}\r\ncurrent val_dct: {'apple': 15, 'orange': 3, 'fig': 7}\r\ncalling method_a:\r\ncurrent labels: {'vec_1': 15, 'vec_2': 'c'}\r\ncurrent widget params: {'apple': 15, 'orange': 4}\r\ncurrent val_dct: {'apple': 15, 'orange': 4, 'fig': 8}\r\nfinishing method: method_a\r\nfinishing sequence: seq_1\r\n```\r\n\r\nThe values in the Container are changed automatically by the Automator before calling `method_a`. But, the automator also passes in `val_dct`, a dictionary of automated key-value pairs, in case they are convenient. It's also often desirable to have shorter, simpler labels at each iteration for each vector, and the automator passes in `label_dct` for that purpose as well.\r\n\r\nIf we want to change the way we automate the parameters, now we only need to change the specification in our yaml file (`tutorial_2.yml`) - there's no need for manual coding of the automation. This approach has a number of advantages:\r\n\r\n* Faster creation of iterative sequences\r\n* Fewer mistakes\r\n* Easier management of parameters\r\n* Full traceability of how parameters are changed\r\n* Flexble, loosely coupled code. The classes that use the values in the Container need no knowledge of the automation, and the automation needs no knowledge of them.\r\n\r\n\r\n## Related packages\r\n\r\nOther packages exist that overlap with vartrix in functionality. You might want to look at:\r\n\r\n* parameters\r\n* param\r\n* paranormal\r\n* traits\r\n* traitlets\r\n* attrs\r\n* pypet\r\n",
    "bugtrack_url": null,
    "license": "",
    "summary": "Easily manange and automate variables and parameters.",
    "version": "0.4.0",
    "split_keywords": [
        "parameters",
        "variables",
        "parametric",
        "automation",
        "automate"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "3cde16df8d9299a3b12215e21e611c752f23aa864e842459c3d42703a3d1dfb0",
                "md5": "cd7026d9a3ce025d80f0796c5b8963c1",
                "sha256": "324cbf38b60aec94cfcf11f0c34af3b2826c9bc9a3befd5f644c3c3e45fe1944"
            },
            "downloads": -1,
            "filename": "vartrix-0.4.0.tar.gz",
            "has_sig": false,
            "md5_digest": "cd7026d9a3ce025d80f0796c5b8963c1",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 22249,
            "upload_time": "2023-01-26T06:57:46",
            "upload_time_iso_8601": "2023-01-26T06:57:46.306707Z",
            "url": "https://files.pythonhosted.org/packages/3c/de/16df8d9299a3b12215e21e611c752f23aa864e842459c3d42703a3d1dfb0/vartrix-0.4.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-01-26 06:57:46",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "github_user": "pythoro",
    "github_project": "vartrix.git",
    "lcname": "vartrix"
}
        
Elapsed time: 0.70119s