Skip to main content
===========
gblackboard
===========


.. image:: https://img.shields.io/pypi/v/gblackboard.svg
:target: https://pypi.python.org/pypi/gblackboard

.. image:: https://img.shields.io/travis/GTedHa/gblackboard.svg
:target: https://travis-ci.org/GTedHa/gblackboard

.. image:: https://readthedocs.org/projects/gblackboard/badge/?version=latest
:target: https://gblackboard.readthedocs.io/en/latest/?badge=latest
:alt: Documentation Status




Blackboard pattern implementation


* Free software: MIT license
* Documentation: https://gblackboard.readthedocs.io.
* Repository: https://github.com/GTedHa/gblackboard


Features
-------

* To be updated
* Refer to 'Usage'


Usage
-------

To use gblackboard in a project:

- basic usage::

.. code-block:: python

from gblackboard import Blackboard
from gblackboard import SupportedMemoryType

blackboard = Blackboard(SupportedMemoryType.DICTIONARY)
# Set a key-value data;
# `set` method should be called only once for a key.
# It's a kind of initialization for data.
blackboard.set('key', 'value')
# Retrieve data with key.
value = blackboard.get('key')
# Update data with new value;
# `update` method should be called
# after `set` method called for a key.
blackboard.update('key', 'new_value')
# Delete data from blackboard with key.
blackboard.drop('key')
# Clear all data in blackboard.
blackboard.clear()


- observer::

.. code-block:: python

from gblackboard import Blackboard
from gblackboard import SupportedMemoryType

def callback(data):
print(data)

blackboard = Blackboard(SupportedMemoryType.DICTIONARY)
blackboard.set('key', 'value')
# Register `callback` function as a callback.
blackboard.register_callback('key', callback)
# Update data;
# `callback` function will be called during `update`,
# and `new_value` will passed to `callback` function.
blackboard.update('key', 'new_value')


- complex data::

.. code-block:: python

from gblackboard import Blackboard
from gblackboard import SupportedMemoryType

import datetime as dt

class User(object):

def __init__(self, name, email):
self.name = name
self.email = email
self.created_at = dt.datetime.now()

def __repr__(self):
return '<User(name={self.name!r})>'.format(self=self)

blackboard = Blackboard(SupportedMemoryType.DICTIONARY)

# You can also store customized class objects in blackboard.
blackboard.set('user', User("G.Ted", "gted221@gmail.com"))
user = blackboard.get('user')
print(user)
# <User(name='G.Ted')> will be printed.

# List of complex objects is also supported.
blackboard.set('users',
[
User("User1", "user1@gblackboard.com"),
User("User2", "user2@gblackboard.com"),
]
)
users = blackboard.get('users')
print(users)
# [<User(name='User1')>, <User(name='User2')>] will be printed.


- save & load::

.. code-block:: python

from gblackboard import Blackboard
from gblackboard import SupportedMemoryType

import datetime as dt

class User(object):

def __init__(self, name, email):
self.name = name
self.email = email
self.created_at = dt.datetime.now()

def __repr__(self):
return '<User(name={self.name!r})>'.format(self=self)

blackboard = Blackboard(SupportedMemoryType.DICTIONARY)
# Store sample data
blackboard.set('user', User("G.Ted", "gted221@gmail.com"))
# Save current blackboard contents as file.
blackboard.save()
# Close current blackboard;
# this means clear all data in blackboard
blackboard.close()
# ------------------------------------------------------------
blackboard = Blackboard(SupportedMemoryType.DICTIONARY)
# Load saved blackboard contents from files.
blackboard.load()
user = blackboard.get('user')
print(user)
# <User(name='G.Ted')> will be printed.


TODO
-------

* `Save & Load` on subprocess
* Validation for Redis configurations
* Print blackboard contents for debugging


Credits
-------

This package was created with Cookiecutter_ and the `audreyr/cookiecutter-pypackage`_ project template.

.. _Cookiecutter: https://github.com/audreyr/cookiecutter
.. _`audreyr/cookiecutter-pypackage`: https://github.com/audreyr/cookiecutter-pypackage


=======
History
=======

0.1.0 (2019-01-24)
------------------

* First commit on GitHub.


0.1.1 (2019-01-30)
------------------

* Add fakeredis for test


0.2.0 (2019-02-16)
------------------

* Eliminates the limitations of supported data types.
* Change object serialization method for storing data from JSON serialization method using marshmallow (external)
library to serialization method using pickle library.
* Replace CRUD methods of redis with Hash-CRUD methods
- set(key, value) -> hset('gblackboard', key, value)
- get(key) -> hget('gblackboard', key)
- delete(key) -> hdel('gblackboard', key)
- exists(key) -> hexists('gblackboard', key)
* Remove useless setup() step and mem_ready status
* Add raise_conn_error (raise 'connection error') decorator for RedisWrapper CRUD methods
* Add save & load features



Metadata

Release files for gblackboard 0.2.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for gblackboard 0.2.2
File Size Uploaded
gblackboard-0.2.2.tar.gz 17.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for gblackboard 0.2.2
File Interpreter ABI Platform
gblackboard-0.2.2-py2.py3-none-any.whl Python 2, Python 3 none any Details

Total release size: 28.0 kB

Release files / gblackboard-0.2.2.tar.gz

Download URL gblackboard-0.2.2.tar.gz
Size 17.7 kB
Tags Source
SHA-256 checksum
How to use checksums
16d1d7006c6126c18d1457d3bc6d475b3058f8522bf0d5b618c834ce7b23d9a2
BLAKE2b-256 checksum
How to use checksums
ec09ffb3a1ebfe02f2f8219f34b6f8b93fd9014b8fc62453741e7673d6a13b5b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.6.3

Release files / gblackboard-0.2.2-py2.py3-none-any.whl

Download URL gblackboard-0.2.2-py2.py3-none-any.whl
Size 10.3 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
359e86fc010fe528602169b7b96ca3234fab706602a12ae801cb60ce0eef61db
BLAKE2b-256 checksum
How to use checksums
b2716f16bcbf3c948f9c2ecc29eb8443920a8231c3aa69ee0201c2512424f499
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.6.3

Release history Release notifications | RSS feed

This release

0.2.2 This release

2 release files

0.2.0

2 release files

0.1.1

2 release files

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