Skip to main content

text-plistlib

A library that parses text plists from OpenStep and GNUstep as well as .strings files. Has a plistlib-style API.

Uses a Packrat parser from tatsu, because I am too lazy to manually write a recursive descent thing.

Format

Text plists are Property lists written in a human-readable, textual form. They roamed the Earth in the times of OpenStep, and is generally better for humans than the new XML format. This form, NSPropertyListOpenStepFormat, only supports strings, hexdata, arrays, and dictionaries.

The GNUstep project created an extension based on the old ASCII format called NSPropertyListGNUstepFormat. This format adds support for integers, floats, and dates, making it as expressive as the XML and binary formats.

The format of textual plists are quite easy to grasp:

{
    /* Strings can be unquoted, or quoted for C-style escapes */
    "loremIpsum" = "A story about the good, \n the bad \u0000, and the ugly\x2E";
    foo = bar;
    hexdata = <deadbeef>;
    int = <*I3>;
    date = <*D2006-01-02 15:04:05 -0700>;

    // collection objects
    array = (1, 2, 3);
    object = {
        a = (1, 2, 3);
        d = ();
        e = {};
        f = <>;
    };
}

.strings files

.strings files are similar to OpenStep plist dictionaries, except that the braces are omitted. By convention all values are strings, and the = value part can be omitted for a null or empty value.

Extensions

This library accepts the following extensions to textual plists:

  • Custom encoding: historically, plists may be written in a wide variety of encodings. We default to UTF-8, but this is configurable.
  • Trailing commas for arrays: everyone loves trailing commas. Seems to be in GNUstep and Apple.
  • Values in collections are nullable. This means that all dictionaries can use the .strings extension of key; and null elements of arrays can be denoted by commas. In Python they translate to None.
    • On a second thought, it does make more sense to use something like <*N> instead of the JavaScript-like handling of array gaps.
  • UID. Unsigned values of the plistlib.UID classes are serialized in the dialect as <*U12345>. In other dialects, they are encoded as { "CF$UID" = <*I12345> }.
  • The top level of dictionary is assumed as in .strings files, no matter how complex the inner data structures are. This makes for better config files.

The generation of these extension elements can be turned off by a dialect control.

License

MIT/Expat license or Python Software Foundation License.

See also

Useful commands

  • python3 -m text_plistlib.impl ./tests/oneval.plist

Metadata

Release files for text-plistlib 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for text-plistlib 0.1.0
File Size Uploaded Provenance Actions
text_plistlib-0.1.0.tar.gz 14.4 kB Without provenance Details for text_plistlib-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for text-plistlib 0.1.0
File Interpreter ABI Platform Actions
text_plistlib-0.1.0-py3-none-any.whl Python 3 none any Details for text_plistlib-0.1.0-py3-none-any.whl

Total release size: 26.4 kB

Release files / text_plistlib-0.1.0.tar.gz

Download URL text_plistlib-0.1.0.tar.gz
Size 14.4 kB
Tags Source
SHA-256 checksum
How to use checksums
a5ac251516e9bf6996aa7740da59811432405cef4587b9cfc7fe2e742c512d31
BLAKE2b-256 checksum
How to use checksums
32d7303004224af8c9c6bf0dd6b3951c0c9f9705660e19d61b896e7d2beec71b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.10

Release files / text_plistlib-0.1.0-py3-none-any.whl

Download URL text_plistlib-0.1.0-py3-none-any.whl
Size 12.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
425e075ed2652d644b4ace5ec328c0a851e49d2d28c0f4dfadfdbfbbd77576c0
BLAKE2b-256 checksum
How to use checksums
8c05e0412acf212175a1209e34f7936af4eca3141b80ca853b137cc2db817f87
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.10

Security for text-plistlib 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page