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.1.0.tar.gz (5.1 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.1.0-py3-none-any.whl (4.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: yaml_to_openstep_plist-0.1.0.tar.gz
  • Upload date:
  • Size: 5.1 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.1.0.tar.gz
Algorithm Hash digest
SHA256 b46c7fcea19939a18de1edbfa2ef97075f7dcd5da97f197b0a02c5283c78f5b0
MD5 c2d373ea4c45cb05c151d4ff6ed6f4e0
BLAKE2b-256 2d886014b55aab725adfb6bbf14e3f8c27d31263cbb02e9a936cf0225bad3dac

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for yaml_to_openstep_plist-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 0db06b29f7e02311610fbce1f5e3557c53ddfbf8604b56dc5c7c7dbbb7ff8a38
MD5 066203d61ec8e34505e11a6a26824b32
BLAKE2b-256 8a63e4ffd969279072c6dad1132bfe92e5428c58042860c27c19c165c077f673

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