diff --git a/converters/honeydew/README.md b/converters/honeydew/README.md index 644961c2..4419862b 100644 --- a/converters/honeydew/README.md +++ b/converters/honeydew/README.md @@ -17,9 +17,13 @@ under the License. --> -# Ossie ↔ Honeydew Converter +# Apache Ossie ↔ Honeydew Converter -Bidirectional converter between [Ossie](../../core-spec/spec.md) semantic models and [Honeydew](https://honeydew.ai/docs) workspace YAML. +Bidirectional converter between [Apache Ossie](../../core-spec/spec.md) semantic models +and [Honeydew](https://honeydew.ai/docs) [workspace YAML](https://honeydew.ai/docs/yaml-schema). + +Honeydew documents this integration from its own side under +[Apache Ossie (OSI)](https://honeydew.ai/docs/integration/apache-ossie-osi). ## Overview @@ -70,10 +74,10 @@ uv sync ```bash # Ossie YAML → Honeydew workspace directory -uv run honeydew-ossie ossie-to-honeydew -i input.yaml -o output_dir/ +uv run ossie-honeydew ossie-to-honeydew -i input.yaml -o output_dir/ # Honeydew workspace directory → Ossie YAML -uv run honeydew-ossie honeydew-to-ossie -i workspace_dir/ -o output.yaml +uv run ossie-honeydew honeydew-to-ossie -i workspace_dir/ -o output.yaml ``` ## Tests diff --git a/converters/honeydew/pyproject.toml b/converters/honeydew/pyproject.toml index 1a2584a1..7585ec76 100644 --- a/converters/honeydew/pyproject.toml +++ b/converters/honeydew/pyproject.toml @@ -26,9 +26,9 @@ dev = [ ] [project] -name = "honeydew-ossie" +name = "apache-ossie-honeydew" version = "0.2.0.dev0" -description = "Bidirectional converter between Honeydew workspace YAML and Ossie semantic model" +description = "Honeydew workspace YAML <> Apache Ossie converter" authors = [{ name = "Apache Software Foundation", email = "dev@ossie.apache.org" }] requires-python = ">=3.12" readme = "README.md" @@ -43,14 +43,14 @@ dependencies = [ ] [project.scripts] -honeydew-ossie = "honeydew_ossie.converter:main" +ossie-honeydew = "ossie_honeydew.converter:main" [project.urls] homepage = "https://ossie.apache.org/" repository = "https://github.com/apache/ossie/" [tool.hatch.build.targets.wheel] -packages = ["src/honeydew_ossie"] +packages = ["src/ossie_honeydew"] [tool.pytest.ini_options] testpaths = ["tests"] diff --git a/converters/honeydew/src/honeydew_ossie/__init__.py b/converters/honeydew/src/ossie_honeydew/__init__.py similarity index 97% rename from converters/honeydew/src/honeydew_ossie/__init__.py rename to converters/honeydew/src/ossie_honeydew/__init__.py index d216be4d..13a83393 100644 --- a/converters/honeydew/src/honeydew_ossie/__init__.py +++ b/converters/honeydew/src/ossie_honeydew/__init__.py @@ -13,4 +13,4 @@ # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY # KIND, either express or implied. See the License for the # specific language governing permissions and limitations -# under the License. \ No newline at end of file +# under the License. diff --git a/converters/honeydew/src/honeydew_ossie/converter.py b/converters/honeydew/src/ossie_honeydew/converter.py similarity index 98% rename from converters/honeydew/src/honeydew_ossie/converter.py rename to converters/honeydew/src/ossie_honeydew/converter.py index ee6c092d..33793e74 100644 --- a/converters/honeydew/src/honeydew_ossie/converter.py +++ b/converters/honeydew/src/ossie_honeydew/converter.py @@ -24,8 +24,8 @@ Honeydew → Ossie: Reads a Honeydew workspace directory and produces an Ossie YAML. Usage: - python converter.py ossie-to-honeydew -i input.yaml -o output_dir/ - python converter.py honeydew-to-ossie -i workspace_dir/ -o output.yaml + ossie-honeydew ossie-to-honeydew -i input.yaml -o output_dir/ + ossie-honeydew honeydew-to-ossie -i workspace_dir/ -o output.yaml """ import argparse @@ -41,6 +41,10 @@ SUPPORTED_OSSIE_VERSION = "0.2.0.dev0" HONEYDEW_VENDOR = "HONEYDEW" _OSSIE_METADATA_SECTION = "ossie" +# Workspaces written before the Ossie rebrand named the section "osi". Still +# read it, so exporting such a workspace does not silently drop the fields it +# preserves (ai_context, label, unique_keys, custom_extensions, vendors). +_LEGACY_OSSIE_METADATA_SECTION = "osi" _HD_ATTR_KEYS = ("display_name", "hidden", "folder", "format_string", "timegrain") @@ -955,7 +959,10 @@ def _build_ossie_metadata( def _read_ossie_metadata(obj: dict[str, Any]) -> dict[str, Any]: """Read Ossie-preserved fields from a Honeydew object's 'ossie' metadata section.""" for section in (obj.get("metadata") or []): - if (section.get("name") or "") != _OSSIE_METADATA_SECTION: + if (section.get("name") or "") not in ( + _OSSIE_METADATA_SECTION, + _LEGACY_OSSIE_METADATA_SECTION, + ): continue result: dict[str, Any] = {} for item in (section.get("metadata") or []): @@ -1065,4 +1072,4 @@ def main() -> None: if __name__ == "__main__": - main() \ No newline at end of file + main() diff --git a/converters/honeydew/tests/test_honeydew_ossie_converter.py b/converters/honeydew/tests/test_ossie_honeydew_converter.py similarity index 99% rename from converters/honeydew/tests/test_honeydew_ossie_converter.py rename to converters/honeydew/tests/test_ossie_honeydew_converter.py index 4f8a0a56..d83523b4 100644 --- a/converters/honeydew/tests/test_honeydew_ossie_converter.py +++ b/converters/honeydew/tests/test_ossie_honeydew_converter.py @@ -26,7 +26,7 @@ import pytest import yaml -from honeydew_ossie.converter import ( +from ossie_honeydew.converter import ( HoneydewConversionError, _assign_metrics_to_entities, _build_ossie_metadata, @@ -278,6 +278,19 @@ def test_read_ossie_metadata_no_ossie_section(): assert _read_ossie_metadata({"metadata": [{"name": "other", "metadata": []}]}) == {} +def test_read_legacy_osi_metadata_section(): + """Workspaces written before the rebrand named the section 'osi'; still read it.""" + section = _build_ossie_metadata( + ai_context={"synonyms": ["orders"]}, + unique_keys=[["col1"]], + custom_extensions=[{"vendor_name": "SNOWFLAKE", "data": "{}"}], + ) + legacy = {**section, "name": "osi"} + assert _read_ossie_metadata({"metadata": [legacy]}) == _read_ossie_metadata( + {"metadata": [section]} + ) + + def test_read_ossie_metadata_no_metadata(): assert _read_ossie_metadata({}) == {} @@ -1444,7 +1457,7 @@ def test_main_ossie_to_honeydew(tmp_path): })) output_dir = tmp_path / "out" result = subprocess.run( - [sys.executable, "-m", "honeydew_ossie.converter", + [sys.executable, "-m", "ossie_honeydew.converter", "ossie-to-honeydew", "-i", str(input_file), "-o", str(output_dir)], capture_output=True, text=True, ) @@ -1462,7 +1475,7 @@ def test_main_honeydew_to_ossie(tmp_path): }]) output_file = tmp_path / "output.yaml" result = subprocess.run( - [sys.executable, "-m", "honeydew_ossie.converter", + [sys.executable, "-m", "ossie_honeydew.converter", "honeydew-to-ossie", "-i", str(tmp_path), "-o", str(output_file)], capture_output=True, text=True, ) @@ -1487,7 +1500,7 @@ def test_main_path_traversal_rejected(tmp_path): ) output_dir = tmp_path / "out" result = subprocess.run( - [sys.executable, "-m", "honeydew_ossie.converter", + [sys.executable, "-m", "ossie_honeydew.converter", "ossie-to-honeydew", "-i", str(input_file), "-o", str(output_dir)], capture_output=True, text=True, ) diff --git a/converters/honeydew/uv.lock b/converters/honeydew/uv.lock index a71e79eb..19f70065 100644 --- a/converters/honeydew/uv.lock +++ b/converters/honeydew/uv.lock @@ -3,16 +3,7 @@ revision = 3 requires-python = ">=3.12" [[package]] -name = "colorama" -version = "0.4.6" -source = { registry = "https://pypi.org/simple" } -sdist = { url = "https://files.pythonhosted.org/packages/d8/53/6f443c9a4a8358a93a6792e2acffb9d9d5cb0a5cfd8802644b7b1c9a02e4/colorama-0.4.6.tar.gz", hash = "sha256:08695f5cb7ed6e0531a20572697297273c47b8cae5a63ffc6d6ed5c201be6e44", size = 27697, upload-time = "2022-10-25T02:36:22.414Z" } -wheels = [ - { url = "https://files.pythonhosted.org/packages/d1/d6/3965ed04c63042e047cb6a3e6ed1a63a35087b6a609aa3a15ed8ac56c221/colorama-0.4.6-py2.py3-none-any.whl", hash = "sha256:4f1d9991f5acc0ca119f9d443620b77f9d6b33703e51011c16baf57afb285fc6", size = 25335, upload-time = "2022-10-25T02:36:20.889Z" }, -] - -[[package]] -name = "honeydew-ossie" +name = "apache-ossie-honeydew" version = "0.2.0.dev0" source = { editable = "." } dependencies = [ @@ -30,6 +21,15 @@ requires-dist = [{ name = "pyyaml", specifier = ">=6.0" }] [package.metadata.requires-dev] dev = [{ name = "pytest", specifier = ">=8.0" }] +[[package]] +name = "colorama" +version = "0.4.6" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/d8/53/6f443c9a4a8358a93a6792e2acffb9d9d5cb0a5cfd8802644b7b1c9a02e4/colorama-0.4.6.tar.gz", hash = "sha256:08695f5cb7ed6e0531a20572697297273c47b8cae5a63ffc6d6ed5c201be6e44", size = 27697, upload-time = "2022-10-25T02:36:22.414Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/d1/d6/3965ed04c63042e047cb6a3e6ed1a63a35087b6a609aa3a15ed8ac56c221/colorama-0.4.6-py2.py3-none-any.whl", hash = "sha256:4f1d9991f5acc0ca119f9d443620b77f9d6b33703e51011c16baf57afb285fc6", size = 25335, upload-time = "2022-10-25T02:36:20.889Z" }, +] + [[package]] name = "iniconfig" version = "2.3.0"