Skip to content

About

A Simple library to convert a YAML file to old school pList format

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

3 Commits

Folders and files

Repository files navigation

yaml_to_openstep_plist

A Python library to convert YAML data to OpenStep plist format.

Installation

Install the library using pip:

pip install yaml_to_openstep_plist

Usage

The 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.

Example

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)

Input YAML Example

surveyLocalizationEnableMapping:
  todayAtApple: false
  thankYou: false
  account: true
  theme: dark
  age: 30
  score: 95.5
  data: null

Output Plist Example

surveyLocalizationEnableMapping = {
  todayAtApple = false;
  thankYou = false;
  account = true;
  theme = "dark";
  age = 30;
  score = 95.5;
  data = {};
};

Features

  • Quotes strings on the right side of = (e.g., theme = "dark";).
  • Leaves numbers unquoted (e.g., age = 30;).
  • Uses true/false for booleans.
  • Outputs {} for null values.
  • Single space after = and 1-space indentation.
  • Supports nested dictionaries and top-level key-value pair formatting.

Requirements

  • Python 3.6 or higher
  • PyYAML (>=5.1)

Publishing to PyPI

To publish this package to PyPI:

  1. Create a PyPI account at https://pypi.org.
  2. Install build and twine:
    pip install build twine
  3. Run the build script:
    python build.py --upload pypi
    Or for TestPyPI:
    python build.py --upload testpypi
  4. Follow prompts for PyPI credentials or use a ~/.pypirc file with an API token.

License

MIT

About

A Simple library to convert a YAML file to old school pList format

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages