Skip to content

Commit

Permalink
Merge branch 'main' into notebook_tests
Browse files Browse the repository at this point in the history
  • Loading branch information
shania-m authored Feb 7, 2024
2 parents b0ff7bd + c5c7cc1 commit ab234b0
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 9 deletions.
2 changes: 1 addition & 1 deletion docs/docs-environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ dependencies:

# install rubicon-ml dependencies
# so local pip install doesn't
- dash<=2.14.2,>=2.11.0
- dash<=2.15.0,>=2.11.0
- dash-bootstrap-components<=1.5.0,>=1.0.0
- fsspec<=2023.12.2,>=2021.4.0
- intake[dataframe]<=0.7.0,>=0.5.2
Expand Down
2 changes: 1 addition & 1 deletion environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ dependencies:
- s3fs<=2023.12.2,>=0.4

# for viz extras
- dash<=2.14.2,>=2.11.0
- dash<=2.15.0,>=2.11.0
- dash-bootstrap-components<=1.5.0,>=1.0.0

# for testing
Expand Down
6 changes: 5 additions & 1 deletion rubicon_ml/schema/logger.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,11 @@ def _safe_call_func(obj, func, optional, default=None):
@contextmanager
def _set_temporary_schema(project, schema_name):
original_schema = project.schema_
project.set_schema(registry.get_schema(schema_name))

if schema_name == "infer":
delattr(project, "schema_")
else:
project.set_schema(registry.get_schema(schema_name))

yield

Expand Down
6 changes: 3 additions & 3 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,13 @@ prefect =
s3 =
s3fs<=2023.12.2,>=0.4
ui =
dash<=2.14.2,>=2.11.0
dash<=2.15.0,>=2.11.0
dash-bootstrap-components<=1.5.0,>=1.0.0
viz =
dash<=2.14.2,>=2.11.0
dash<=2.15.0,>=2.11.0
dash-bootstrap-components<=1.5.0,>=1.0.0
all =
dash<=2.14.2,>=2.11.0
dash<=2.15.0,>=2.11.0
dash-bootstrap-components<=1.5.0,>=1.0.0
prefect<=1.2.4,>=0.12.0
s3fs<=2023.12.2,>=0.4
Expand Down
2 changes: 1 addition & 1 deletion tests/fixtures.py
Original file line number Diff line number Diff line change
Expand Up @@ -382,7 +382,7 @@ def parameter_schema():
def nested_schema():
"""Returns a schema for testing nested schema."""

return {"schema": [{"name": "AnotherObject", "attr": "object_"}]}
return {"schema": [{"name": "tests___AnotherObject", "attr": "object_"}]}


@pytest.fixture
Expand Down
10 changes: 8 additions & 2 deletions tests/unit/schema/test_schema_logger.py
Original file line number Diff line number Diff line change
Expand Up @@ -212,11 +212,17 @@ def test_log_parameters_with_schema(objects_to_log, rubicon_project, parameter_s
assert parameter_b.value == "param env value"


def test_log_nested_schema(objects_to_log, rubicon_project, another_object_schema, nested_schema):
@pytest.mark.parametrize("infer", [True, False])
def test_log_nested_schema(
objects_to_log, rubicon_project, another_object_schema, nested_schema, infer
):
"""Testing ``Project.log_with_schema`` can log nested schema."""

if infer:
nested_schema["schema"][0]["name"] = "infer"

object_to_log, another_object = objects_to_log
schema_to_patch = {"AnotherObject": lambda: another_object_schema}
schema_to_patch = {"tests___AnotherObject": lambda: another_object_schema}

with mock.patch.dict(RUBICON_SCHEMA_REGISTRY, schema_to_patch, clear=True):
rubicon_project.set_schema(nested_schema)
Expand Down

0 comments on commit ab234b0

Please sign in to comment.