diff --git a/.github/workflows/pypi_release.yml b/.github/workflows/pypi_release.yml index 9176272..0d446a2 100644 --- a/.github/workflows/pypi_release.yml +++ b/.github/workflows/pypi_release.yml @@ -1,16 +1,16 @@ +--- name: Publish to PyPI on: - workflow_dispatch: + workflow_dispatch: jobs: build_wheels: - name: Build wheels on ${{ matrix.os }} for ${{ matrix.cibw_python }} on ${{ matrix.cibw_arch }} + name: Build wheels on ${{ matrix.os }} runs-on: ${{ matrix.os }} strategy: matrix: - os: [ubuntu-latest] - cibw_arch: ["x86_64", "aarch64"] + os: [ubuntu-latest, ubuntu-24.04-arm] env: CIBW_BEFORE_ALL_LINUX: "curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- --default-toolchain stable -y" CIBW_BUILD_VERBOSITY: "1" @@ -19,68 +19,35 @@ jobs: steps: - uses: actions/checkout@v4 - - name: Set up QEMU - if: matrix.os == 'ubuntu-latest' && matrix.cibw_arch == 'aarch64' - uses: docker/setup-qemu-action@68827325e0b33c7199eb31dd4e31fbe9023e06e3 # v3.0.0 - with: - platforms: arm64 - - name: Build wheels - uses: pypa/cibuildwheel@v2.16.2 + uses: pypa/cibuildwheel@v3.0 env: - CIBW_BUILD_VERBOSITY: 1 - CIBW_BUILD: ${{ matrix.cibw_python }} - CIBW_ARCHS: ${{ matrix.cibw_arch }} - CIBW_TEST_SKIP: "*universal2:arm64" + CIBW_BUILD: "cp313-*" with: - package-dir: ./python - output-dir: ./python/wheelhouse + package-dir: python + output-dir: python/wheelhouse - - uses: actions/upload-artifact@v3 + - uses: actions/upload-artifact@v4 with: - name: dist - path: ./python/wheelhouse/*.whl - - build_sdist: - name: Build source distribution - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 + name: cibw-wheels-${{ matrix.os }} + path: python/wheelhouse/*.whl - - name: Install rust - uses: actions-rs/toolchain@v1 - with: - toolchain: stable - profile: minimal - - - uses: actions/setup-python@v2 - name: Install Python - with: - python-version: "3.12" - - - name: Build sdist - run: | - python -m pip install setuptools-rust setuptools wheel - cd python/ - python setup.py sdist - - - uses: actions/upload-artifact@v2 - with: - name: dist - path: python/dist/*.tar.* - release: - needs: [build_wheels, build_sdist] + needs: [build_wheels] runs-on: ubuntu-latest + environment: + name: pypi + url: https://pypi.org/p/sqlite-zstd + permissions: + id-token: write + if: github.event_name == 'push' && github.ref_type == 'tag' steps: - - uses: actions/download-artifact@v3 + - uses: actions/download-artifact@v4 with: - name: dist - path: python/dist/ + pattern: cibw-* + path: dist + merge-multiple: true - - uses: pypa/gh-action-pypi-publish@v1.8.10 + - uses: pypa/gh-action-pypi-publish@release/v1 with: - repository-url: https://pypi.org/project/sqlite-zstd-build - user: __token__ - password: ${{ secrets.PYPI_API_TOKEN }} - packages-dir: python/dist + packages-dir: dist diff --git a/python/README.md b/python/README.md index ac796f2..b20bdcd 100644 --- a/python/README.md +++ b/python/README.md @@ -8,9 +8,15 @@ Depending on the data, this can reduce the size of the database by 80% while kee Note that a compression VFS such as https://github.com/mlin/sqlite_zstd_vfs might be suited better depending on the use case. That has very different tradeoffs and capabilities, but the end result is similar. ## Install + +From PyPI (if published): ```bash pip install sqlite-zstd ``` +Local: +```bash +pip install . +``` ## Usage ```python diff --git a/python/pyproject.toml b/python/pyproject.toml index ff915b9..b22d00a 100644 --- a/python/pyproject.toml +++ b/python/pyproject.toml @@ -1,5 +1,5 @@ [build-system] -requires = ["setuptools>=61.2", "setuptools_scm>=6.2", "setuptools_rust"] +requires = ["setuptools>=64", "setuptools-scm>=8", "setuptools-rust"] build-backend = "setuptools.build_meta" [project] @@ -19,3 +19,12 @@ sqlite_zstd = "lib" [tool.setuptools_scm] root = ".." + +[[tool.setuptools-rust.ext-modules]] +target = "sqlite_zstd.libsqlite_zstd" +path = "../Cargo.toml" +binding = "NoBinding" +features = ["build_extension"] + +[tool.distutils.bdist_wheel] +py_limited_api = "cp39" diff --git a/python/setup.py b/python/setup.py deleted file mode 100644 index b9d48e7..0000000 --- a/python/setup.py +++ /dev/null @@ -1,11 +0,0 @@ -from setuptools import setup -from setuptools_rust import Binding, RustExtension - -setup( - rust_extensions=[RustExtension('sqlite_zstd.libsqlite_zstd', - path='../Cargo.toml', - binding=Binding.NoBinding, - features=['build_extension'], - py_limited_api=True, - )], -)