From ab449ca78ba9ce87e5ca02c598a03eb804ea4161 Mon Sep 17 00:00:00 2001 From: Jack Robison Date: Tue, 9 Nov 2021 13:29:21 -0500 Subject: [PATCH] update readme and setup.py --- README.md | 27 ++++++++++++++++++++++ README.rst | 55 --------------------------------------------- rocksdb/__init__.py | 3 +++ setup.py | 26 +++++++++++++-------- 4 files changed, 47 insertions(+), 64 deletions(-) create mode 100644 README.md delete mode 100644 README.rst diff --git a/README.md b/README.md new file mode 100644 index 0000000..c47f1b1 --- /dev/null +++ b/README.md @@ -0,0 +1,27 @@ +## lbry-rocksdb + +### Note +The `python-rocksdb` and `pyrocksdb` packages haven't been updated in a long time - this repo is a fork of python-rocksdb with many of the PRs to it merged, and with [bunch of updates and improvements](https://github.com/iFA88/python-rocksdb) from @iFA88 and @mosquito. + + +### Install from pip + pip install lbry-rocksdb + + +### Install for development / from source + sudo apt install build-essential binutils + git clone https://github.com/lbryio/lbry-rocksdb.git + cd lbry-rocksdb + git submodule update --init --recursive + git pull --recurse-submodules + make clean && make + pip install -e . + python -m unittest discover . -v + + +### Quick Usage Guide + >>> import rocksdb + >>> db = rocksdb.DB("test.db", rocksdb.Options(create_if_missing=True)) + >>> db.put(b'a', b'data') + >>> print db.get(b'a') + b'data' diff --git a/README.rst b/README.rst deleted file mode 100644 index f5d4d76..0000000 --- a/README.rst +++ /dev/null @@ -1,55 +0,0 @@ -Note -========= -The original pyrocksdb (https://pypi.python.org/pypi/pyrocksdb/0.4) has not been updated for long time. I update pyrocksdb to support the latest rocksdb. Please open issues in github if you have any problem. - -News (2021/08/26 iFA) -========= -Thanks for @mosquito (https://github.com/mosquito) who coded a github workflow to build static lib automatically. -Python version which lower than 3.7 is not supported anymore. - -News (2020/09/03 iFA) -========= -Python version which lower than 3.0 is not supported anymore. - -pyrocksdb -========= - -Python bindings for RocksDB. -See http://python-rocksdb.readthedocs.io/en/latest/ for a more comprehensive install and usage description. - - -Quick Install -------------- - -Quick install for debian/ubuntu like linux distributions. - -.. code-block:: bash - - $ apt-get install build-essential libsnappy-dev zlib1g-dev libbz2-dev libgflags-dev liblz4-dev - $ git clone https://github.com/facebook/rocksdb.git - $ cd rocksdb - $ mkdir build && cd build - $ cmake .. - $ make - $ cd .. - $ export CPLUS_INCLUDE_PATH=${CPLUS_INCLUDE_PATH}${CPLUS_INCLUDE_PATH:+:}`pwd`/include/ - $ export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}${LD_LIBRARY_PATH:+:}`pwd`/build/ - $ export LIBRARY_PATH=${LIBRARY_PATH}${LIBRARY_PATH:+:}`pwd`/build/ - - $ apt-get install python-virtualenv python-dev - $ virtualenv pyrocks_test - $ cd pyrocks_test - $ . bin/active - $ pip install python-rocksdb - - -Quick Usage Guide ------------------ - -.. code-block:: pycon - - >>> import rocksdb - >>> db = rocksdb.DB("test.db", rocksdb.Options(create_if_missing=True)) - >>> db.put(b'a', b'data') - >>> print db.get(b'a') - b'data' diff --git a/rocksdb/__init__.py b/rocksdb/__init__.py index 0417ff0..6ac6c23 100644 --- a/rocksdb/__init__.py +++ b/rocksdb/__init__.py @@ -1 +1,4 @@ from ._rocksdb import * + +ROCKSDB_VERSION = '6.25.3' # 0103296f39ec3fd89b4cdda9687c63fde90eec24 +__version__ = "0.8.1" diff --git a/setup.py b/setup.py index 5e415cd..935aa16 100644 --- a/setup.py +++ b/setup.py @@ -1,3 +1,4 @@ +import sys import platform import os from setuptools import setup @@ -14,6 +15,10 @@ except ImportError: else: SOURCES = ['rocksdb/_rocksdb.pyx'] +with open(os.path.join(os.path.dirname(__file__), 'rocksdb', '__init__.py'), 'r') as init_file: + version_line = [l for l in init_file.readlines() if l.startswith('__version__ = "')][0] + version = version_line.split('__version__ = "')[1][:-2] + EXTRA_COMPILE_ARGS = [ '-std=c++11', '-fPIC', @@ -60,17 +65,21 @@ if all(map(os.path.exists, STATIC_LIBRARIES)): os.path.join("src", "rocksdb", "lz4-1.9.3", "lib"), os.path.join("src", "rocksdb", "include"), ] - + print("✔️ all static libraries exist in expected locations") +else: + print('✘ missing static library files') + sys.exit(1) setup( - name="python-rocksdb", - version='0.7.0', + name="lbry-rocksdb", + version=version, keywords=['rocksdb', 'static', 'build'], description="Python bindings for RocksDB", - long_description=open("README.rst").read(), - author='Ming Hsuan Tu', - author_email="qrnnis2623891@gmail.com", - url="https://github.com/twmht/python-rocksdb", + long_description=open("README.md").read(), + long_description_content_type='text/markdown', + author='Jack Robison', + author_email="jackrobison@lbry.com", + url="https://github.com/lbryio/lbry-rocksdb", license='BSD License', python_requires=">=3.7.0", setup_requires=['setuptools>=25', 'Cython>=0.20'], @@ -88,8 +97,7 @@ setup( extra_link_args=EXTRA_LINK_ARGS, )]), extras_require={ - "doc": ['sphinx_rtd_theme', 'sphinx'], - "test": ['pytest'], + "doc": ['sphinx_rtd_theme', 'sphinx'] }, include_package_data=False, zip_safe=False,