userdefaults3
Python 3 rewrite of userdefaults, a pure-Python interface to NSUserDefaults.
The singular 'UserDefaults' class provides the main interface, which should be used as a regular dictionary. Python types are converted to their Obj-C equivlents on writing to UserDefaults.
Usage
>>> with UserDefaults() as ud:
>>> ud["key"] = value
>>>
Or, for more flexible access to the UserDefaults class:
>>> ud = UserDefaults()
>>> ud["key"] = value
>>> ... # other operations here
>>> ud.sync() # write back to plist file, does nothing on Obj-C backend
On supported platforms that have a Obj-C backend, the UserDefaults class acts as a shim for NSUserDefaults. Otherwise, a naive file handle is used to modify UserDefaults using plistlib.
Supported backends:
- pyobjc (MacOS)
- rubicon-objc (Darwin/Pyto)
- objc_util (Pythonista)
If your platform does not have a Obj-C backend (unless you are on Libterm/a-Shell), you problably should not use this as directly writing to the plist file itself is discouraged (as quoted from Apple's docstring):
Don’t try to access the preferences subsystem directly. Modifying preference property list files may result in loss of changes, delay of reflecting changes, and app crashes.
The naive file method is kept to support platforms which do not have/cannot install a Obj-C backend (i.e Libterm, a-Shell).
Known bugs:
- On Pyto, writing to the inputHistory key using the Obj-C backend results in a
SIGKILL(crashes).
Building
Use flit to build/install:
$ flit build
Metadata
Release files for userdefaults3 1.1.8
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| userdefaults3-1.1.8.tar.gz | 6.1 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| userdefaults3-1.1.8-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 11.6 kB
Release files / userdefaults3-1.1.8.tar.gz
| Download URL | userdefaults3-1.1.8.tar.gz |
|---|---|
| Size | 6.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b7709384f0cad58758d5d8d9382a0206b2767cd7256c385fb9919cc83f133bb7
|
|
BLAKE2b-256 checksum How to use checksums |
ad80956b680febc6a75241e633cb2bfe01f7d6859ea3545a97bbc6ff185a3e98
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
python-requests/2.25.1
|
Release files / userdefaults3-1.1.8-py3-none-any.whl
| Download URL | userdefaults3-1.1.8-py3-none-any.whl |
|---|---|
| Size | 5.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
32eb2321b6e1bd751939facfa5155467b6e72ce41d30d0ebcf391ce513d3584a
|
|
BLAKE2b-256 checksum How to use checksums |
81db47bb0e0310a728b9509bf632f350377dc3928390d019e270d01bfa8fcb0b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
python-requests/2.25.1
|
Security for userdefaults3 1.1.8
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.