A python wrapper of the C library 'Google CRC32C'
Project description
google-crc32c
This package wraps the google/crc32c
hardware-based implementation of the CRC32C hashing algorithm. Multiple wheels
are distributed as well as source. If a wheel is not published for the python
version and platform you are using, you will need to compile crc32c using a
C toolchain.
Building
Be sure to check out all submodules:
$ git clone --recursive https://github.com/googleapis/python-crc32c
Prerequisites
On Linux:
docker
python3.7
On OS X:
make
- Official
python.org
Python 2.7, 3.5, 3.6 and 3.7
On Windows:
cmake
- Official
python.org
Python 3.5, 3.6 and 3.7 - Visual Studio 15 2017 (just the compiler toolchain)
Unfortunately, libcrc32c
relies on many C++11 features, so
building a Python 2.7 extension with the
Visual C++ Compiler for Python 2.7 is infeasible.
Building Wheels
On Linux:
./scripts/manylinux/build.sh
On OS X:
./scripts/osx/build.sh
On Windows: see .appveyor.yml
.
Testing/Verify Wheels
On Linux (i.e. a host OS, not a docker
container):
$ ./scripts/manylinux/check-37.sh
...
+ venv/bin/python check_cffi_crc32c.py
_crc32c_cffi: <module 'crc32c._crc32c_cffi' from '.../python-crc32c/venv/lib/python3.7/site-packages/crc32c/_crc32c_cffi.abi3.so'>
_crc32c_cffi.lib: <Lib object for 'crc32c._crc32c_cffi'>
dir(_crc32c_cffi.lib): ['crc32c_extend', 'crc32c_value']
+ unzip -l wheels/google_crc32c-0.0.1-cp37-cp37m-manylinux1_x86_64.whl
Archive: wheels/google_crc32c-0.0.1-cp37-cp37m-manylinux1_x86_64.whl
Length Date Time Name
--------- ---------- ----- ----
26120 2018-10-25 00:09 crc32c/_crc32c_cffi.abi3.so
765 2018-10-24 23:57 crc32c/__init__.py
29552 2018-10-25 00:09 crc32c/.libs/libcrc32c-f865a225.so
109 2018-10-25 00:09 google_crc32c-0.0.1.dist-info/WHEEL
766 2018-10-25 00:09 google_crc32c-0.0.1.dist-info/METADATA
652 2018-10-25 00:09 google_crc32c-0.0.1.dist-info/RECORD
1 2018-10-25 00:09 google_crc32c-0.0.1.dist-info/zip-safe
7 2018-10-25 00:09 google_crc32c-0.0.1.dist-info/top_level.txt
--------- -------
57972 8 files
...
On OS X:
$ ./scripts/osx/check.sh
...
+ venv37/bin/python .../python-crc32c/check_cffi_crc32c.py
_crc32c_cffi: <module 'google_crc32c._crc32c_cffi' from '.../python-crc32c/venv37/lib/python3.7/site-packages/google_crc32c/_crc32c_cffi.abi3.so'>
_crc32c_cffi.lib: <Lib object for 'google_crc32c._crc32c_cffi'>
dir(_crc32c_cffi.lib): ['crc32c_extend', 'crc32c_value']
+ /Library/Frameworks/Python.framework/Versions/3.7/bin/delocate-listdeps --all --depending .../python-crc32c/wheels/google_crc32c-0.0.1-cp37-cp37m-macosx_10_6_intel.whl
/usr/lib/libSystem.B.dylib:
google_crc32c/_crc32c_cffi.abi3.so
google_crc32c/.dylibs/libcrc32c.dylib
/usr/lib/libc++.1.dylib:
google_crc32c/.dylibs/libcrc32c.dylib
@loader_path/.dylibs/libcrc32c.dylib:
google_crc32c/_crc32c_cffi.abi3.so
...
On Windows: TBD.
Installing locally for testing
Initialize the submodules and build the main libcrc32c.so
shared
library using cmake
/ make
:
$ cd python-crc32c
$ git submodule update --init --recursive
$ python -m venv venv
$ venv/bin/pip install --upgrade setuptools pip wheel
$ venv/bin/pip install cmake
$ mkdir usr
$ export CRC32C_INSTALL_PREFIX=$(pwd)/usr
$ mkdir google_crc32c/build
$ cd google_crc32c/build
$ ../../venv/bin/cmake \
> -DCRC32C_BUILD_TESTS=no \
> -DCRC32C_BUILD_BENCHMARKS=no \
> -DBUILD_SHARED_LIBS=yes \
> -DCMAKE_INSTALL_PREFIX:PATH=${CRC32C_INSTALL_PREFIX} \
> ..
$ make all install
$ cd ../..
Now, run the tests:
$ venv/bin/pip install -e .[testing]
$ venv/bin/py.test tests/
============================= test session starts ==============================
platform linux -- Python 3.6.7, pytest-3.10.0, py-1.7.0, pluggy-0.8.0
rootdir: ..., inifile:
collected 9 items
tests/test___init__.py ......... [100%]
=========================== 9 passed in 0.03 seconds ===========================
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
Hashes for google_crc32c-1.1.0-cp39-cp39-manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 82b4ce1c515a455f21e4f6aea8d45252e2b319fa604b8d9f2cb301d5a752f578 |
|
MD5 | 6c6c9ca3b6a30510dddacd03f50570b3 |
|
BLAKE2b-256 | fd433c6a5ccee91dce1067e47a4bdf71dffa50a013330ae7dd105f3979a1bcb1 |
Hashes for google_crc32c-1.1.0-cp39-cp39-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6385d87cd15a7c9f7ff63b08f6d01c8665053ad69f1ac80054cf7a94a7139bfc |
|
MD5 | ffb3fa16ba6f98ebbe9e04934b7f6b72 |
|
BLAKE2b-256 | afdb047cf462dd12f0da7acb62184a6e973f70d0a3c3dd8f6049985912dfdaaa |
Hashes for google_crc32c-1.1.0-cp38-cp38-manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9ad95a167f7bf8e27992677b5b1e411eaadf0ffa81961fa203d88b2be5394618 |
|
MD5 | 96b9f1bd1beb2fc5981c88d585c93f42 |
|
BLAKE2b-256 | 6cc8e88cabd8235ab09c3fa6963218206f726ad433e959638e966a5f87fa6699 |
Hashes for google_crc32c-1.1.0-cp38-cp38-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 55e44136e0a23de7f31207644d5765c1c55402f7b23bf1a6625317f4d50c8725 |
|
MD5 | 9a44d9693cd66e11b04c431184515aa5 |
|
BLAKE2b-256 | 87738a58538ee5301b8269838d1cc39fa5acde3ef6dcdbf5b590545712dfba7d |
Hashes for google_crc32c-1.1.0-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ade6f03d3670bec8ccc1b9a6ca7123985c14e83923ecba2b88dedd3f88e795e5 |
|
MD5 | df09f3d9429b67272430656af9bba9b3 |
|
BLAKE2b-256 | 250bc7d8909517cf080892964cc0679edf5a0385c26958b5bab7f7c1005f63e4 |
Hashes for google_crc32c-1.1.0-cp37-cp37m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 28e0712ddb73ba02e5a4f03d571a864e8a1e64941e394a8ace1118128903c73b |
|
MD5 | c259b636a74b92c194c3753b3981c8b8 |
|
BLAKE2b-256 | 762704949e880dce5f1a860dc6d5cb6c72b74170261054fc1b05a8f096dbd6a1 |
Hashes for google_crc32c-1.1.0-cp37-cp37m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d0cede9482ec2c3cc3c1b8fa11c10f1ac4760e1dbd8efdb5e39f93420ca75bec |
|
MD5 | 980d0515d64cf1e915f4666b39b072cd |
|
BLAKE2b-256 | 9049f2a5e5e09933998cc4365028d290988fea31b2ab1feefc1bad5a9a63269c |
Hashes for google_crc32c-1.1.0-cp37-cp37m-manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 279f38be88b274872d9c9ef8d0479a0bc3279e5b7faebea45a86501d18000242 |
|
MD5 | 999366ba8bc3518ea8dbc1c5cbcdb198 |
|
BLAKE2b-256 | 3a6942ac36d297b0489d096be553eafd3e28a03ecf7d8b4465fae603dd2409a2 |
Hashes for google_crc32c-1.1.0-cp37-cp37m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f050433604b55ff7efbca099d0b806dcbbf5fc1eec2a2640eb61ca0e44aaed5b |
|
MD5 | c88e55c43bf1ef71751c9da59535c69c |
|
BLAKE2b-256 | c033c72b79365e6e09b018c9ece5d612706ab96c8646e11ab1d4a3f6ea2bf8bd |
Hashes for google_crc32c-1.1.0-cp37-cp37m-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e5cc963e4c76f1c85a4b5045f86fdbb501c1ff0579a3d40431eac2137508af68 |
|
MD5 | 83aa84796084f2b6b138004add118d59 |
|
BLAKE2b-256 | 1d18381ff3f47c3801a1cdc73b8bdec927cb639989d46355829dd6cf3bb7d725 |
Hashes for google_crc32c-1.1.0-cp36-cp36m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e25e8cf79d1daf05dae69bf4dd1b73f2ee34674f4ea44176ed3cd764f206cc9d |
|
MD5 | 29418962d0ccab15a61758d2c6b192c8 |
|
BLAKE2b-256 | 1c4ccd02b25e52378355eca12ca8668b94b016bf36a1b104056677e31af56461 |
Hashes for google_crc32c-1.1.0-cp36-cp36m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | bb1d7efb881406963dd919fbc3db4f248a5aa0c600295b2a65ea68d4ca79032a |
|
MD5 | 0faa69dca82e3ac240734b015b09ef6c |
|
BLAKE2b-256 | a3af156a1adabc3e070bd833800a42c6e2b04095d71b4df64c7ad69eca9655e1 |
Hashes for google_crc32c-1.1.0-cp36-cp36m-manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4a9ab614ec85d0977af76a093cab514ce78ec20ba3cecd3af4715a111a5ec250 |
|
MD5 | 8835fc86e5847d7fbb0182d470736674 |
|
BLAKE2b-256 | b936d09a513143318ebb78d344dea8fa5aba63fddea0e758d86f181a4902a42e |
Hashes for google_crc32c-1.1.0-cp36-cp36m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ebc3c794d9f96d0fbb5177984e12206d3d7371762f67782cfd150e32722b8aed |
|
MD5 | 2db657417560d42bbedbf9460e83e2ba |
|
BLAKE2b-256 | 3dabfcaf8cc542fb44d1fef7359954fae6d216aa82ef4cabdc87c3f93bee0754 |
Hashes for google_crc32c-1.1.0-cp36-cp36m-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e9be2ccfc510fc84a7de875d8f8e59d70818c819fbd0f74ff0a8aa4a1c057f94 |
|
MD5 | ef394e231feb1501c57d639729bdf8d2 |
|
BLAKE2b-256 | 1a708a47ecb46fcd2ca5b4ca01e7d66b5e5eaa13d2f9eae173c5ddfc949c87ae |