Skip to content

Commit a484d2e

Browse files
authored
Merge pull request #33 from ZhymabekRoman/pypi
CI: Python build
2 parents 6e05828 + 5aaeb60 commit a484d2e

File tree

3 files changed

+106
-0
lines changed

3 files changed

+106
-0
lines changed

.github/workflows/pypi_release.yml

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
name: Publish to PyPI
2+
3+
on:
4+
push:
5+
6+
jobs:
7+
build_wheels:
8+
name: Build wheels on ${{ matrix.os }}
9+
runs-on: ${{ matrix.os }}
10+
strategy:
11+
matrix:
12+
os: [ubuntu-20.04, windows-2019, macos-11]
13+
env:
14+
CIBW_BEFORE_ALL_LINUX: "curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- --default-toolchain stable -y"
15+
CIBW_BUILD_VERBOSITY: "1"
16+
CIBW_SKIP: cp39-musllinux_i686 cp310-musllinux_i686 cp311-musllinux_i686 cp312-musllinux_i686 # Can't install Rust on musl based Linux systems
17+
CIBW_ENVIRONMENT: 'PATH="$PATH:$HOME/.cargo/bin"'
18+
19+
steps:
20+
- uses: actions/checkout@v4
21+
22+
- name: Set up QEMU
23+
if: runner.os == 'Linux'
24+
uses: docker/setup-qemu-action@v1
25+
with:
26+
platforms: all
27+
28+
- name: Build wheels
29+
uses: pypa/[email protected]
30+
with:
31+
package-dir: ./python
32+
output-dir: ./python/wheelhouse
33+
34+
- uses: actions/upload-artifact@v3
35+
with:
36+
name: wheel-${{ runner.os }}
37+
path: ./python/wheelhouse/*.whl
38+
39+
build_sdist:
40+
name: Build source distribution
41+
runs-on: ubuntu-latest
42+
steps:
43+
- uses: actions/checkout@v2
44+
45+
- name: Install rust
46+
uses: actions-rs/toolchain@v1
47+
with:
48+
toolchain: stable
49+
profile: minimal
50+
51+
- uses: actions/setup-python@v2
52+
name: Install Python
53+
with:
54+
python-version: "3.9"
55+
56+
- name: Build sdist
57+
run: |
58+
python -m pip install setuptools-rust setuptools wheel
59+
cd python/
60+
python setup.py sdist
61+
62+
- uses: actions/upload-artifact@v2
63+
with:
64+
name: sdist-${{ runner.os }}
65+
path: python/dist/*.tar.gz
66+
67+
# release:
68+
# needs: [build_wheels, build_sdist]
69+
# runs-on: ubuntu-latest
70+
# steps:
71+
# - uses: actions/download-artifact@v2
72+
# with:
73+
# name: artifact
74+
# path: python/dist
75+
76+
# - uses: pypa/gh-action-pypi-publish@release/v1
77+
# with:
78+
# packages-dir: python/dist/
79+
# user: __token__
80+
# password: ${{ secrets.PYPI_API_TOKEN }}

python/README.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# sqlite-zstd
2+
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.
3+
4+
See also the announcement blog post for some motivation, benchmarks and ramblings: https://phiresky.github.io/blog/2022/sqlite-zstd
5+
6+
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).
7+
8+
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.
9+
10+
## Install
11+
```bash
12+
pip install sqlite-zstd
13+
```
14+
15+
## Usage
16+
```python
17+
import sqlite3
18+
import sqlite_zstd
19+
20+
conn = sqlite3.connect(':memory:')
21+
sqlite_zstd.load(conn)
22+
```

python/pyproject.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ name = "sqlite-zstd"
77
requires-python = ">=3.9"
88
dynamic = ["version"]
99

10+
[project.readme]
11+
file = "README.md"
12+
content-type = "text/markdown"
13+
1014
[project.entry-points.datasette]
1115
sqlite_zstd = "sqlite_zstd.datasette"
1216

0 commit comments

Comments
 (0)