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-100.tar.gz (15.4 kB view details)

Uploaded Source

File details

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

File metadata

  • Download URL: olib-100.tar.gz
  • Upload date:
  • Size: 15.4 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-100.tar.gz
Algorithm Hash digest
SHA256 d341a4c4d60078ba6a498f9de169f2d5b109b214d55f314df80dcebadce5aaaa
MD5 6a5b2cf4b3626b7165f301e25d0f2d8d
BLAKE2b-256 21f51a88e50eda74628eefb62dba0eb7479de031d7b06e0f140372431a4f90f3

See more details on using hashes here.

Supported by

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