Skip to content

Commit

Permalink
make release-tag: Merge branch 'master' into stable
Browse files Browse the repository at this point in the history
  • Loading branch information
sarahmish committed Oct 8, 2021
2 parents 04bb5fc + e8d353d commit ca666f5
Show file tree
Hide file tree
Showing 7 changed files with 146 additions and 39 deletions.
6 changes: 6 additions & 0 deletions HISTORY.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
Changelog
=========

0.4.1 - 2021-10-08
------------------

* Update NumPy dependency - [Issue #136](https://github.com/MLBazaar/MLBlocks/issues/136) by @sarahmish
* Support dynamic inputs and outputs - [Issue #134](https://github.com/MLBazaar/MLBlocks/issues/134) by @pvk-developer

0.4.0 - 2021-01-09
------------------

Expand Down
2 changes: 1 addition & 1 deletion mlblocks/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
__copyright__ = 'Copyright (c) 2018, MIT Data To AI Lab'
__email__ = 'dailabmit@gmail.com'
__license__ = 'MIT'
__version__ = '0.4.0'
__version__ = '0.4.1.dev2'

__all__ = [
'MLBlock',
Expand Down
13 changes: 11 additions & 2 deletions mlblocks/mlblock.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,15 @@ def _extract_params(self, kwargs, hyperparameters):
if name in kwargs:
init_params[name] = kwargs.pop(name)

fit_args = [arg['name'] for arg in self.fit_args]
produce_args = [arg['name'] for arg in self.produce_args]
if not isinstance(self.fit_args, str):
fit_args = [arg['name'] for arg in self.fit_args]
else:
fit_args = []

if not isinstance(self.produce_args, str):
produce_args = [arg['name'] for arg in self.produce_args]
else:
produce_args = []

for name in list(kwargs.keys()):
if name in fit_args:
Expand Down Expand Up @@ -257,6 +264,8 @@ def _get_method_kwargs(self, kwargs, method_args):
A dictionary containing the argument names and values to pass
to the primitive method.
"""
if isinstance(method_args, str):
method_args = getattr(self.instance, method_args)()

method_kwargs = dict()
for arg in method_args:
Expand Down
16 changes: 16 additions & 0 deletions mlblocks/mlpipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,9 @@ def _get_block_variables(self, block_name, variables_attr, names):
"""
block = self.blocks[block_name]
variables = deepcopy(getattr(block, variables_attr))
if isinstance(variables, str):
variables = getattr(block.instance, variables)()

variable_dict = {}
for variable in variables:
name = variable['name']
Expand Down Expand Up @@ -300,6 +303,12 @@ def get_inputs(self, fit=True):

return inputs

def get_fit_args(self):
return list(self.get_inputs(fit=True).values())

def get_predict_args(self):
return list(self.get_inputs(fit=False).values())

def get_outputs(self, outputs='default'):
"""Get the list of output variables that correspond to the specified outputs.
Expand Down Expand Up @@ -578,6 +587,10 @@ def _get_block_args(self, block_name, block_args, context):

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

if isinstance(block_args, str):
block = self.blocks[block_name]
block_args = getattr(block.instance, block_args)()

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

if not isinstance(outputs, tuple):
outputs = (outputs, )
Expand Down
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[bumpversion]
current_version = 0.4.0
current_version = 0.4.1.dev2
commit = True
tag = True
parse = (?P<major>\d+)\.(?P<minor>\d+)\.(?P<patch>\d+)(\.(?P<release>[a-z]+)(?P<candidate>\d+))?
Expand Down
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

install_requires = [
'graphviz>=0.9,<1',
'numpy>=1.17.1,<1.19',
'numpy>=1.17.1,<1.21',
'psutil>=5,<6',
]

Expand Down Expand Up @@ -114,6 +114,6 @@
test_suite='tests',
tests_require=tests_require,
url='https://github.com/MLBazaar/MLBlocks',
version='0.4.0',
version='0.4.1.dev2',
zip_safe=False,
)
Loading

0 comments on commit ca666f5

Please sign in to comment.