Skip to content

Commit

Permalink
Merge pull request #33 from ZhymabekRoman/pypi
Browse files Browse the repository at this point in the history
CI: Python build
  • Loading branch information
phiresky committed May 7, 2024
2 parents 6e05828 + 5aaeb60 commit a484d2e
Show file tree
Hide file tree
Showing 3 changed files with 106 additions and 0 deletions.
80 changes: 80 additions & 0 deletions .github/workflows/pypi_release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
name: Publish to PyPI

on:
push:

jobs:
build_wheels:
name: Build wheels on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-20.04, windows-2019, macos-11]
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"
CIBW_SKIP: cp39-musllinux_i686 cp310-musllinux_i686 cp311-musllinux_i686 cp312-musllinux_i686 # Can't install Rust on musl based Linux systems
CIBW_ENVIRONMENT: 'PATH="$PATH:$HOME/.cargo/bin"'

steps:
- uses: actions/checkout@v4

- name: Set up QEMU
if: runner.os == 'Linux'
uses: docker/setup-qemu-action@v1
with:
platforms: all

- name: Build wheels
uses: pypa/cibuildwheel@v2.16.2
with:
package-dir: ./python
output-dir: ./python/wheelhouse

- uses: actions/upload-artifact@v3
with:
name: wheel-${{ runner.os }}
path: ./python/wheelhouse/*.whl

build_sdist:
name: Build source distribution
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- 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.9"

- 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: sdist-${{ runner.os }}
path: python/dist/*.tar.gz

# release:
# needs: [build_wheels, build_sdist]
# runs-on: ubuntu-latest
# steps:
# - uses: actions/download-artifact@v2
# with:
# name: artifact
# path: python/dist

# - uses: pypa/gh-action-pypi-publish@release/v1
# with:
# packages-dir: python/dist/
# user: __token__
# password: ${{ secrets.PYPI_API_TOKEN }}
22 changes: 22 additions & 0 deletions python/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# sqlite-zstd
Extension for sqlite that provides transparent dictionary-based row-level compression for sqlite. This basically allows you to compress entries in a sqlite database almost as well as if you were compressing the whole DB file, but while retaining random access.

See also the announcement blog post for some motivation, benchmarks and ramblings: https://phiresky.github.io/blog/2022/sqlite-zstd

Depending on the data, this can reduce the size of the database by 80% while keeping performance mostly the same (or even improving it, since the data to be read from disk is smaller).

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
```bash
pip install sqlite-zstd
```

## Usage
```python
import sqlite3
import sqlite_zstd

conn = sqlite3.connect(':memory:')
sqlite_zstd.load(conn)
```
4 changes: 4 additions & 0 deletions python/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ name = "sqlite-zstd"
requires-python = ">=3.9"
dynamic = ["version"]

[project.readme]
file = "README.md"
content-type = "text/markdown"

[project.entry-points.datasette]
sqlite_zstd = "sqlite_zstd.datasette"

Expand Down

0 comments on commit a484d2e

Please sign in to comment.