Skip to content
This repository was archived by the owner on Sep 19, 2023. It is now read-only.

Commit 7ae0187

Browse files
wbarnhamaxibortwmhtAustEcon
authored
Integrate cibuildwheel commands into pyproject.toml (#13)
* Change to relative imports and attempt to make a windows wheel * Fixes * Drop zstd * Last attempt * commit initial progress for supporting windows * update pyproject.toml * update pyproject.toml and revert options.pxd * simplify build workflows, only use cibuildwheel from hereon * fix typo * update cibuildwheel name * go to rocksdb 6.14.6 Co-authored-by: maxibor <[email protected]> Co-authored-by: Ming-Hsuan-Tu <[email protected]> Co-authored-by: AustEcon <[email protected]>
1 parent 91e60f2 commit 7ae0187

File tree

11 files changed

+94
-61
lines changed

11 files changed

+94
-61
lines changed

.github/workflows/build.yml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jobs:
1919
strategy:
2020
matrix:
2121
os: [ubuntu-latest]
22-
rocksdb_ver: ['v6.29.3', 'v6.25.3', 'v6.11.4']
22+
rocksdb_ver: ['v6.29.3', 'v6.25.3', 'v6.14.6']
2323

2424
steps:
2525
- uses: actions/cache@v2
@@ -53,11 +53,13 @@ jobs:
5353
matrix:
5454
os: [ubuntu-latest]
5555
py_ver: ['3.7', '3.8', '3.9', '3.10', '3.11']
56-
rocksdb_ver: ['v6.29.3', 'v6.25.3', 'v6.11.4']
56+
rocksdb_ver: ['v6.29.3', 'v6.25.3', 'v6.14.6']
5757

5858
steps:
59-
- uses: actions/checkout@v2
59+
- uses: actions/checkout@v3
6060
name: 'Checkout source repository'
61+
with:
62+
fetch-depth: 0
6163

6264
- uses: actions/setup-python@v4
6365
name: 'Set up Python ${{ matrix.py_ver }}'

.github/workflows/debian.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,12 @@ jobs:
1616
strategy:
1717
fail-fast: false
1818
matrix:
19-
# dist: [bullseye, bookworm]
2019
dist: [bullseye]
2120
steps:
22-
- uses: actions/checkout@v2
21+
- uses: actions/checkout@v3
22+
name: 'Checkout source repository'
23+
with:
24+
fetch-depth: 0
2325

2426
- name: Install build-dependencies
2527
# TODO(dato): find out why setup.py links to compression libraries

.github/workflows/dist.yml

Lines changed: 12 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,25 @@
11
# vim:ts=2:sw=2:et:ai:sts=2
2-
name: 'Build distribution'
2+
name: 'Build and test wheels for release'
33

44
on:
5-
# Only run when release is created in the master branch
65
release:
76
types: [created]
87
branches:
98
- 'master'
109

1110
jobs:
1211
build_wheels:
13-
name: 'Build wheels'
12+
name: 'Build and test wheels'
1413
runs-on: ${{ matrix.os }}
15-
env:
16-
LIBROCKSDB_PATH: /opt/rocksdb-${{ matrix.rocksdb_ver }}
1714
strategy:
1815
matrix:
1916
os: [ubuntu-latest]
20-
rocksdb_ver: ['v6.14.6']
2117

2218
steps:
23-
- uses: actions/checkout@v2
19+
- uses: actions/checkout@v3
2420
name: 'Checkout source repository'
21+
with:
22+
fetch-depth: 0
2523

2624
- uses: actions/setup-python@v4
2725
name: 'Set up Python 3.11'
@@ -32,47 +30,25 @@ jobs:
3230
run: |
3331
python3 -m pip install cibuildwheel
3432
35-
- name: 'Build wheels'
33+
- name: 'Build and test wheels'
3634
run: |
3735
python3 -m cibuildwheel --output-dir dist
38-
env:
39-
CIBW_MANYLINUX_X86_64_IMAGE: 'manylinux2014'
40-
CIBW_ARCHS: auto64
41-
CIBW_BUILD: 'cp3*'
42-
CIBW_SKIP: '*-musllinux_*'
43-
# Install python package and test-deps.
44-
CIBW_TEST_REQUIRES: '.[test] pytest'
45-
# Use `--pyargs` to interpret parameter as module to import, not as a
46-
# path, and do not use `python3 -m pytest`. This way we prevent
47-
# importing the module from the current directory instead of the
48-
# installed package, and failing when it cannot find the shared
49-
# library.
50-
CIBW_TEST_COMMAND: 'pytest --pyargs rocksdb'
51-
# Avoid re-building the C library in every iteration by testing for
52-
# the build directory.
53-
CIBW_BEFORE_BUILD: >
54-
yum install -y bzip2-devel lz4-devel snappy-devel zlib-devel
55-
python3-Cython && (
56-
test -d ${{ env.LIBROCKSDB_PATH }} || (
57-
git clone https://github.com/facebook/rocksdb --depth 1 --branch ${{ matrix.rocksdb_ver }} ${{ env.LIBROCKSDB_PATH }} &&
58-
cd ${{ env.LIBROCKSDB_PATH }} &&
59-
CXXFLAGS='-flto -Os -s' PORTABLE=1 make shared_lib -j 4
60-
)) &&
61-
pushd ${{ env.LIBROCKSDB_PATH }} &&
62-
make install-shared &&
63-
ldconfig &&
64-
popd
36+
6537
- uses: actions/upload-artifact@v2
6638
name: 'Upload build artifacts'
39+
if: github.event_name == 'release' && github.event.action == 'created'
6740
with:
6841
path: 'dist/*.whl'
6942

7043
build_sdist:
7144
name: 'Build source distribution'
45+
if: github.event_name == 'release' && github.event.action == 'created'
7246
runs-on: 'ubuntu-latest'
7347
steps:
74-
- uses: actions/checkout@v2
48+
- uses: actions/checkout@v3
7549
name: 'Checkout source repository'
50+
with:
51+
fetch-depth: 0
7652

7753
- uses: actions/setup-python@v4
7854
name: 'Set up Python 3.10'
@@ -89,8 +65,6 @@ jobs:
8965
with:
9066
path: 'dist/*.tar.gz'
9167

92-
93-
9468
upload_pypi:
9569
name: 'Upload packages'
9670
needs: ['build_wheels', 'build_sdist']

.github/workflows/gh-pages.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
name: Pages
22

33
on:
4-
push:
4+
release:
5+
types: [created]
56
branches:
6-
- master
7-
- create-gh-pages
7+
- 'master'
88

99
jobs:
1010
build:

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,6 @@ docs/_build
88
*.so
99
__pycache__
1010
rocksdb/_rocksdb.cpp
11+
*idea
12+
*html
1113

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM ubuntu:20.04
1+
FROM ubuntu:22.04
22
ENV SRC /home/tester/src
33
ENV DEBIAN_FRONTEND noninteractive
44

docs/index.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ Python bindings to the C++ interface of http://rocksdb.org/ using cython::
1111
db.put(b"a", b"b")
1212
print(db.get(b"a"))
1313

14-
Tested with python3.8, python3.9, python3.10, and RocksDB version 6.11.4.
14+
Tested with python3.8, python3.9, python3.10, and RocksDB version 6.14.6.
1515

1616
.. toctree::
1717
:maxdepth: 2

docs/installation.rst

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ Installing
22
==========
33
.. highlight:: bash
44

5-
65
With distro package and pypi
76
****************************
87

pyproject.toml

Lines changed: 50 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,52 @@
11
[build-system]
2-
requires = ["setuptools", "wheel", "cython", "pkgconfig"]
2+
requires = ["setuptools", "wheel", "cython", "pkgconfig", "setuptools-scm"]
33
build-backend = "setuptools.build_meta"
4+
5+
[tool.cibuildwheel]
6+
build-frontend = "build"
7+
build = "cp3*"
8+
skip = ["*-win32", "*-manylinux_i686", "*-musllinux_*"]
9+
archs = ["auto64"]
10+
test-requires = ['.[test] pytest']
11+
test-command = ['pytest --pyargs rocksdb']
12+
13+
manylinux-x86_64-image = "manylinux2014"
14+
15+
environment = {ROCKSDB_VER="v6.14.6", LIBROCKSDB_PATH="/opt/rocksdb-$ROCKSDB_VER"}
16+
17+
[tool.cibuildwheel.linux]
18+
# Avoid re-building the C library in every iteration by testing for the build directory.
19+
before-build = "yum install -y bzip2-devel lz4-devel snappy-devel zlib-devel python3-Cython && (test -d $LIBROCKSDB_PATH || ( git clone https://github.com/facebook/rocksdb --depth 1 --branch $ROCKSDB_VER $LIBROCKSDB_PATH && cd $LIBROCKSDB_PATH && CXXFLAGS='-flto -Os -s' PORTABLE=1 make shared_lib -j 4 )) && pushd $LIBROCKSDB_PATH && make install-shared && ldconfig && popd"
20+
21+
[tool.cibuildwheel.macos]
22+
environment = {ROCKSDB_VER="v6.14.6", LIBROCKSDB_PATH="/usr/local/opt/rocksdb-$ROCKSDB_VER", REPAIR_LIBRARY_PATH="$LIBROCKS_DB_PATH"}
23+
before-build = [
24+
"brew install bzip2 lz4 snappy zlib cython git",
25+
'export LDFLAGS="-L/usr/local/opt/bzip2/lib"',
26+
'export CPPFLAGS="-I/usr/local/opt/bzip2/include"',
27+
"(test -d $LIBROCKSDB_PATH || ( git clone https://github.com/facebook/rocksdb --depth 1 --branch $ROCKSDB_VER $LIBROCKSDB_PATH && cd $LIBROCKSDB_PATH && CXXFLAGS='-flto -Os' PORTABLE=1 make shared_lib -j 4 )) && pushd $LIBROCKSDB_PATH && make install-shared && update_dyld_shared_cache && popd",
28+
"otool -L librocksdb.6.14.dylib",
29+
]
30+
repair-wheel-command = """\
31+
DYLD_LIBRARY_PATH=$REPAIR_LIBRARY_PATH delocate-listdeps {wheel} &&
32+
DYLD_LIBRARY_PATH=$REPAIR_LIBRARY_PATH delocate-wheel \
33+
--require-archs {delocate_archs} -w {dest_dir} -v {wheel}\
34+
"""
35+
36+
[tool.cibuildwheel.windows]
37+
before-build = [
38+
"vcpkg install zlib:x64-windows",
39+
"vcpkg install bzip2:x64-windows",
40+
"vcpkg install lz4:x64-windows",
41+
"vcpkg install snappy:x64-windows",
42+
"vcpkg install rocksdb[bzip2,zlib,lz4,snappy]:x64-windows --recurse",
43+
'echo $(python --version) && python -m pip install cython && python -m cython -3 --cplus --fast-fail --annotate rocksdb/_rocksdb.pyx && python ./setup.py build_ext --include-dirs=$(VCPKG_ROCKSDB_INCLUDE_PATH) --library-dirs=$(VCPKG_ROCKSDB_LIB_PATH) --libraries"=shlwapi rpcrt4"',
44+
]
45+
46+
[tool.cibuildwheel.windows.environment]
47+
VCPKG_ROCKSDB_INCLUDE_PATH= "C:\\vcpkg\\installed\\x64-windows\\include\\"
48+
VCPKG_ROCKSDB_LIB_PATH= "C:\\vcpkg\\installed\\x64-windows\\lib\\"
49+
vcpkgVersion= "2020.06.15"
50+
vcpkgInstallParamPath= '$(Build.SourcesDirectory)\\.azure-pipelines\\vcpkg'
51+
vcpkgBinariesPath= 'C:\\Users\\VssAdministrator\\AppData\\Local\\vcpkg\\archives'
52+
"vcpkg.arch"= 'x64'

setup.cfg

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
[metadata]
22
name = rocksdb
3-
version = 0.9.1
4-
description = Python bindings for RocksDB
3+
description = Python bindings for RocksDB, primarily for use with Faust
54
long_description = file: README.rst
65
long_description_content_type = text/x-rst
76
url = https://github.com/faust-streaming/python-rocksdb

0 commit comments

Comments
 (0)