openstep-plist

raw JSON →
0.5.2 verified Fri May 01 auth: no python

A fast ASCII plist parser written in Cython, used primarily for parsing Glyphs.app and other Apple-style ASCII property list files. Current version 0.5.2, supports Python >=3.8, released on a maintenance cadence.

pip install openstep-plist
error ModuleNotFoundError: No module named 'openstep_plist'
cause The package is installed as `openstep-plist` (with hyphen) but imported as `openstep_plist` (underscore).
fix
Install with pip install openstep-plist, then import as from openstep_plist import ....
error AttributeError: module 'openstep_plist' has no attribute 'loads'
cause Older versions (e.g., 0.2.x) did not expose `loads` at the top level; or the import is wrong.
fix
Upgrade to latest version (pip install -U openstep-plist) or use from openstep_plist import loads.
error ValueError: Unsupported plist format
cause Attempting to parse XML or binary plist data with openstep-plist, which only handles ASCII plist format.
fix
Use Python's built-in plistlib for XML or binary plists.
breaking In v0.5.0, the default behavior for dumping single-line tuples changed: no space after comma. If you rely on the old format, set `single_line_empty_objects=True`.
fix Use `dumps(data, single_line_empty_objects=True)` to preserve old spacing.
breaking In v0.2.1, the default value of `use_numbers` in the parser was reverted to False. Strings that look like numbers (e.g., '123') are now kept as strings by default.
fix If you need automatic conversion to int/float, pass `use_numbers=True` to `load()` or `loads()`.
deprecated `pkg_resources` usage was replaced by `importlib.metadata` in v0.5.2. If you were depending on `pkg_resources` internals, update your code.
fix Use `importlib.metadata.version('openstep-plist')` instead of `pkg_resources.get_distribution('openstep-plist').version`.
gotcha The library only supports ASCII property list format, not XML or binary plists. Loading an XML plist will fail or produce unexpected results.
fix Use `plistlib` for XML/binary plists; use `openstep-plist` only for ASCII plist format (e.g., Glyphs files).

Parse and dump ASCII plist strings.

from openstep_plist import load, dumps

# Parse an ASCII plist string
plist_string = """{
    name = Example;
    version = 1;
}"""
data = load(plist_string)
print(data)  # {'name': 'Example', 'version': 1}

# Dump back to ASCII plist
output = dumps(data)
print(output)