Metadata-Version: 2.1
Name: openleveldb
Version: 0.1.2
Summary: 
Home-page: https://github.com/lucmos/openleveldb
License: MIT
Keywords: leveldb,multiprocessing
Author: Luca Moschella
Author-email: luca.moschella94@gmail.com
Requires-Python: >=3.7.5,<4.0.0
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.8
Requires-Dist: autodoc (>=0.5.0,<0.6.0)
Requires-Dist: coverage (>=5.0.3,<6.0.0)
Requires-Dist: flask (>=1.1.1,<2.0.0)
Requires-Dist: mock (>=3.0.5,<4.0.0)
Requires-Dist: numpy (>=1.18.1,<2.0.0)
Requires-Dist: orjson (>=2.1.4,<3.0.0)
Requires-Dist: plyvel (>=1.1.0,<2.0.0)
Requires-Dist: pytest (>=5.3.2,<6.0.0)
Requires-Dist: python-dotenv (>=0.10.3,<0.11.0)
Requires-Dist: requests (>=2.22.0,<3.0.0)
Requires-Dist: sphinx (>=2.3.1,<3.0.0)
Requires-Dist: sphinx-autobuild (>=0.7.1,<0.8.0)
Requires-Dist: sphinx-autodoc-typehints (>=1.10.3,<2.0.0)
Requires-Dist: sphinx_rtd_theme (>=0.4.3,<0.5.0)
Requires-Dist: tqdm (>=4.41.1,<5.0.0)
Project-URL: Documentation, https://openleveldb.readthedocs.io/en/latest/index.html#
Project-URL: Repository, https://github.com/lucmos/openleveldb
Description-Content-Type: text/x-rst

============================
A pythonic leveldb wrapper
============================
|pypi| |docs| |license| |black|

.. inclusion-marker-do-not-remove


`Openleveldb <https://openleveldb.readthedocs.io/en/latest/index.html#>`_ is a small pythonic wrapper around Plyvel_


Features
========


Transparent object store
------------------------

It works with python objects:

- Automatically **encodes objects** into bytes when saving to leveldb
- Automatically **decodes bytes** into their original type when retrieving objects from leveldb

Supported types include:

- ``int``
- ``str``
- ``numpy.ndarray``
- Anything that is serializable by orjson_

>>> db['key'] = {'key': [1, 2, 3]}
>>> db['key']
{'key': [1, 2, 3]}


Python dict-like protocol
-------------------------

It offers dict-like interface to LevelDB_


>>> db["prefix", "key"] = np.array([1, 2, 3], dtype=np.int8)
>>> db["prefix", "key"]
array([1, 2, 3], dtype=int8)

>>> db = db["prefix", ...]
>>> db["key"]
array([1, 2, 3], dtype=int8)



String-only keys
----------------

The only possible type for the keys is ``str``.
It avoids several problems when working with prefixes.



Multiprocessing support
-----------------------

Experimental **multiprocessing** support using a background flask server,
exposing the same API of a direct connection::

    db = LevelDB(db_path="path_to_db", server_address="http://127.0.0.1:5000")


.. _Plyvel: https://github.com/wbolster/plyvel
.. _LevelDB: http://code.google.com/p/leveldb/
.. _orjson: https://github.com/ijl/orjson


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

.. |license| image:: https://img.shields.io/github/license/lucmos/openleveldb
    :target: https://github.com/lucmos/openleveldb/blob/master/LICENSE
    :alt: Openleveldb license
    
.. |pypi| image:: https://img.shields.io/pypi/v/openleveldb
    :target: https://pypi.org/project/openleveldb/
    :alt: Openleveldb repo

.. |black| image:: https://img.shields.io/badge/code%20style-black-000000.svg
    :target: https://github.com/psf/black
    :alt: Black syntax

