Skip to content

Commit ca666f5

Browse files
committed
make release-tag: Merge branch 'master' into stable
2 parents 04bb5fc + e8d353d commit ca666f5

File tree

7 files changed

+146
-39
lines changed

7 files changed

+146
-39
lines changed

HISTORY.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
Changelog
22
=========
33

4+
0.4.1 - 2021-10-08
5+
------------------
6+
7+
* Update NumPy dependency - [Issue #136](https://github.com/MLBazaar/MLBlocks/issues/136) by @sarahmish
8+
* Support dynamic inputs and outputs - [Issue #134](https://github.com/MLBazaar/MLBlocks/issues/134) by @pvk-developer
9+
410
0.4.0 - 2021-01-09
511
------------------
612

mlblocks/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
__copyright__ = 'Copyright (c) 2018, MIT Data To AI Lab'
2121
__email__ = '[email protected]'
2222
__license__ = 'MIT'
23-
__version__ = '0.4.0'
23+
__version__ = '0.4.1.dev2'
2424

2525
__all__ = [
2626
'MLBlock',

mlblocks/mlblock.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,8 +111,15 @@ def _extract_params(self, kwargs, hyperparameters):
111111
if name in kwargs:
112112
init_params[name] = kwargs.pop(name)
113113

114-
fit_args = [arg['name'] for arg in self.fit_args]
115-
produce_args = [arg['name'] for arg in self.produce_args]
114+
if not isinstance(self.fit_args, str):
115+
fit_args = [arg['name'] for arg in self.fit_args]
116+
else:
117+
fit_args = []
118+
119+
if not isinstance(self.produce_args, str):
120+
produce_args = [arg['name'] for arg in self.produce_args]
121+
else:
122+
produce_args = []
116123

117124
for name in list(kwargs.keys()):
118125
if name in fit_args:
@@ -257,6 +264,8 @@ def _get_method_kwargs(self, kwargs, method_args):
257264
A dictionary containing the argument names and values to pass
258265
to the primitive method.
259266
"""
267+
if isinstance(method_args, str):
268+
method_args = getattr(self.instance, method_args)()
260269

261270
method_kwargs = dict()
262271
for arg in method_args:

mlblocks/mlpipeline.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,9 @@ def _get_block_variables(self, block_name, variables_attr, names):
177177
"""
178178
block = self.blocks[block_name]
179179
variables = deepcopy(getattr(block, variables_attr))
180+
if isinstance(variables, str):
181+
variables = getattr(block.instance, variables)()
182+
180183
variable_dict = {}
181184
for variable in variables:
182185
name = variable['name']
@@ -300,6 +303,12 @@ def get_inputs(self, fit=True):
300303

301304
return inputs
302305

306+
def get_fit_args(self):
307+
return list(self.get_inputs(fit=True).values())
308+
309+
def get_predict_args(self):
310+
return list(self.get_inputs(fit=False).values())
311+
303312
def get_outputs(self, outputs='default'):
304313
"""Get the list of output variables that correspond to the specified outputs.
305314
@@ -578,6 +587,10 @@ def _get_block_args(self, block_name, block_args, context):
578587

579588
input_names = self.input_names.get(block_name, dict())
580589

590+
if isinstance(block_args, str):
591+
block = self.blocks[block_name]
592+
block_args = getattr(block.instance, block_args)()
593+
581594
kwargs = dict()
582595
for arg in block_args:
583596
name = arg['name']
@@ -591,6 +604,9 @@ def _get_block_args(self, block_name, block_args, context):
591604
def _extract_outputs(self, block_name, outputs, block_outputs):
592605
"""Extract the outputs of the method as a dict to be set into the context."""
593606
# TODO: type validation and/or transformation should be done here
607+
if isinstance(block_outputs, str):
608+
block = self.blocks[block_name]
609+
block_outputs = getattr(block.instance, block_outputs)()
594610

595611
if not isinstance(outputs, tuple):
596612
outputs = (outputs, )

setup.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[bumpversion]
2-
current_version = 0.4.0
2+
current_version = 0.4.1.dev2
33
commit = True
44
tag = True
55
parse = (?P<major>\d+)\.(?P<minor>\d+)\.(?P<patch>\d+)(\.(?P<release>[a-z]+)(?P<candidate>\d+))?

setup.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
install_requires = [
1616
'graphviz>=0.9,<1',
17-
'numpy>=1.17.1,<1.19',
17+
'numpy>=1.17.1,<1.21',
1818
'psutil>=5,<6',
1919
]
2020

@@ -114,6 +114,6 @@
114114
test_suite='tests',
115115
tests_require=tests_require,
116116
url='https://github.com/MLBazaar/MLBlocks',
117-
version='0.4.0',
117+
version='0.4.1.dev2',
118118
zip_safe=False,
119119
)

0 commit comments

Comments
 (0)