Skip to content

Commit

Permalink
update flatbuffers (#51)
Browse files Browse the repository at this point in the history
* update flatbuffers
* add docs
  • Loading branch information
oberstet authored Mar 26, 2022
1 parent 122ddae commit 05cb171
Show file tree
Hide file tree
Showing 49 changed files with 4,885 additions and 527 deletions.
92 changes: 20 additions & 72 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -29,25 +29,25 @@ BROWSER := python -c "$$BROWSER_PYSCRIPT"
help:
@python -c "$$PRINT_HELP_PYSCRIPT" < $(MAKEFILE_LIST)

clean: clean-build clean-pyc clean-test clean-docs ## remove all build, test, coverage, Python artifacts and docs
clean: clean_build clean_pyc clean_test clean_docs ## remove all build, test, coverage, Python artifacts and docs

clean-docs:
clean_docs:
rm -fr docs/_build

clean-build: ## remove build artifacts
clean_build: ## remove build artifacts
rm -fr build/
rm -fr dist/
rm -fr .eggs/
find . -name '*.egg-info' -exec rm -fr {} +
find . -name '*.egg' -exec rm -f {} +

clean-pyc: ## remove Python file artifacts
clean_pyc: ## remove Python file artifacts
find . -name '*.pyc' -exec rm -f {} +
find . -name '*.pyo' -exec rm -f {} +
find . -name '*~' -exec rm -f {} +
find . -name '__pycache__' -exec rm -fr {} +

clean-test: ## remove test and coverage artifacts
clean_test: ## remove test and coverage artifacts
rm -fr .tox/
rm -f .coverage
rm -f .coverage.*
Expand All @@ -59,43 +59,43 @@ clean-test: ## remove test and coverage artifacts
lint: ## check style with flake8
flake8 zlmdb tests

test-single:
test_single:
clear && pytest -v -s zlmdb/tests/test_basic.py

test-pmaps:
test_pmaps:
clear && pytest -v -s zlmdb/tests/test_pmaps.py

test-indexes:
test_indexes:
clear && pytest -v -s zlmdb/tests/test_pmap_indexes.py

test-select:
test_select:
clear && pytest -v -s zlmdb/tests/test_select.py

#
# test ZLMDB high level API
#
test-zdb: test-zdb-etcd test-zdb-df test-zdb-dyn
test_zdb: test-zdb-etcd test-zdb-df test-zdb-dyn

test-zdb-etcd:
test_zdb_etcd:
python tests/zdb/test_zdb_etcd.py

test-zdb-df:
test_zdb_df:
python tests/zdb/test_zdb_df.py

test-zdb-dyn:
test_zdb_dyn:
python tests/zdb/test_zdb_dyn.py

test-zdb-fbs:
test_zdb_fbs:
python tests/zdb/test_zdb_fbs.py


test-quick:
test_quick:
pytest

test:
tox -e py36,flake8,coverage,mypy,yapf,sphinx

test-all:
test_all:
tox

coverage: ## check code coverage quickly with the default Python
Expand Down Expand Up @@ -133,66 +133,14 @@ autoformat:
yapf -ri --style=yapf.ini --exclude="zlmdb/flatbuffers/*" zlmdb


FLATC=${HOME}/scm/3rdparty/flatbuffers/flatc
#FLATC=/usr/local/bin/flatc
FLATC=/usr/local/bin/flatc

# git submodule update --init --recursive
# git submodule update --remote --merge
# git submodule foreach git pull
update_flatbuffers:
git submodule foreach git pull
rm -rf ./flatbuffers
cp -R deps/flatbuffers/python/flatbuffers .

generate_flatbuffers_reflection:
$(FLATC) --python -o zlmdb/flatbuffers/ deps/flatbuffers/reflection/reflection.fbs

generate_flatbuffers_demos:
$(FLATC) --python -o zlmdb/flatbuffers/ zlmdb/flatbuffers/demo1.fbs
$(FLATC) --python -o zlmdb/flatbuffers/ zlmdb/flatbuffers/demo2.fbs

# input .fbs files for schema
FBS_FILES=deps/flatbuffers/reflection/reflection.fbs
FBS_OUTPUT=./crossbarfx/master/database/

# flatc compiler to use (build directly from master: https://github.com/google/flatbuffers)
# oberstet@thinkpad-t430s:~$ which flatc
# /usr/local/bin/flatc
# oberstet@thinkpad-t430s:~$ flatc --version
# flatc version 1.9.0 (Jun 21 2018 14:06:19)
# oberstet@thinkpad-t430s:~$ flatc --help | grep builtin
# --bfbs-builtins Add builtin attributes to the binary schema files.
# oberstet@thinkpad-t430s:~$

flatc_version:
$(FLATC) --version

build_fbs: build_fbs_bfbs build_fbs_python

# generate schema type library (.bfbs binary) from schema files
build_fbs_bfbs:
$(FLATC) -o $(FBS_OUTPUT) --binary --schema --bfbs-comments --bfbs-builtins $(FBS_FILES)

# generate python bindings from schema files
build_fbs_python:
$(FLATC) -o $(FBS_OUTPUT) --python $(FBS_FILES)


# deps/flatbuffers/flatc
# deps/flatbuffers/libflatbuffers.a
# deps/flatbuffers/include/
flatbuffers_library:
cd deps/flatbuffers && cmake -DCMAKE_BUILD_TYPE=Release . && make && make test && cd ../..


# load_fbs(repo_oid, source_name, source_code) -> BFBS -> return UUID

# parser()
# parser.parse_from_fbs(source_name: str, source_code: str, include_dirs=[]: List[str])
# parser.serialize_to_bfbs -> bytes
# parser.conforms_to(other_parser)

# // Checks that the schema represented by this parser is a safe evolution
# // of the schema provided. Returns non-empty error on any problems.

# JSON parsing Yes No No No No No No Yes No No No
# Simple mutation Yes Yes Yes Yes No No No No No No No
# Reflection Yes No No No No No No Basic No No No
# Buffer verifier
4 changes: 2 additions & 2 deletions README.rst
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
ZLMDB
=====
Introduction to zLMDB
=====================

.. image:: https://img.shields.io/pypi/v/zlmdb.svg
:target: https://pypi.python.org/pypi/zlmdb
Expand Down
2 changes: 1 addition & 1 deletion deps/flatbuffers
Submodule flatbuffers updated 1238 files
Loading

0 comments on commit 05cb171

Please sign in to comment.