Skip to main content

Generate and parse NSKeyedArchive files

Project description

keyedarchivelib

Basic Python (>=3.6) library to generate and parse NSKeyedArchive files.

Installation

Install with pip:

pip3 install keyedarchivelib

Usage

The keyedarchivelib module has the same interface as the plistlib standard library module:

load, loads, dump, and dumps have the same function signatures as plistlib minus the fmt option, which is not available since it's always binary.

The keyedarchivelib module includes type hints.

For convenience, examples are provided below:

Reading (load & loads)

from keyedarchivelib import load

with open("example.plist", 'rb') as fp:
    pl = load(fp)
print(pl["test"])

Writing (dump & dumps)

from keyedarchivelib import dump, dumps

example_dict = {
    "test": 1
}
with open("example.plist", 'wb') as fp:
    dump(example_dict, fp)

# ~~~ OR ~~~

print(dumps(example_dict))

Note on compatibility

For versions below 3.8, plistlib doesn't support all the plist features used by NSKeyedArchiver. A compatibility hot-patching layer is used to support these lesser versions of Python. This library has not endured thorough testing beyond the latest versions of Python 3.6, 3.7, and 3.8. Please open issues for any observed problems!

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

keyedarchivelib-1.0.2.tar.gz (4.8 kB view hashes)

Uploaded Source

Built Distribution

keyedarchivelib-1.0.2-py3-none-any.whl (7.6 kB view hashes)

Uploaded Python 3

Supported by

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