-
-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rust file-like objects and accept bytes/bytearray/numpy (#45)
Adds support for all de/compression variants to accept bytes/bytearray/numpy/cramjam.File/cramjam.Buffer objects. Additionally, the de/compress_into entry points, can be mix-matched to allow any combination of input and output types.
- Loading branch information
1 parent
37306e4
commit 16b78f5
Showing
15 changed files
with
1,098 additions
and
356 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,9 +26,9 @@ jobs: | |
profile: minimal | ||
default: true | ||
- name: Build | ||
run: cargo build | ||
run: cargo build --release | ||
- name: Tests | ||
run: cargo test | ||
run: cargo test --no-default-features --release | ||
- name: Install maturin | ||
run: pip install maturin | ||
- name: Build wheels - x86_64 | ||
|
@@ -78,10 +78,10 @@ jobs: | |
default: true | ||
- name: Build | ||
if: matrix.platform.python-architecture == 'x64' | ||
run: cargo build | ||
run: cargo build --release | ||
- name: Tests | ||
if: matrix.platform.python-architecture == 'x64' | ||
run: cargo test | ||
run: cargo test --no-default-features --release | ||
- name: Install maturin | ||
run: pip install maturin | ||
- name: Build wheels | ||
|
@@ -115,9 +115,9 @@ jobs: | |
profile: minimal | ||
default: true | ||
- name: Build | ||
run: cargo build | ||
run: cargo build --release | ||
- name: Tests | ||
run: cargo test | ||
run: cargo test --no-default-features | ||
- uses: actions/setup-python@v2 | ||
with: | ||
python-version: 3.6 | ||
|
@@ -129,7 +129,6 @@ jobs: | |
pip install maturin | ||
maturin build -i python --release --out dist --no-sdist --target ${{ matrix.platform.target }} --manylinux ${{ matrix.platform.manylinux }} | ||
' > build-wheel.sh | ||
chmod +x build-wheel.sh | ||
docker run --rm -v "$PWD":/io -w /io quay.io/pypa/manylinux${{ matrix.platform.manylinux }}_${{ matrix.platform.arch }} bash build-wheel.sh | ||
- name: Python UnitTest | ||
|
@@ -145,7 +144,7 @@ jobs: | |
path: dist | ||
|
||
linux-cross: | ||
runs-on: ubuntu-16.04 | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
platform: [ | ||
|
@@ -157,32 +156,15 @@ jobs: | |
- uses: actions/setup-python@v2 | ||
with: | ||
python-version: 3.6 | ||
- name: Install Rust toolchain | ||
uses: actions-rs/toolchain@v1 | ||
with: | ||
toolchain: stable | ||
target: ${{ matrix.platform.target }} | ||
profile: minimal | ||
default: true | ||
- name: Install aarch64 cross compiler | ||
if: matrix.platform.target == 'aarch64-unknown-linux-gnu' | ||
run: | | ||
sudo apt-get install -y gcc-aarch64-linux-gnu libc6-arm64-cross libc6-dev-arm64-cross | ||
echo "TARGET_CC=aarch64-linux-gnu-gcc" >> "$GITHUB_ENV" | ||
echo "TARGET_CXX=aarch64-linux-gnu-cpp" >> "$GITHUB_ENV" | ||
echo "CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER=aarch64-linux-gnu-gcc" >> "$GITHUB_ENV" | ||
- name: Install armv7 cross compiler | ||
if: matrix.platform.target == 'armv7-unknown-linux-gnueabihf' | ||
run: | | ||
sudo apt-get install -y gcc-arm-linux-gnueabihf libc6-armhf-cross libc6-dev-armhf-cross | ||
echo "TARGET_CC=arm-linux-gnueabihf-gcc" >> "$GITHUB_ENV" | ||
echo "TARGET_CXX=arm-linux-gnueabihf-cpp" >> "$GITHUB_ENV" | ||
echo "CARGO_TARGET_ARMV7_UNKNOWN_LINUX_GNUEABIHF_LINKER=arm-linux-gnueabihf-gcc" >> "$GITHUB_ENV" | ||
- name: Install maturin | ||
run: pip install maturin | ||
- name: Build Wheels | ||
run: | | ||
maturin build -i python --release --out dist --no-sdist --target ${{ matrix.platform.target }} --manylinux ${{ matrix.platform.manylinux }} --cargo-extra-args="--no-default-features" --cargo-extra-args="--features=abi3" | ||
echo 'curl -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain stable | ||
source ~/.cargo/env | ||
rustup target add ${{ matrix.platform.target }} | ||
maturin build -i python --release --out dist --no-sdist --target ${{ matrix.platform.target }} --manylinux ${{ matrix.platform.manylinux }} --cargo-extra-args="--no-default-features" --cargo-extra-args="--features=abi3,extension-module" # disable mimallocator | ||
' > build-wheel.sh | ||
docker run --rm -v "$PWD":/io -w /io messense/manylinux2014-cross:${{ matrix.platform.arch }} bash build-wheel.sh | ||
- uses: uraimo/[email protected] | ||
name: Install built wheel | ||
with: | ||
|
@@ -220,9 +202,9 @@ jobs: | |
profile: minimal | ||
default: true | ||
- name: Build | ||
run: cargo build | ||
run: cargo build --release | ||
- name: Tests | ||
run: cargo test | ||
run: cargo test --no-default-features | ||
- uses: actions/setup-python@v2 | ||
with: | ||
python-version: pypy-3.6 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
[package] | ||
name = "cramjam" | ||
version = "2.0.2" | ||
version = "2.1.0" | ||
authors = ["Miles Granger <[email protected]>"] | ||
edition = "2018" | ||
license-file = "LICENSE" | ||
|
@@ -12,20 +12,21 @@ readme = "README.md" | |
crate-type = ["cdylib"] | ||
|
||
[features] | ||
default = ["abi3", "mimallocator"] | ||
default = ["abi3", "mimallocator", "extension-module"] | ||
abi3 = ["pyo3/abi3-py36"] | ||
mimallocator = ["mimalloc"] | ||
extension-module = ["pyo3/extension-module"] | ||
|
||
[profile.release] | ||
lto = "fat" | ||
codegen-units = 1 | ||
opt-level = 3 | ||
|
||
[dependencies] | ||
pyo3 = { version = "0.13.2", features = ["extension-module"] } | ||
pyo3 = { version = "0.13.2", default-features = false, features = ["macros"] } | ||
snap = "^1" | ||
brotli2 = "^0.3" | ||
lz-fear = "0.1.1" | ||
lz4 = "^1" | ||
flate2 = "^1" | ||
zstd = "0.6.0+zstd.1.4.8" | ||
numpy = "0.13.0" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.