diff --git a/.github/workflows/build-and-deploy.yml b/.github/workflows/build-and-deploy.yml index ba84a70e..60ed0099 100644 --- a/.github/workflows/build-and-deploy.yml +++ b/.github/workflows/build-and-deploy.yml @@ -12,6 +12,9 @@ jobs: fail-fast: false matrix: include: + - python-version: "3.9" + python-tag: "39" + architecture: "AMD64" - python-version: "3.10" python-tag: "310" architecture: "AMD64" @@ -37,7 +40,7 @@ jobs: strategy: fail-fast: false matrix: - python-version: ["3.10", "3.11", "3.12", "3.13", "3.14"] + python-version: ["3.9", "3.10", "3.11", "3.12", "3.13", "3.14"] uses: ./.github/workflows/build-linux-wheel.yml with: python-version: ${{ matrix.python-version }} @@ -48,6 +51,9 @@ jobs: fail-fast: false matrix: include: + - python-version: "3.9" + python-tag: "39" + architecture: "AMD64" - python-version: "3.10" python-tag: "310" architecture: "AMD64" @@ -72,7 +78,7 @@ jobs: strategy: fail-fast: false matrix: - python-version: ["3.10", "3.11", "3.12", "3.13", "3.14"] + python-version: ["3.9", "3.10", "3.11", "3.12", "3.13", "3.14"] uses: ./.github/workflows/test-linux-wheel.yml with: python-version: ${{ matrix.python-version }} diff --git a/.github/workflows/build-linux-wheel.yml b/.github/workflows/build-linux-wheel.yml index e6703006..810b79c7 100644 --- a/.github/workflows/build-linux-wheel.yml +++ b/.github/workflows/build-linux-wheel.yml @@ -21,6 +21,7 @@ on: required: true type: choice options: + - '3.9' - '3.10' - '3.11' - '3.12' diff --git a/.github/workflows/build-windows-wheel.yml b/.github/workflows/build-windows-wheel.yml index 8160d52e..909f3304 100644 --- a/.github/workflows/build-windows-wheel.yml +++ b/.github/workflows/build-windows-wheel.yml @@ -19,6 +19,7 @@ on: required: true type: choice options: + - '3.9' - '3.10' - '3.11' - '3.12' @@ -30,6 +31,7 @@ on: required: true type: choice options: + - '39' - '310' - '311' - '312' diff --git a/.github/workflows/test-all-versions.yml b/.github/workflows/test-all-versions.yml index c59e6727..3b62f110 100644 --- a/.github/workflows/test-all-versions.yml +++ b/.github/workflows/test-all-versions.yml @@ -1,186 +1,232 @@ -name: Test All Versions - +name: Build and Deploy Packages on: + push: + tags: + - 'v[0-9]*' + - feature/ci_test workflow_dispatch: - schedule: - # Run daily at 2 AM UTC - - cron: '0 2 * * *' jobs: - build-linux-asan: - strategy: - fail-fast: false - matrix: - python-version: ["3.10", "3.11", "3.12", "3.13", "3.14"] - uses: ./.github/workflows/build-linux-wheel.yml - with: - python-version: ${{ matrix.python-version }} - build-args: '--config-setting=setup-args=-Denable_sanitizers=true' - timeout-minutes: 60 - - build-windows: + 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" - uses: ./.github/workflows/build-windows-wheel.yml - with: - python-version: ${{ matrix.python-version }} - python-tag: ${{ matrix.python-tag }} - architecture: 'AMD64' + architecture: "AMD64" + + - test-linux-unit-asan: - needs: build-linux-asan - strategy: - fail-fast: false - matrix: - python-version: ["3.10", "3.11", "3.12", "3.13", "3.14"] - runs-on: ubuntu-latest - timeout-minutes: 20 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 + - uses: bus1/cabuild/action/msdevshell@v1 with: - name: wheels-linux-${{ matrix.python-version }} - path: ./wheels/ - - - name: Install wheel and dependencies + architecture: x64 + if: matrix.architecture == 'AMD64' + - uses: bus1/cabuild/action/msdevshell@v1 + with: + architecture: x86 + if: matrix.architecture == 'x86' + - name: Generate meson files run: | - pip install pytest - pip install -r requirements.txt - pip install ./wheels/*.whl + python scripts/generate_meson.py ./src/dbzero/ core + python scripts/generate_meson_tests.py tests/ + python scripts/generate_meson_dbzero.py dbzero/ - - name: Run unit tests with ASAN + - name: Configure git 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 + 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 - test-linux-stress-asan: - needs: build-linux-asan + wheels-linux: + runs-on: ubuntu-latest strategy: fail-fast: false matrix: - python-version: ["3.10", "3.11", "3.12", "3.13", "3.14"] - runs-on: ubuntu-latest - timeout-minutes: 60 + python-version: ["3.9", "3.10", "3.11", "3.12", "3.13", "3.14"] 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 + - 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 + 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: ./wheels/ - - - name: Install wheel and dependencies - run: | - pip install pytest - pip install -r requirements.txt - pip install ./wheels/*.whl - - - name: Run stress tests with ASAN - run: | - LD_PRELOAD=$(gcc -print-file-name=libasan.so) python -m pytest -m 'stress_test' -c pytest.ini --capture=no -vv + path: dist/*.whl - test-windows-unit: - needs: build-windows + test-wheels-windows: + runs-on: windows-latest + needs: wheels-windows strategy: fail-fast: false matrix: - python-version: ["3.10", "3.11", "3.12", "3.13", "3.14"] - runs-on: windows-latest - timeout-minutes: 20 + include: + - python-version: "3.9" + python-tag: "39" + architecture: "AMD64" + - 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 unit tests + - name: Run tests run: | python -m pytest -m 'not integration_test' -m 'not stress_test' -c pytest.ini --capture=no -vv - test-windows-stress: - needs: build-windows + test-wheels-linux: + runs-on: ubuntu-latest + needs: wheels-linux strategy: fail-fast: false matrix: - python-version: ["3.10", "3.11", "3.12", "3.13", "3.14"] - runs-on: windows-latest - timeout-minutes: 60 + python-version: ["3.9", "3.10", "3.11", "3.12", "3.13", "3.14"] + 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 }} + name: wheels-linux-${{ 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 stress tests + pip install ./wheels/*.whl + - name: Run tests run: | - python -m pytest -m 'stress_test' -c pytest.ini --capture=no -vv + python -m pytest -m 'not integration_test' -m 'not stress_test' -c pytest.ini --capture=no -vv - summary: - needs: [test-linux-unit-asan, test-linux-stress-asan, test-windows-unit, test-windows-stress] + sdist: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - 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 -f .gitignore + git add . && git commit -m "Update meson files for build" + - run: python -m pip install build meson + - run: python -m build --sdist + - uses: actions/upload-artifact@v4 + with: + name: sdist + path: dist/*.tar.gz + + deploy-to-pypi: + name: Deploy to PyPI (Manual) runs-on: ubuntu-latest - if: always() + needs: [sdist, test-wheels-linux, test-wheels-windows] + if: github.event_name == 'workflow_dispatch' + environment: pypi-deployment + permissions: + id-token: write + contents: read steps: - - name: Test Summary + - name: Download all artifacts + uses: actions/download-artifact@v4 + with: + path: ./dist/ + + - name: Flatten artifact structure run: | - echo "## Test Results Summary" >> $GITHUB_STEP_SUMMARY - echo "" >> $GITHUB_STEP_SUMMARY - echo "All tests completed across all Python versions (3.10-3.14) on both Linux (with ASAN) and Windows." >> $GITHUB_STEP_SUMMARY - echo "" >> $GITHUB_STEP_SUMMARY - echo "- Linux Unit Tests: ${{ needs.test-linux-unit-asan.result }}" >> $GITHUB_STEP_SUMMARY - echo "- Linux Stress Tests: ${{ needs.test-linux-stress-asan.result }}" >> $GITHUB_STEP_SUMMARY - echo "- Windows Unit Tests: ${{ needs.test-windows-unit.result }}" >> $GITHUB_STEP_SUMMARY - echo "- Windows Stress Tests: ${{ needs.test-windows-stress.result }}" >> $GITHUB_STEP_SUMMARY + mkdir -p ./upload/ + find ./dist/ -name "*.whl" -exec cp {} ./upload/ \; + find ./dist/ -name "*.tar.gz" -exec cp {} ./upload/ \; + ls -la ./upload/ + + - name: Publish to PyPI + uses: pypa/gh-action-pypi-publish@release/v1 + with: + repository-url: https://nexus.dbzero.io/repository/dbzero_hosted/ + user: admin + password: ${{ secrets.PYPI_API_PASSWORD }} + packages-dir: ./upload/ + verbose: true + skip-existing: true + attestations: false diff --git a/.github/workflows/test-linux-wheel.yml b/.github/workflows/test-linux-wheel.yml index f9bb423b..f8f2cf3f 100644 --- a/.github/workflows/test-linux-wheel.yml +++ b/.github/workflows/test-linux-wheel.yml @@ -25,6 +25,7 @@ on: required: true type: choice options: + - '3.9' - '3.10' - '3.11' - '3.12' @@ -51,6 +52,8 @@ jobs: test-wheels-linux: runs-on: ubuntu-latest timeout-minutes: ${{ inputs.timeout-minutes }} + env: + REQUIREMENTS_FILE: ${{ inputs.python-version == '3.9' && 'requirements.3.9.txt' || 'requirements.txt' }} steps: - uses: actions/checkout@v4 @@ -68,7 +71,7 @@ jobs: - name: Install wheel and dependencies run: | pip install pytest - pip install -r requirements.txt + pip install -r $REQUIREMENTS_FILE pip install ./wheels/*.whl - name: Run tests diff --git a/.github/workflows/test-windows-wheel.yml b/.github/workflows/test-windows-wheel.yml index 21c1e72c..05c0e0f4 100644 --- a/.github/workflows/test-windows-wheel.yml +++ b/.github/workflows/test-windows-wheel.yml @@ -13,6 +13,7 @@ on: required: true type: choice options: + - '3.9' - '3.10' - '3.11' - '3.12' @@ -23,6 +24,8 @@ on: jobs: test-windows: runs-on: windows-latest + env: + REQUIREMENTS_FILE: ${{ inputs.python-version == '3.9' && 'requirements.3.9.txt' || 'requirements.txt' }} steps: - uses: actions/checkout@v4 @@ -40,7 +43,7 @@ jobs: - name: Install wheel and dependencies run: | pip install pytest - pip install -r requirements.txt + pip install -r $env:REQUIREMENTS_FILE Get-ChildItem -Path "./wheels/*.whl" | ForEach-Object { pip install $_.FullName } shell: powershell diff --git a/.github/workflows/test_all_versions.yml b/.github/workflows/test_all_versions.yml new file mode 100644 index 00000000..e40d92b6 --- /dev/null +++ b/.github/workflows/test_all_versions.yml @@ -0,0 +1,236 @@ +name: Build and Deploy Packages +on: + push: + tags: + - 'v[0-9]*' + - feature/ci_test + 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" + + + + 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" + + - 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 + strategy: + fail-fast: false + matrix: + python-version: ["3.9", "3.10", "3.11", "3.12", "3.13", "3.14"] + 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 + 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-windows: + runs-on: windows-latest + needs: wheels-windows + strategy: + fail-fast: false + matrix: + include: + - python-version: "3.9" + python-tag: "39" + architecture: "AMD64" + - 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" + env: + REQUIREMENTS_FILE: ${{ matrix.python-version == '3.9' && 'requirements.3.9.txt' || 'requirements.txt' }} + 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 $env:REQUIREMENTS_FILE + 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 + needs: wheels-linux + strategy: + fail-fast: false + matrix: + python-version: ["3.9", "3.10", "3.11", "3.12", "3.13", "3.14"] + env: + REQUIREMENTS_FILE: ${{ matrix.python-version == '3.9' && 'requirements.3.9.txt' || 'requirements.txt' }} + + 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_FILE + pip install ./wheels/*.whl + - name: Run tests + run: | + python -m pytest -m 'not integration_test' -m 'not stress_test' -c pytest.ini --capture=no -vv + + sdist: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - 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 -f .gitignore + git add . && git commit -m "Update meson files for build" + - run: python -m pip install build meson + - run: python -m build --sdist + - uses: actions/upload-artifact@v4 + with: + name: sdist + path: dist/*.tar.gz + + deploy-to-pypi: + name: Deploy to PyPI (Manual) + runs-on: ubuntu-latest + needs: [sdist, test-wheels-linux, test-wheels-windows] + if: github.event_name == 'workflow_dispatch' + environment: pypi-deployment + permissions: + id-token: write + contents: read + steps: + - name: Download all artifacts + uses: actions/download-artifact@v4 + with: + path: ./dist/ + + - name: Flatten artifact structure + run: | + mkdir -p ./upload/ + find ./dist/ -name "*.whl" -exec cp {} ./upload/ \; + find ./dist/ -name "*.tar.gz" -exec cp {} ./upload/ \; + ls -la ./upload/ + + - name: Publish to PyPI + uses: pypa/gh-action-pypi-publish@release/v1 + with: + repository-url: https://nexus.dbzero.io/repository/dbzero_hosted/ + user: admin + password: ${{ secrets.PYPI_API_PASSWORD }} + packages-dir: ./upload/ + verbose: true + skip-existing: true + attestations: false diff --git a/Dockerfile-python-308 b/Dockerfile-python-308 new file mode 100644 index 00000000..1f2658fb --- /dev/null +++ b/Dockerfile-python-308 @@ -0,0 +1,40 @@ +FROM python:3.8-bullseye +# Install dependencies and clean up +RUN apt-get update && apt-get install -y \ + cmake \ + psmisc \ + python3-pip \ + python3-dbg \ + gdb \ + screen \ + rsync \ + meson \ + ninja-build \ + python3-venv \ + gettext-base \ + valgrind \ + && apt-get clean \ + && rm -rf /var/lib/apt/lists/* + +# Install Python packages +RUN pip3 install --break-system-packages --no-cache-dir build + +RUN ulimit -c unlimited +# RUN mkdir -p "$(cat /proc/sys/kernel/core_pattern | sed 's/%.*//')" +# RUN chmod 777 "$(cat /proc/sys/kernel/core_pattern | sed 's/%.*//')" + +# Copy application files and install Python requirements +COPY requirements.3.8.txt /usr/src/dbzero/ +RUN pip3 install --break-system-packages --no-cache-dir -r /usr/src/dbzero/requirements.3.8.txt --upgrade + +COPY . /usr/src/dbzero +WORKDIR /usr/src/dbzero + +# Build and install +RUN python3 scripts/generate_meson.py ./src/dbzero/ core +RUN python3 scripts/generate_meson_tests.py tests/ +#RUN ./build.sh +# WORKDIR /usr/src/dbzero/build/debug/ +# RUN meson install + +#WORKDIR /usr/src/dbzero diff --git a/Dockerfile-python-309 b/Dockerfile-python-309 new file mode 100644 index 00000000..d575e810 --- /dev/null +++ b/Dockerfile-python-309 @@ -0,0 +1,40 @@ +FROM python:3.9-bullseye +# Install dependencies and clean up +RUN apt-get update && apt-get install -y \ + cmake \ + psmisc \ + python3-pip \ + python3-dbg \ + gdb \ + screen \ + rsync \ + meson \ + ninja-build \ + python3-venv \ + gettext-base \ + valgrind \ + && apt-get clean \ + && rm -rf /var/lib/apt/lists/* + +# Install Python packages +RUN pip3 install --break-system-packages --no-cache-dir build + +RUN ulimit -c unlimited +# RUN mkdir -p "$(cat /proc/sys/kernel/core_pattern | sed 's/%.*//')" +# RUN chmod 777 "$(cat /proc/sys/kernel/core_pattern | sed 's/%.*//')" + +# Copy application files and install Python requirements +COPY requirements.3.9.txt /usr/src/dbzero/ +RUN pip3 install --break-system-packages --no-cache-dir -r /usr/src/dbzero/requirements.3.9.txt --upgrade + +COPY . /usr/src/dbzero +WORKDIR /usr/src/dbzero + +# Build and install +RUN python3 scripts/generate_meson.py ./src/dbzero/ core +RUN python3 scripts/generate_meson_tests.py tests/ +#RUN ./build.sh +# WORKDIR /usr/src/dbzero/build/debug/ +# RUN meson install + +#WORKDIR /usr/src/dbzero diff --git a/dbzero/dbzero/locked.py b/dbzero/dbzero/locked.py index dfca946b..dbb263d5 100644 --- a/dbzero/dbzero/locked.py +++ b/dbzero/dbzero/locked.py @@ -3,7 +3,7 @@ from .dbzero import begin_locked, _async_wait, get_config, commit -def async_wait(prefix: str, state_num: int) -> asyncio.Future[None]: +def async_wait(prefix: str, state_num: int) -> asyncio.Future: """Pause an asyncio coroutine until a specific data prefix reaches a target state number. Async variant of `dbzero.wait` function, suitable for use in coroutines. diff --git a/dbzero/setup.py b/dbzero/setup.py index 4f5276c7..f550af7d 100644 --- a/dbzero/setup.py +++ b/dbzero/setup.py @@ -10,5 +10,5 @@ version='0.1.0', description='DBZero community edition', packages=['dbzero'], - python_requires='>=3.10', + python_requires='>=3.8', ) diff --git a/pyproject.toml b/pyproject.toml index 5d14d853..620fc2a4 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.10' +requires-python = '>=3.8' license = {file = 'LICENSE.txt'} authors = [ ] diff --git a/python_tests/test_bytearray.py b/python_tests/test_bytearray.py index 3587b822..321714be 100644 --- a/python_tests/test_bytearray.py +++ b/python_tests/test_bytearray.py @@ -1,4 +1,6 @@ import dbzero as db0 +import pytest +import sys from .memo_test_types import MemoTestClass @@ -51,7 +53,9 @@ def test_count(db0_fixture): assert bytearray_2.count(b'abc') == 2 assert bytearray_2.count(db0.bytearray(b'abc')) == 2 +# only Python 3.9+ +@pytest.mark.skipif(sys.version_info < (3, 9), reason="requires python3.9 or higher") def test_removeprefix(db0_fixture): bytearray_1 = db0.bytearray(b'abc') assert bytearray_1.removeprefix(b'ab') == db0.bytearray(b'c') @@ -59,6 +63,7 @@ def test_removeprefix(db0_fixture): assert bytearray_1.removeprefix(b'abc') == db0.bytearray(b'') +@pytest.mark.skipif(sys.version_info < (3, 9), reason="requires python3.9 or higher") def test_removesuffix(db0_fixture): bytearray_1 = db0.bytearray(b'abc') assert bytearray_1.removesuffix(b'ab') == db0.bytearray(b'abc') diff --git a/python_tests/test_issues_6.py b/python_tests/test_issues_6.py index a6b278f3..53dbccdb 100644 --- a/python_tests/test_issues_6.py +++ b/python_tests/test_issues_6.py @@ -71,7 +71,7 @@ def get_client_id_tags(self): return client_id_str.zfill(3) return [client_id_str[:3], client_id_str[-3:]] - def get_tags(self) -> Iterator[str|object]: + def get_tags(self) -> Iterator: yield from yield_tags(self.first_name) yield from yield_tags(self.last_name) yield from yield_tags(self.email) diff --git a/requirements.3.8.txt b/requirements.3.8.txt new file mode 100644 index 00000000..df8799ee --- /dev/null +++ b/requirements.3.8.txt @@ -0,0 +1,7 @@ +pytest==8.3.5 +pytest-asyncio==0.24.0 +build==0.10.0 +meson==1.9.1 +meson-python==0.18.0 +fasteners==0.19 +psutil==7.0.0 diff --git a/requirements.3.9.txt b/requirements.3.9.txt new file mode 100644 index 00000000..c9d02ac1 --- /dev/null +++ b/requirements.3.9.txt @@ -0,0 +1,7 @@ +pytest==8.4.2 +pytest-asyncio==1.2.0 +build==0.10.0 +meson==1.9.1 +meson-python==0.18.0 +fasteners==0.19 +psutil==7.0.0 diff --git a/src/dbzero/bindings/python/collections/PyByteArray.cpp b/src/dbzero/bindings/python/collections/PyByteArray.cpp index bd90927d..2f78d3e1 100644 --- a/src/dbzero/bindings/python/collections/PyByteArray.cpp +++ b/src/dbzero/bindings/python/collections/PyByteArray.cpp @@ -40,12 +40,19 @@ namespace db0::python { auto py_obj = Py_OWN(asPyObject(object_inst)); auto function = Py_OWN(PyObject_GetAttrString(*py_obj, name)); + if (!function) { + PyErr_Format(PyExc_AttributeError, "ByteArray object has no attribute '%s'", name); + return NULL; + } return PyObject_Call(*function, args, kwargs); } PyObject *ByteArray_CallMethod(const char * name, ByteArrayObject *object_inst, PyObject* args, PyObject* kwargs) { auto py_obj = callMethod(name, object_inst, args, kwargs); + if (!py_obj) { + return NULL; + } auto bytearray_object = ByteArrayObject_new(&ByteArrayObjectType, NULL, NULL); db0::FixtureLock lock(PyToolkit::getPyWorkspace().getWorkspace().getCurrentFixture()); makeByteArrayFromPyBytes(*lock, bytearray_object, py_obj);