compile and platform xml to yaml converters #878
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #878 +/- ##
==========================================
+ Coverage 84.35% 85.04% +0.69%
==========================================
Files 71 73 +2
Lines 4997 5337 +340
==========================================
+ Hits 4215 4539 +324
- Misses 782 798 +16
Flags with carried forward coverage won't be shown. Click here to find out more.
... and 1 file with indirect coverage changes Continue to review full report in Codecov by Sentry.
🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Adds a new XML→YAML “compile” converter and accompanying pytest coverage, plus updates project dependencies.
Changes:
- Added
compile-converter.pyto parse compile XML into a YAML-friendly structure. - Added a large pytest suite covering component/experiment parsing and file conversion behavior.
- Added
beautifulsoup4topyproject.tomldependencies.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 8 comments.
| File | Description |
|---|---|
| pyproject.toml | Adds a new Python dependency (beautifulsoup4). |
| fre/yamltools/converters/compile-converter.py | Introduces XML parsing + YAML output conversion CLI/script. |
| fre/yamltools/converters/test.py | Adds pytest coverage for the converter behavior. |
| fre/yamltools/converters/init.py | Marks package directory (empty init). |
| if experiment_name: | ||
| break | ||
| with open(yaml_path, 'w', encoding='utf-8') as f: | ||
| yaml.dump(yamldict, f, sort_keys=False) |
|
|
||
| import xml.etree.ElementTree as ET | ||
| import argparse | ||
| import yaml | ||
|
|
||
| def parse_component(component: ET.Element) -> dict[str, any]: |
| import importlib.util | ||
|
|
||
| # Import functions from compile-converter (hyphenated module name) | ||
| spec = importlib.util.spec_from_file_location("compile_converter", "compile-converter.py") |
|
|
||
| import xml.etree.ElementTree as ET | ||
| import argparse | ||
| import yaml | ||
|
|
||
| def parse_component(component: ET.Element) -> dict[str, any]: |
| # Remove None values | ||
| return {k: v for k, v in d.items() if v is not None} | ||
|
|
||
| def parse_experiment(experiment: ET.Element) -> Dict[str, Any]: |
| if compile_elem is not None: | ||
| elem = compile_elem.find(flag) | ||
| if elem is not None and elem.text: | ||
| return elem.text.strip() |
| import importlib.util | ||
|
|
||
| # Import functions from compile-converter (hyphenated module name) | ||
| spec = importlib.util.spec_from_file_location("compile_converter", "compile-converter.py") | ||
| compile_converter = importlib.util.module_from_spec(spec) | ||
| spec.loader.exec_module(compile_converter) | ||
|
|
||
| parse_component = compile_converter.parse_component | ||
| parse_experiment = compile_converter.parse_experiment | ||
| xml_to_yaml = compile_converter.xml_to_yaml | ||
|
|
||
|
|
| 'src': components if components else [], | ||
| } | ||
|
|
||
| def xml_to_yaml(xml_path: str, yaml_path: str, experiment_name: str = None): |
There was a problem hiding this comment.
@copilot Can you add a test in test_converter.py that tests an xml with multiple ?
Describe your changes
This PR
yamltools/converters/compile/convert.pyandtest.pyscripts to convert compile xmls to almost-perfect-and-ready-to-use compile yamls.Create brand new platform.yaml
Issue ticket number and link (if applicable)
Fixes #858
Checklist before requesting a review
Note: If you are a code maintainer updating the tag or releasing a new fre-cli version, please use the
release_procedure.mdtemplate. To quickly use this template, open a new pull request, choose your branch, and add?template=release_procedure.mdto the end of the url.