Skip to main content

Overview

Scibble is a mechanism to store dictionary information to a persistent state. This allows the data to be easily retrieved and edited, making it a good option when trying to store settings data.

Note: Data saved within the ScribbleDictionary must be json serialisable.

An example of creating a persisten data block would be:

    import os
    import scribble
    
    
    # -- Instance a scribble dictionary. We can treat this exactly
    # -- as we treat a dictionary
    data = scribble.get('foobar')
    
    # -- Set some key/value pairs in the ScribbleDictionary
    data['option_a'] = True
    data['option_b'] = 123
    
    # -- Calling .save() will trigger the dictionary
    # -- to store its current state to a persistent state
    data.save()
    
    # -- We can see the location the data is saved to, and we can
    # -- see that it does indeed exist
    print(data.location())
    print(os.path.exists(data.location()))    

Equally, we can re-retrieve that data in a completely new instance of python using the following code:

    # -- Instance a scribble dictionary with the same identifier
    data = scribble.get('foobar')
    
    # -- Print the fact that we have retrieved the same 
    # -- infromation
    print(data)
    # {'option_a': True, 'option_b': 123}
    
    # -- We can then further edit the data
    data['option_a'] = False
    
    # -- Calling .save() will trigger the dictionary
    # -- to store its current state to a persistent state
    data.save()

By default scribble will store its data in the follow platform specific locations:

  • Windows: %APPDATA%/pyscribble

  • Linux: %XDG_CONFIG_HOME%/pyscribble if the environment variable exists, otherwise %HOME%/.config/pyscribble

  • OSX: ËœHOME/Documents/pyscribble

However, you can override these paths by setting an environment variable PYSCRIBBLE_STORAGE_DIR, if this is set then the path defined by that variable will always be used over the default behaviour.

Compatability

This has been tested under Python 2.7.13 and Python 3.6.6 on both Ubuntu and Windows.

Contribute

If you would like to contribute thoughts, ideas, fixes or features please get in touch! mike@twisted.space

Metadata

Release files for scribble 1.0.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 scribble 1.0.0
File Size Uploaded
scribble-1.0.0.tar.gz 3.6 kB Details

Release files / scribble-1.0.0.tar.gz

Download URL scribble-1.0.0.tar.gz
Size 3.6 kB
Tags Source
SHA-256 checksum
How to use checksums
b49890a81b48cf489a93c77a7c34eeeeab58cc138c1e32f42db60772a85ee80a
BLAKE2b-256 checksum
How to use checksums
9aa3af722f355a285888d12cf4f5647f18fe6c7375fd974de6f0a3e605ad7c3f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.12.1 pkginfo/1.4.2 requests/2.20.1 setuptools/40.6.2 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.6.2

Release history Release notifications | RSS feed

This release

1.0.0 This release

1 release file

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