A Python library to convert YAML data to OpenStep plist format.
Install the library using pip:
pip install yaml_to_openstep_plistThe library provides two main functions:
to_plist(yaml_data): Convert a Python object (parsed from YAML) to an OpenStep plist string.to_plist_file(yaml_file_path, plist_file_path): Convert a YAML file to an OpenStep plist file.
import yaml_to_openstep_plist
# Convert YAML file to OpenStep plist file
yaml_to_openstep_plist.to_plist_file("input.yaml", "output.plist")
# Convert YAML data to OpenStep plist string
yaml_data = {
"surveyLocalizationEnableMapping": {
"todayAtApple": False,
"thankYou": False,
"account": True,
"theme": "dark",
"age": 30,
"score": 95.5,
"data": None
}
}
plist_string = yaml_to_openstep_plist.to_plist(yaml_data)
print(plist_string)surveyLocalizationEnableMapping:
todayAtApple: false
thankYou: false
account: true
theme: dark
age: 30
score: 95.5
data: nullsurveyLocalizationEnableMapping = {
todayAtApple = false;
thankYou = false;
account = true;
theme = "dark";
age = 30;
score = 95.5;
data = {};
};
- Quotes strings on the right side of
=(e.g.,theme = "dark";). - Leaves numbers unquoted (e.g.,
age = 30;). - Uses
true/falsefor booleans. - Outputs
{}fornullvalues. - Single space after
=and 1-space indentation. - Supports nested dictionaries and top-level key-value pair formatting.
- Python 3.6 or higher
- PyYAML (>=5.1)
To publish this package to PyPI:
- Create a PyPI account at https://pypi.org.
- Install
buildandtwine:pip install build twine
- Run the build script:
Or for TestPyPI:
python build.py --upload pypi
python build.py --upload testpypi
- Follow prompts for PyPI credentials or use a
~/.pypircfile with an API token.
MIT