Skip to main content

python3 object library

Project description

Welcome to OLIB, an object library.

OLIB is an object library you can use to program with objects, uses a JSON in file database with a versioned readonly storage and reconstructs objects based on type information in the path.

OLIB is placed in the Public Domain and has no COPYRIGHT and no LICENSE.

INSTALL

OLIB can be found on pypi, see http://pypi.org/project/olib

installation is through pypi:

$ sudo pip3 install olib --upgrade --force-reinstall

PROGRAMMING

OLIB provides a library you can use to program objects under python3. It provides a basic Object, that mimics a dict while using attribute access and provides a save/load to/from json files on disk. Objects can be searched with a little database module, provides read-only files to improve persistence and use a type in filename reconstruction.

basic usage is this:

>>> from obj import Object
>>> o = Object()
>>> o.key = "value"
>>> o.key
'value'
>>> o
{"key": "value"}

objects can be saved and loaded to JSON files:

>>> from obj import Object, cfg
>>> cfg.wd = "data"
>>> o = Object()
>>> o.key = "value"
>>> path = o.save()
>>> path
'obj.Object/4b58abe2-3757-48d4-986b-d0857208dd96/2021-04-12/21:15:33.734994
>>> oo = Object().load(path)
>>> oo.key
'value'

an Object tries to mimic a dictionary while trying to be an object with normal attribute access as well. Hidden methods are provided as are the basic methods like get, items, keys, register, set, update, values.

great for giving objects peristence by having their state stored in files.

CONTACT

have fun coding

Bart Thate (bthate67@gmail.com)
botfather on #dunkbots irc.freenode.net

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

olib-102.tar.gz (16.0 kB view details)

Uploaded Source

File details

Details for the file olib-102.tar.gz.

File metadata

  • Download URL: olib-102.tar.gz
  • Upload date:
  • Size: 16.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.4.2 requests/2.25.1 setuptools/52.0.0 requests-toolbelt/0.9.1 tqdm/4.57.0 CPython/3.9.4

File hashes

Hashes for olib-102.tar.gz
Algorithm Hash digest
SHA256 71ce85fa648cb4e24989d80402c62d94133a1672d5f09e2aaccf988a08339c97
MD5 841dc6eadb03e3bd8cb4418fdec9f64e
BLAKE2b-256 1d41490f40badde292c7aef298ccdc025f29346b369556574f6bc76311500312

See more details on using hashes here.

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