Skip to content

Commit

Permalink
Squashed 'src/bitshuffle/' content from commit a60471d3
Browse files Browse the repository at this point in the history
git-subtree-dir: src/bitshuffle
git-subtree-split: a60471d37a8cbbd8265dc8cfa83a9320abdcb590
  • Loading branch information
t20100 committed Nov 8, 2022
0 parents commit 3db00d4
Show file tree
Hide file tree
Showing 56 changed files with 10,936 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/flake8_cython.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[flake8]
filename=*.pyx,*.pxd
select=E302,E203,E111,E114,E221,E303,E128,E231,E126,E265,E305,E301,E127,E261,E271,E129,W291,E222,E241,E123,F403,C400,C401,C402,C403,C404,C405,C406,C407,C408,C409,C410,C411
show_source=True
3 changes: 3 additions & 0 deletions .github/workflows/flake8_python.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[flake8]
ignore=E501,E203,W503,E266
show_source=True
10 changes: 10 additions & 0 deletions .github/workflows/install_hdf5.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
HDF5_VERSION=$1

# Download and install HDF5 $HDF5_VERSION from source for building wheels
curl https://support.hdfgroup.org/ftp/HDF5/releases/hdf5-${HDF5_VERSION%.*}/hdf5-$HDF5_VERSION/src/hdf5-$HDF5_VERSION.tar.gz -O -s
tar -xzf hdf5-$HDF5_VERSION.tar.gz
cd hdf5-$HDF5_VERSION
./configure --prefix=/usr/local
make -j 2
make install
cd ..
32 changes: 32 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: bitshuffle-ci-build
on:
pull_request:
branches:
- master
push:
branches:
- master

jobs:

lint-code:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- name: Set up Python 3.10
uses: actions/setup-python@v2
with:
python-version: "3.10"

- name: Install pip dependencies
run: |
pip install black flake8
- name: Run flake8
run: |
flake8 --config $GITHUB_WORKSPACE/.github/workflows/flake8_python.cfg bitshuffle tests
flake8 --config $GITHUB_WORKSPACE/.github/workflows/flake8_cython.cfg bitshuffle tests
- name: Check code with black
run: black --check .
58 changes: 58 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: bitshuffle-ci-build
on:
pull_request:
branches:
- master
push:
branches:
- master

jobs:
run-tests:

strategy:
matrix:
python-version: ["3.6", "3.7", "3.10"]
os: [ubuntu-latest, macos-latest]
exclude:
- os: macos-latest
python-version: "3.6"

runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2

- name: Install apt dependencies
if: ${{ matrix.os == 'ubuntu-latest' }}
run: |
sudo apt-get install -y libhdf5-serial-dev hdf5-tools pkg-config
- name: Install homebrew dependencies
if: ${{ matrix.os == 'macos-latest' }}
run: |
brew install hdf5 pkg-config
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}

- name: Install h5py
if: ${{ matrix.os == 'macos-latest' }}
run: |
pip install h5py
- name: Install pip dependencies
run: |
pip install Cython
pip install -r requirements.txt
pip install pytest
# Pull in ZSTD repo
git submodule update --init
# Installing the plugin to arbitrary directory to check the install script.
python setup.py install --h5plugin --h5plugin-dir ~/hdf5/lib --zstd
- name: Run tests
run: pytest -v .
98 changes: 98 additions & 0 deletions .github/workflows/wheels.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
name: Build bitshuffle wheels and upload to PyPI

on:
workflow_dispatch:
release:
types:
- published

jobs:
build_wheels:
name: Build wheels on ${{ matrix.os }} and hdf5-${{ matrix.hdf5 }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
hdf5: ["1.10.7"]

steps:
# Checkout bitshuffle
- uses: actions/checkout@v2

# Build wheels for linux and x86 platforms
- name: Build wheels
uses: pypa/[email protected]
with:
output-dir: ./wheelhouse-hdf5-${{ matrix.hdf5}}
env:
CIBW_SKIP: "pp* *musllinux*"
CIBW_ARCHS_LINUX: "x86_64"
CIBW_BEFORE_ALL: |
chmod +x .github/workflows/install_hdf5.sh
.github/workflows/install_hdf5.sh ${{ matrix.hdf5 }}
git submodule update --init
CIBW_ENVIRONMENT: |
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib ENABLE_ZSTD=1
CIBW_TEST_REQUIRES: pytest
# Install different version of HDF5 for unit tests to ensure the
# wheels are independent of HDF5 installation
# CIBW_BEFORE_TEST: |
# chmod +x .github/workflows/install_hdf5.sh
# .github/workflows/install_hdf5.sh 1.8.11
# Run units tests but disable test_h5plugin.py
CIBW_TEST_COMMAND: pytest {package}/tests

# Package wheels and host on CI
- uses: actions/upload-artifact@v2
with:
path: ./wheelhouse-hdf5-${{ matrix.hdf5 }}/*.whl

build_sdist:
name: Build source distribution
strategy:
matrix:
python-version: ["3.8"]

runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- name: Install apt dependencies
run: |
sudo apt-get install -y libhdf5-serial-dev hdf5-tools pkg-config
- name: Install Python
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}

- name: Install pip dependencies
run: |
pip install -r requirements.txt
- name: Build sdist
run: python setup.py sdist

- uses: actions/upload-artifact@v2
with:
path: dist/*.tar.gz

# Upload to PyPI
upload_pypi:
needs: [build_wheels, build_sdist]
runs-on: ubuntu-latest
# Upload to PyPI on every tag
# if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags')
# Alternatively, to publish when a GitHub Release is created, use the following rule:
if: github.event_name == 'release' && github.event.action == 'published'
steps:
- uses: actions/download-artifact@v2
with:
name: artifact
path: dist

- uses: pypa/[email protected]
with:
user: __token__
password: ${{ secrets.pypi_password }}
# To test: repository_url: https://test.pypi.org/legacy/
79 changes: 79 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
## C

# Object files
*.o
*.ko
*.obj
*.elf

# Libraries
*.lib
*.a

# Shared objects (inc. Windows DLLs)
*.dll
*.so
*.so.*
*.dylib

# Executables
*.exe
*.out
*.app
*.i*86
*.x86_64
*.hex


## Python
*.py[cod]

# C extensions
*.so

# Packages
*.egg
*.egg-info
dist
build
eggs
parts
bin
var
sdist
develop-eggs
.installed.cfg
lib
lib64
__pycache__

# Installer logs
pip-log.txt

# Unit test / coverage reports
.coverage
.tox
nosetests.xml

# Translations
*.mo

# Mr Developer
.mr.developer.cfg
.project
.pydevproject

# Documentation builds
doc/_build
doc/generated

## Editor files and backups.
*.swp
*.swo

# Generated files
bitshuffle/ext.c
bitshuffle/h5.c

# ItelliJ
.idea
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "zstd"]
path = zstd
url = https://github.com/facebook/zstd
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
Bitshuffle - Filter for improving compression of typed binary data.

Copyright (c) 2014 Kiyoshi Masui ([email protected])

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
10 changes: 10 additions & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
recursive-include src *.h *.c
recursive-include bitshuffle *.pyx
recursive-include lz4 *.h *.c
recursive-include lzf *.h *.c
include setup.cfg.example
include LICENSE
include README.rst
include requirements.txt
exclude setup.cfg

Loading

0 comments on commit 3db00d4

Please sign in to comment.