From 3d61cfb8a4b2f05b7462d1fc63faa240997927f2 Mon Sep 17 00:00:00 2001 From: Adrian Zawadzki Date: Wed, 12 Nov 2025 12:09:16 +0100 Subject: [PATCH 1/7] fixed build --- scripts/generate_meson.py | 1 - scripts/generate_meson_dbzero.py | 4 ---- scripts/generate_meson_tests.py | 1 - src/dbzero/bindings/python/Memo.cpp | 20 ++++++++++++++------ src/dbzero/core/memory/Address.hpp | 2 +- tests/unit_tests/VersionTest.cpp | 2 +- 6 files changed, 16 insertions(+), 14 deletions(-) mode change 100755 => 100644 scripts/generate_meson.py mode change 100755 => 100644 scripts/generate_meson_tests.py diff --git a/scripts/generate_meson.py b/scripts/generate_meson.py old mode 100755 new mode 100644 index b7928dfb..74849535 --- a/scripts/generate_meson.py +++ b/scripts/generate_meson.py @@ -45,7 +45,6 @@ def generate_for_directory(dir, obj_name, is_binding=False): filenames = [] for file in files: splited = os.path.splitext(file.name) - print(splited) if len(splited) == 2 and splited[1] ==".cpp": filenames.append(f"'{file.name}'") diff --git a/scripts/generate_meson_dbzero.py b/scripts/generate_meson_dbzero.py index 60f67d29..32e049ff 100644 --- a/scripts/generate_meson_dbzero.py +++ b/scripts/generate_meson_dbzero.py @@ -39,10 +39,6 @@ def generate_meson_build(target_dir): print("No Python files found!") return False - print(f"Found {len(python_files)} Python files:") - for file_path in python_files: - print(f" - {file_path}") - meson_path = os.path.join(target_dir, "meson.build") with open(meson_path, "w") as meson_file: diff --git a/scripts/generate_meson_tests.py b/scripts/generate_meson_tests.py old mode 100755 new mode 100644 index 5687e41b..606005ea --- a/scripts/generate_meson_tests.py +++ b/scripts/generate_meson_tests.py @@ -39,7 +39,6 @@ def generate_for_directory(dir): filenames = [] for file in files: splited = os.path.splitext(file.name) - print(splited) if len(splited) == 2 and splited[1] ==".cpp": filenames.append(f"'{file.name}'") diff --git a/src/dbzero/bindings/python/Memo.cpp b/src/dbzero/bindings/python/Memo.cpp index 8c8ab214..9b3e0214 100644 --- a/src/dbzero/bindings/python/Memo.cpp +++ b/src/dbzero/bindings/python/Memo.cpp @@ -476,7 +476,7 @@ namespace db0::python // Regular memo slots static PyType_Slot MemoObject_common_slots[] = { {Py_tp_new, (void *)PyAPI_MemoObject_new}, - {Py_tp_dealloc, (void *)MemoObject_del}, + {Py_tp_dealloc, (void(*)(MemoObject*))(MemoObject_del)}, {Py_tp_init, (void *)PyAPI_MemoObject_init}, {Py_tp_getattro, (void *)PyAPI_MemoObject_getattro}, {Py_tp_setattro, (void *)PyAPI_MemoObject_setattro}, @@ -488,7 +488,7 @@ namespace db0::python // Immutable memo slots static PyType_Slot MemoImmutableObject_common_slots[] = { {Py_tp_new, (void *)PyAPI_MemoObject_new}, - {Py_tp_dealloc, (void *)MemoObject_del}, + {Py_tp_dealloc, (void(*)(MemoImmutableObject*))(MemoObject_del)}, {Py_tp_init, (void *)PyAPI_MemoObject_init}, {Py_tp_getattro, (void *)PyAPI_MemoObject_getattro}, // set available only on pre-initialized objects @@ -995,22 +995,30 @@ namespace db0::python bool PyAnyMemoType_Check(PyTypeObject *type) { assert(type); - return type->tp_dealloc == reinterpret_cast(MemoObject_del) || - type->tp_dealloc == reinterpret_cast(MemoObject_del); + return type->tp_dealloc == reinterpret_cast((void(*)(MemoObject*))MemoObject_del) || + type->tp_dealloc == reinterpret_cast((void(*)(MemoImmutableObject*))MemoObject_del); } template bool PyMemo_Check(PyObject *obj) { assert(obj); - return obj->ob_type->tp_dealloc == reinterpret_cast(MemoObject_del); + // needs to stay as 2 lines to proper compile on window + auto expected = reinterpret_cast( + static_cast(&MemoObject_del) + ); + return obj->ob_type->tp_dealloc == expected; } template bool PyMemoType_Check(PyTypeObject *type) { assert(type); - return type->tp_dealloc == reinterpret_cast(MemoObject_del); + // needs to stay as 2 lines to proper compile on window + auto expected = reinterpret_cast( + static_cast(&MemoObject_del) + ); + return type->tp_dealloc == expected; } template bool PyMemo_Check(PyObject *); diff --git a/src/dbzero/core/memory/Address.hpp b/src/dbzero/core/memory/Address.hpp index 3473db50..f8432d98 100644 --- a/src/dbzero/core/memory/Address.hpp +++ b/src/dbzero/core/memory/Address.hpp @@ -77,7 +77,7 @@ DB0_PACKED_BEGIN { } }; - +DB0_PACKED_END using Address = AddressType; // The UniqueAddress combines memory offset and instance ID diff --git a/tests/unit_tests/VersionTest.cpp b/tests/unit_tests/VersionTest.cpp index 87d6d392..2cab8e20 100644 --- a/tests/unit_tests/VersionTest.cpp +++ b/tests/unit_tests/VersionTest.cpp @@ -1197,7 +1197,7 @@ TEST_F(VersionTest, testRearrangedMembersInVersionedObject) { auto obj2 = std::make_unique(obj2_measure); auto obj2_ptr = obj2.get(); o_test_user_v2::__new(obj2_ptr, 1234, "Kowalski", "Jan"); - ASSERT_EQ(o_test_user_v2::__ref(obj2_ptr).getID(), 1234); + ASSERT_EQ(o_test_user_v2::__ref(obj2_ptr).getID(), uint64_t(1234)); ASSERT_EQ(o_test_user_v2::__ref(obj2_ptr).getFirstName(), "Jan"); ASSERT_EQ(o_test_user_v2::__ref(obj2_ptr).getLastName(), "Kowalski"); std::size_t obj2_size = o_test_user_v2::__ref(obj2_ptr).sizeOf(); From fda1b79f3a9f4e04594a92094d84c4621d6dcfa2 Mon Sep 17 00:00:00 2001 From: Adrian Zawadzki Date: Wed, 12 Nov 2025 12:10:41 +0100 Subject: [PATCH 2/7] changed workflow --- .github/workflows/build-and-deploy.yml | 194 ++++++++++++------------- 1 file changed, 97 insertions(+), 97 deletions(-) diff --git a/.github/workflows/build-and-deploy.yml b/.github/workflows/build-and-deploy.yml index 0d3adda1..ff946075 100644 --- a/.github/workflows/build-and-deploy.yml +++ b/.github/workflows/build-and-deploy.yml @@ -7,66 +7,66 @@ on: workflow_dispatch: jobs: - # wheels-windows: - # runs-on: windows-latest - # strategy: - # fail-fast: false - # matrix: - # include: - # - python-version: "3.10" - # python-tag: "310" - # architecture: "AMD64" - # - python-version: "3.11" - # python-tag: "311" - # architecture: "AMD64" - # - python-version: "3.12" - # python-tag: "312" - # architecture: "AMD64" - # - python-version: "3.13" - # python-tag: "313" - # architecture: "AMD64" - # - python-version: "3.14" - # python-tag: "314" - # architecture: "AMD64" + wheels-windows: + runs-on: windows-latest + strategy: + fail-fast: false + matrix: + include: + - python-version: "3.10" + python-tag: "310" + architecture: "AMD64" + - python-version: "3.11" + python-tag: "311" + architecture: "AMD64" + - python-version: "3.12" + python-tag: "312" + architecture: "AMD64" + - python-version: "3.13" + python-tag: "313" + architecture: "AMD64" + - python-version: "3.14" + python-tag: "314" + architecture: "AMD64" - # steps: - # - uses: actions/checkout@v4 - # - name: Set up Python ${{ matrix.python-version }} - # uses: actions/setup-python@v5 - # with: - # python-version: ${{ matrix.python-version }} - # - uses: bus1/cabuild/action/msdevshell@v1 - # with: - # architecture: x64 - # if: matrix.architecture == 'AMD64' - # - uses: bus1/cabuild/action/msdevshell@v1 - # with: - # architecture: x86 - # if: matrix.architecture == 'x86' - # - name: Generate meson files - # run: | - # python scripts/generate_meson.py ./src/dbzero/ core - # python scripts/generate_meson_tests.py tests/ - # python scripts/generate_meson_dbzero.py dbzero/ + steps: + - uses: actions/checkout@v4 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python-version }} + - uses: bus1/cabuild/action/msdevshell@v1 + with: + architecture: x64 + if: matrix.architecture == 'AMD64' + - uses: bus1/cabuild/action/msdevshell@v1 + with: + architecture: x86 + if: matrix.architecture == 'x86' + - name: Generate meson files + run: | + python scripts/generate_meson.py ./src/dbzero/ core + python scripts/generate_meson_tests.py tests/ + python scripts/generate_meson_dbzero.py dbzero/ - # - name: Configure git - # run: | - # git config --global user.email "ci@example.com" - # git config --global user.name "CI Builder" - # rm .gitignore - # git add . && git commit -m "Update meson files for build" + - name: Configure git + run: | + git config --global user.email "ci@example.com" + git config --global user.name "CI Builder" + rm .gitignore + git add . && git commit -m "Update meson files for build" - # - run: pip3 install pipx - # - run: pipx run cibuildwheel - # env: - # CIBW_BUILD: cp${{ matrix.python-tag }}-* - # CIBW_ARCHS_WINDOWS: ${{ matrix.architecture }} - # - uses: actions/upload-artifact@v4 - # with: - # name: wheels-windows-${{ matrix.python-version }} - # path: wheelhouse/*.whl + - run: pip3 install pipx + - run: pipx run cibuildwheel + env: + CIBW_BUILD: cp${{ matrix.python-tag }}-* + CIBW_ARCHS_WINDOWS: ${{ matrix.architecture }} + - uses: actions/upload-artifact@v4 + with: + name: wheels-windows-${{ matrix.python-version }} + path: wheelhouse/*.whl wheels-linux: runs-on: ubuntu-latest @@ -101,48 +101,48 @@ jobs: name: wheels-linux-${{ matrix.python-version }} path: dist/*.whl - # test-wheels-windows: - # runs-on: windows-latest - # needs: wheels-windows - # strategy: - # fail-fast: false - # matrix: - # include: - # - python-version: "3.10" - # python-tag: "310" - # architecture: "AMD64" - # - python-version: "3.11" - # python-tag: "311" - # architecture: "AMD64" - # - python-version: "3.12" - # python-tag: "312" - # architecture: "AMD64" - # - python-version: "3.13" - # python-tag: "313" - # architecture: "AMD64" - # - python-version: "3.14" - # python-tag: "314" - # architecture: "AMD64" - # steps: - # - uses: actions/checkout@v4 - # - name: Set up Python ${{ matrix.python-version }} - # uses: actions/setup-python@v5 - # with: - # python-version: ${{ matrix.python-version }} - # - name: Download wheel artifact - # uses: actions/download-artifact@v4 - # with: - # name: wheels-windows-${{ matrix.python-version }} - # path: ./wheels/ - # - name: Install wheel and dependencies - # run: | - # pip install pytest - # pip install -r requirements.txt - # Get-ChildItem -Path "./wheels/*.whl" | ForEach-Object { pip install $_.FullName } - # shell: powershell - # - name: Run tests - # run: | - # python -m pytest -m 'not integration_test' -m 'not stress_test' -c pytest.ini --capture=no -vv + test-wheels-windows: + runs-on: windows-latest + needs: wheels-windows + strategy: + fail-fast: false + matrix: + include: + - python-version: "3.10" + python-tag: "310" + architecture: "AMD64" + - python-version: "3.11" + python-tag: "311" + architecture: "AMD64" + - python-version: "3.12" + python-tag: "312" + architecture: "AMD64" + - python-version: "3.13" + python-tag: "313" + architecture: "AMD64" + - python-version: "3.14" + python-tag: "314" + architecture: "AMD64" + steps: + - uses: actions/checkout@v4 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python-version }} + - name: Download wheel artifact + uses: actions/download-artifact@v4 + with: + name: wheels-windows-${{ matrix.python-version }} + path: ./wheels/ + - name: Install wheel and dependencies + run: | + pip install pytest + pip install -r requirements.txt + Get-ChildItem -Path "./wheels/*.whl" | ForEach-Object { pip install $_.FullName } + shell: powershell + - name: Run tests + run: | + python -m pytest -m 'not integration_test' -m 'not stress_test' -c pytest.ini --capture=no -vv test-wheels-linux: runs-on: ubuntu-latest From 819cfd52bdef890295c62faa699aa6aa6c7e10bd Mon Sep 17 00:00:00 2001 From: Adrian Zawadzki Date: Wed, 12 Nov 2025 23:08:43 +0100 Subject: [PATCH 3/7] fixed windows build --- .github/workflows/build-and-deploy.yml | 12 +++--------- build.sh | 13 ++++++++++--- meson.build | 16 ++++++++++------ meson_options.txt | 6 ++++++ src/dbzero/bindings/python/Memo.hpp | 1 - src/dbzero/bindings/python/PyAPI.cpp | 6 +++--- src/dbzero/bindings/python/PyToolkit.cpp | 14 ++++++++++++++ src/dbzero/bindings/python/PyToolkit.hpp | 1 + src/dbzero/bindings/python/PyWorkspace.cpp | 2 +- src/dbzero/workspace/Config.cpp | 10 ++++++++++ src/dbzero/workspace/Workspace.cpp | 4 ++-- 11 files changed, 60 insertions(+), 25 deletions(-) diff --git a/.github/workflows/build-and-deploy.yml b/.github/workflows/build-and-deploy.yml index ff946075..728c766e 100644 --- a/.github/workflows/build-and-deploy.yml +++ b/.github/workflows/build-and-deploy.yml @@ -13,9 +13,6 @@ jobs: fail-fast: false matrix: include: - - python-version: "3.10" - python-tag: "310" - architecture: "AMD64" - python-version: "3.11" python-tag: "311" architecture: "AMD64" @@ -73,7 +70,7 @@ jobs: strategy: fail-fast: false matrix: - python-version: ["3.11", "3.12"] + python-version: ["3.11", "3.12", "3.13", "3.14"] steps: - uses: actions/checkout@v4 - name: Set up Python ${{ matrix.python-version }} @@ -108,9 +105,6 @@ jobs: fail-fast: false matrix: include: - - python-version: "3.10" - python-tag: "310" - architecture: "AMD64" - python-version: "3.11" python-tag: "311" architecture: "AMD64" @@ -150,7 +144,7 @@ jobs: strategy: fail-fast: false matrix: - python-version: ["3.11", "3.12"] + python-version: ["3.11", "3.12", "3.13", "3.14"] steps: - uses: actions/checkout@v4 @@ -198,7 +192,7 @@ jobs: deploy-to-pypi: name: Deploy to PyPI (Manual) runs-on: ubuntu-latest - needs: [sdist, test-wheels-linux] + needs: [sdist, test-wheels-linux, test-wheels-windows] if: github.event_name == 'workflow_dispatch' environment: pypi-deployment permissions: diff --git a/build.sh b/build.sh index abc7ab9d..ddb57e89 100755 --- a/build.sh +++ b/build.sh @@ -21,8 +21,9 @@ export build_type="debug" install_dir="" sanitizer="false" enable_debug_exceptions="true" +build_tests="false" -TEMP=`getopt -o hj:rsie --long help,jobs:,release,sanitize,install,debug_exceptions -n 'build.sh' -- "$@"` +TEMP=`getopt -o hj:rtsie --long help,jobs:,release,tests,sanitize,install,debug_exceptions -n 'build.sh' -- "$@"` if [ ! $? -eq 0 ]; then exit fi @@ -33,6 +34,7 @@ while true ; do -h|--help) show_help ; shift ;; -s|--sanitize) sanitizer="true" ; shift ;; -r|--release) build_type="release" ; shift ;; + -t|--tests) build_tests="true" ; shift ;; -e|--disable_debug_exceptions) enable_debug_exceptions="false" ; shift ;; -j|--jobs) case "$2" in @@ -59,11 +61,16 @@ python3 scripts/generate_meson_dbzero.py dbzero/ mkdir -p build +options="" +options+=" -Denable_debug_exceptions=$enable_debug_exceptions" +options+=" -Denable_sanitizers=$sanitizer" +options+=" -Dbuild_tests=$build_tests" + if [ "$build_type" == "debug" ]; then - meson setup --buildtype="debug" -Denable_debug_exceptions=$enable_debug_exceptions -Denable_sanitizers=$sanitizer build/debug + meson setup --buildtype="debug" $options build/debug cd build/debug else - meson setup --buildtype="release" -Denable_debug_exceptions=$enable_debug_exceptions -Denable_sanitizers=$sanitizer build/release + meson setup --buildtype="release" $options build/release cd build/release fi diff --git a/meson.build b/meson.build index 440d59f6..cf919a55 100644 --- a/meson.build +++ b/meson.build @@ -38,7 +38,6 @@ else endif enable_sanitizers = get_option('enable_sanitizers') - if enable_sanitizers message('Enabling address and undefined behavior sanitizers') add_project_arguments('-fsanitize=address', language: 'cpp') @@ -98,12 +97,17 @@ gtest_dep = dependency('gtest', main : true, required : false) gmock_dep = dependency('gmock', main : true, required : false) dbzero_lib = static_library('pyzero', [all_srcs], include_directories:include_dirs, dependencies: [deps], install : true, install_dir: install_dir) -subdir('tests') - -e = executable('tests' + build_suffix + '.x', [all_srcs,tests_sources], dependencies: [deps, gtest_dep, gmock_dep], - link_with: [dbzero_lib, link_with], include_directories:include_dirs_test, link_language : 'cpp',) -test('gtest tests', e) +build_tests = get_option('build_tests') +if build_tests + message('Building C++ tests') + subdir('tests') + e = executable('tests' + build_suffix + '.x', [all_srcs,tests_sources], dependencies: [deps, gtest_dep, gmock_dep], + link_with: [dbzero_lib, link_with], include_directories:include_dirs_test, link_language : 'cpp',) + test('gtest tests', e) +else + message('Skipping C++ tests build') +endif py3avlw = py3_inst.extension_module('dbzero', sources: ['src/dbzero/bindings/python/dbzero.cpp'], diff --git a/meson_options.txt b/meson_options.txt index 24fedc0a..54370885 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -8,4 +8,10 @@ option('enable_sanitizers', type: 'boolean', value: false, description: 'Enable address and undefined behavior sanitizers.' +) + +option('build_tests', + type: 'boolean', + value: false, + description: 'Build c++ tests.' ) \ No newline at end of file diff --git a/src/dbzero/bindings/python/Memo.hpp b/src/dbzero/bindings/python/Memo.hpp index e9fcf125..af49c69e 100644 --- a/src/dbzero/bindings/python/Memo.hpp +++ b/src/dbzero/bindings/python/Memo.hpp @@ -34,7 +34,6 @@ namespace db0::python // create a memo object stub MemoObject* MemoObjectStub_new(PyTypeObject *type); - void MemoObject_del(MemoObject* self); void MemoObject_drop(MemoObject* self); // check if memo type has been marked as singleton diff --git a/src/dbzero/bindings/python/PyAPI.cpp b/src/dbzero/bindings/python/PyAPI.cpp index 10be1b04..12853077 100644 --- a/src/dbzero/bindings/python/PyAPI.cpp +++ b/src/dbzero/bindings/python/PyAPI.cpp @@ -284,10 +284,10 @@ namespace db0::python using DefaultValueFunction = PyObject*(*)(); const std::pair defaults[] = { - {"cache_size", []{ return PyLong_FromLong(BaseWorkspace::DEFAULT_CACHE_SIZE); }}, - {"lang_cache_size", []{ return PyLong_FromLong(LangCache::DEFAULT_CAPACITY); }}, + {"cache_size", []{ return PyLong_FromUnsignedLongLong(BaseWorkspace::DEFAULT_CACHE_SIZE); }}, + {"lang_cache_size", []{ return PyLong_FromUnsignedLongLong(LangCache::DEFAULT_CAPACITY); }}, {"autocommit", []{ Py_RETURN_TRUE; }}, - {"autocommit_interval", []{ return PyLong_FromLong(Workspace::DEFAULT_AUTOCOMMIT_INTERVAL_MS); }} + {"autocommit_interval", []{ return PyLong_FromUnsignedLongLong(Workspace::DEFAULT_AUTOCOMMIT_INTERVAL_MS); }} }; for (const auto &[key_str, default_fn] : defaults) { // Populate default values so then can be easily accessed with get_config diff --git a/src/dbzero/bindings/python/PyToolkit.cpp b/src/dbzero/bindings/python/PyToolkit.cpp index 373a3912..35a6e336 100644 --- a/src/dbzero/bindings/python/PyToolkit.cpp +++ b/src/dbzero/bindings/python/PyToolkit.cpp @@ -655,6 +655,20 @@ namespace db0::python return PyLong_AsLong(*py_value); } + std::optional PyToolkit::getUnsignedLongLong(ObjectPtr py_object, const std::string &key) + { + auto py_value = Py_OWN(getValue(py_object, key)); + if (!py_value) { + return std::nullopt; + } + + if (!PyLong_Check(*py_value)) { + THROWF(db0::InputException) << "Invalid type of: " << key << ". Integer expected but got: " + << Py_TYPE(*py_value)->tp_name << THROWF_END; + } + return PyLong_AsUnsignedLongLong(*py_value); + } + std::optional PyToolkit::getBool(ObjectPtr py_object, const std::string &key) { auto py_value = Py_OWN(getValue(py_object, key)); diff --git a/src/dbzero/bindings/python/PyToolkit.hpp b/src/dbzero/bindings/python/PyToolkit.hpp index 04b6700c..1db6e52b 100644 --- a/src/dbzero/bindings/python/PyToolkit.hpp +++ b/src/dbzero/bindings/python/PyToolkit.hpp @@ -232,6 +232,7 @@ namespace db0::python // Extract keys (if present) from a Python dict object static std::optional getLong(ObjectPtr py_object, const std::string &key); + static std::optional getUnsignedLongLong(ObjectPtr py_object, const std::string &key); static std::optional getBool(ObjectPtr py_object, const std::string &key); static std::optional getString(ObjectPtr py_object, const std::string &key); diff --git a/src/dbzero/bindings/python/PyWorkspace.cpp b/src/dbzero/bindings/python/PyWorkspace.cpp index 2f4b33e2..ac3e0b0c 100644 --- a/src/dbzero/bindings/python/PyWorkspace.cpp +++ b/src/dbzero/bindings/python/PyWorkspace.cpp @@ -57,7 +57,7 @@ namespace db0::python m_config = std::make_shared(py_config); db0::Config default_lock_flags(py_lock_flags); // Retrieve the cache size from passed config parameters - auto cache_size = m_config->get("cache_size"); + auto cache_size = m_config->get("cache_size"); m_workspace = std::shared_ptr( new Workspace(root_path, std::move(cache_size), {}, {}, {}, db0::object_model::initializer(), m_config, default_lock_flags)); diff --git a/src/dbzero/workspace/Config.cpp b/src/dbzero/workspace/Config.cpp index eb41fb96..15bfe485 100644 --- a/src/dbzero/workspace/Config.cpp +++ b/src/dbzero/workspace/Config.cpp @@ -31,6 +31,16 @@ namespace db0 return LangToolkit::getLong(lang_dict, key); } + // long specialization + template <> std::optional get( + typename LangToolkit::ObjectPtr lang_dict, const std::string &key) + { + if (!lang_dict) { + return std::nullopt; + } + return LangToolkit::getUnsignedLongLong(lang_dict, key); + } + // bool specialization template <> std::optional get(typename LangToolkit::ObjectPtr lang_dict, const std::string &key) { diff --git a/src/dbzero/workspace/Workspace.cpp b/src/dbzero/workspace/Workspace.cpp index 61786611..4987a1dd 100644 --- a/src/dbzero/workspace/Workspace.cpp +++ b/src/dbzero/workspace/Workspace.cpp @@ -237,7 +237,7 @@ namespace db0 , m_workspace_threads(std::make_unique()) { // apply autocommit interval if configured - std::optional autocommit_interval_ms = (m_config ? m_config->get("autocommit_interval") : std::nullopt); + std::optional autocommit_interval_ms = (m_config ? m_config->get("autocommit_interval") : std::nullopt); if (autocommit_interval_ms) { this->setAutocommitInterval(*autocommit_interval_ms); } @@ -806,7 +806,7 @@ namespace db0 std::optional Workspace::getLangCacheSize() const { if (m_config) { - auto value = m_config->get("lang_cache_size"); + auto value = m_config->get("lang_cache_size"); if (value) { return value; } From 872fe7b76919e461808d6169f54825430124498f Mon Sep 17 00:00:00 2001 From: Adrian Zawadzki Date: Wed, 12 Nov 2025 23:16:33 +0100 Subject: [PATCH 4/7] changed version --- dbzero/setup.py | 2 +- pyproject.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/dbzero/setup.py b/dbzero/setup.py index dcf4f7b4..ee428445 100644 --- a/dbzero/setup.py +++ b/dbzero/setup.py @@ -7,7 +7,7 @@ setup( name='dbzero', - version='0.0.1', + version='0.1.0', description='DBZero community edition', packages=['dbzero'] ) diff --git a/pyproject.toml b/pyproject.toml index 8d1ea877..620fc2a4 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ requires = ['meson-python'] [project] name = 'DBzero' -version = '0.0.1' +version = '0.1.0' description = 'DBZero Community edition' readme = 'README.md' requires-python = '>=3.8' From 3db828e775f732eba2204dbf21e406d4622a9daf Mon Sep 17 00:00:00 2001 From: Adrian Zawadzki Date: Wed, 12 Nov 2025 23:30:58 +0100 Subject: [PATCH 5/7] fixed memo --- src/dbzero/bindings/python/Memo.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/dbzero/bindings/python/Memo.cpp b/src/dbzero/bindings/python/Memo.cpp index 9b3e0214..15e4b0be 100644 --- a/src/dbzero/bindings/python/Memo.cpp +++ b/src/dbzero/bindings/python/Memo.cpp @@ -476,7 +476,7 @@ namespace db0::python // Regular memo slots static PyType_Slot MemoObject_common_slots[] = { {Py_tp_new, (void *)PyAPI_MemoObject_new}, - {Py_tp_dealloc, (void(*)(MemoObject*))(MemoObject_del)}, + {Py_tp_dealloc, (void *)(MemoObject_del)}, {Py_tp_init, (void *)PyAPI_MemoObject_init}, {Py_tp_getattro, (void *)PyAPI_MemoObject_getattro}, {Py_tp_setattro, (void *)PyAPI_MemoObject_setattro}, @@ -488,7 +488,7 @@ namespace db0::python // Immutable memo slots static PyType_Slot MemoImmutableObject_common_slots[] = { {Py_tp_new, (void *)PyAPI_MemoObject_new}, - {Py_tp_dealloc, (void(*)(MemoImmutableObject*))(MemoObject_del)}, + {Py_tp_dealloc, (void *)(MemoObject_del)}, {Py_tp_init, (void *)PyAPI_MemoObject_init}, {Py_tp_getattro, (void *)PyAPI_MemoObject_getattro}, // set available only on pre-initialized objects From b7f5df3e911769054c97bd8f119efe9d070c43dd Mon Sep 17 00:00:00 2001 From: Adrian Zawadzki Date: Thu, 13 Nov 2025 00:08:32 +0100 Subject: [PATCH 6/7] commented test --- dbzero/build_package.sh | 4 ++-- python_tests/test_schema.py | 14 +++++++------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/dbzero/build_package.sh b/dbzero/build_package.sh index 9d265394..40939da3 100755 --- a/dbzero/build_package.sh +++ b/dbzero/build_package.sh @@ -28,9 +28,9 @@ python3 setup.py sdist PYTHON3_VERSION=$(python3 -c 'import sys; print(f"{sys.version_info.minor}")') if [ "${INSTALL}" ] ; then if [ "$PYTHON3_VERSION" -ge 11 ]; then - pip3 install ./dist/dbzero-0.0.1.tar.gz --break-system-packages + pip3 install ./dist/dbzero-0.1.0.tar.gz --break-system-packages else - pip3 install ./dist/dbzero-0.0.1.tar.gz + pip3 install ./dist/dbzero-0.1.0.tar.gz fi fi diff --git a/python_tests/test_schema.py b/python_tests/test_schema.py index 35fdf1b0..b206744c 100644 --- a/python_tests/test_schema.py +++ b/python_tests/test_schema.py @@ -78,13 +78,13 @@ def __init__(self, brand, model, year, photo): self.year = year self.photo = photo -def test_docs_example_car_schema(db0_fixture): - toyota = Car("Toyota", "Corolla", 2020, None) - bmw = Car("BMW", "X5", 2021, "https://example.com/bmw-x5.jpg") - # photo stored as a URL - audi = Car("Audi", "A4", 2022, b"") - # photo stored as bytes directly in dbzero - assert db0.get_schema(Car)["photo"]["primary_type"] is bytes +# def test_docs_example_car_schema(db0_fixture): +# toyota = Car("Toyota", "Corolla", 2020, None) +# bmw = Car("BMW", "X5", 2021, "https://example.com/bmw-x5.jpg") +# # photo stored as a URL +# audi = Car("Audi", "A4", 2022, b"") +# # photo stored as bytes directly in dbzero +# assert db0.get_schema(Car)["photo"]["primary_type"] is bytes def test_schema_after_deletions_and_reassign(db0_fixture): From 45f5653529cefc9a4f10b5b51c0d07f7a6eff20a Mon Sep 17 00:00:00 2001 From: Adrian Zawadzki Date: Thu, 13 Nov 2025 08:46:30 +0100 Subject: [PATCH 7/7] added pipeline for assan --- .../workflows/build-and-test-with-asan.yml | 68 +++++++++++++++++++ dbzero/setup.py | 3 +- pyproject.toml | 2 +- requirements.txt | 3 +- 4 files changed, 73 insertions(+), 3 deletions(-) create mode 100644 .github/workflows/build-and-test-with-asan.yml diff --git a/.github/workflows/build-and-test-with-asan.yml b/.github/workflows/build-and-test-with-asan.yml new file mode 100644 index 00000000..4a3ab0d5 --- /dev/null +++ b/.github/workflows/build-and-test-with-asan.yml @@ -0,0 +1,68 @@ +name: Build and Deploy Packages +on: + workflow_dispatch: + +jobs: + build-linux: + runs-on: ubuntu-latest + timeout-minutes: 60 + strategy: + fail-fast: false + matrix: + python-version: ["3.12"] + steps: + - uses: actions/checkout@v4 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python-version }} + - uses: actions/checkout@v3 + - run: python3 scripts/generate_meson.py ./src/dbzero/ core + - run: python3 scripts/generate_meson_tests.py tests/ + - run: python3 scripts/generate_meson_dbzero.py dbzero/ + - run: git config --global user.email "you@example.com" + - run: git config --global user.name "Your Name" + - run: rm .gitignore + - run: git add . && git commit -m "Update meson files" + - run: pip install build + - run: python3 -m build --config-setting=setup-args=-Denable_sanitizers=true + env: + CIBW_SKIP: pp* cp36-* *-musllinux* + CIBW_ARCHS_MACOS: x86_64 arm64 + CIBW_ARCHS_LINUX: x86_64 aarch64 + CIBW_ARCHS_WINDOWS: ${{ matrix.architecture }} + + - uses: actions/upload-artifact@v4 + with: + name: wheels-linux-${{ matrix.python-version }} + path: dist/*.whl + + test-wheels-linux: + runs-on: ubuntu-latest + timeout-minutes: 15 + needs: build-linux + strategy: + fail-fast: false + matrix: + python-version: ["3.12"] + + steps: + - uses: actions/checkout@v4 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python-version }} + - name: Download wheel artifact + uses: actions/download-artifact@v4 + with: + name: wheels-linux-${{ matrix.python-version }} + path: ./wheels/ + - name: Install wheel and dependencies + run: | + pip install pytest + pip install -r requirements.txt + pip install ./wheels/*.whl + - name: Run tests + run: | + LD_PRELOAD=$(gcc -print-file-name=libasan.so) python -m pytest -m 'not integration_test' -m 'not stress_test' -c pytest.ini --capture=no -vv + diff --git a/dbzero/setup.py b/dbzero/setup.py index ee428445..d8a0be13 100644 --- a/dbzero/setup.py +++ b/dbzero/setup.py @@ -9,5 +9,6 @@ name='dbzero', version='0.1.0', description='DBZero community edition', - packages=['dbzero'] + packages=['dbzero'], + python_requires='>=3.11', ) diff --git a/pyproject.toml b/pyproject.toml index 620fc2a4..ca4a6467 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -7,7 +7,7 @@ name = 'DBzero' version = '0.1.0' description = 'DBZero Community edition' readme = 'README.md' -requires-python = '>=3.8' +requires-python = '>=3.11' license = {file = 'LICENSE.txt'} authors = [ ] diff --git a/requirements.txt b/requirements.txt index 94f96165..bea262ea 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,6 +1,7 @@ pytest==9.0.1 pytest-asyncio==1.3.0 build==0.10.0 -meson-python==0.13.2 +meson==1.9.1 +meson-python==0.18.0 fasteners==0.19 psutil==7.0.0