Skip to main content

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

Project description

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_yaml_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_yaml_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)

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

yaml_to_openstep_plist-0.2.0.tar.gz (5.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

yaml_to_openstep_plist-0.2.0-py3-none-any.whl (4.2 kB view details)

Uploaded Python 3

File details

Details for the file yaml_to_openstep_plist-0.2.0.tar.gz.

File metadata

  • Download URL: yaml_to_openstep_plist-0.2.0.tar.gz
  • Upload date:
  • Size: 5.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.8

File hashes

Hashes for yaml_to_openstep_plist-0.2.0.tar.gz
Algorithm Hash digest
SHA256 7b9c83916c10c7050d065d958a3c047a3ba704452d027d5979def452a83f9c52
MD5 79d9eb0feb3385b52f5d2356a56b5a86
BLAKE2b-256 e3cb8c44160d0941123abd3e93706a7514346cacaaa3b031d4cfa2e79dd9dcf6

See more details on using hashes here.

File details

Details for the file yaml_to_openstep_plist-0.2.0-py3-none-any.whl.

File metadata

File hashes

Hashes for yaml_to_openstep_plist-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d0ff6948537e7334022cae57b37e57135d10d4d3c4c2b4f8ba23747eff833924
MD5 b5df219c0cd925184fce2057328ccc43
BLAKE2b-256 6e3001e29a5eb826b808c99480b962b5a9fe0a5fe2d5258149c2c4becba8137d

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page