Skip to content

Commit 3660c95

Browse files
committed
Getting ready for release 0.5.1
1 parent d067d3a commit 3660c95

File tree

6 files changed

+31
-19
lines changed

6 files changed

+31
-19
lines changed

.github/workflows/cibuildwheels.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ jobs:
6161
run: |
6262
python -m pip install --upgrade pip
6363
python -m pip install -r requirements-build.txt
64-
python -m pip install -r requirements-tests.txt
64+
python -m pip install -r requirements-test-wheels.txt
6565
6666
- name: Build wheels (Windows)
6767
if: runner.os == 'Windows'
@@ -72,7 +72,7 @@ jobs:
7272
env:
7373
CIBW_BUILD: 'cp38-win_amd64 cp39-win_amd64 cp310-win_amd64'
7474
CIBW_BEFORE_BUILD: python -m pip install -r requirements-build.txt
75-
CIBW_BEFORE_TEST: python -m pip install -r requirements-tests.txt
75+
CIBW_BEFORE_TEST: python -m pip install -r requirements-test-wheels.txt
7676
CIBW_TEST_COMMAND: python -m pytest -m "not heavy" {project}/tests
7777
CIBW_BUILD_VERBOSITY: 1
7878

@@ -87,7 +87,7 @@ jobs:
8787
CIBW_SKIP: '*-manylinux*_i686'
8888
CIBW_ARCHS_LINUX: ${{ matrix.arch }}
8989
CIBW_BEFORE_BUILD: python -m pip install -r requirements-build.txt
90-
CIBW_BEFORE_TEST: python -m pip install -r requirements-tests.txt
90+
CIBW_BEFORE_TEST: python -m pip install -r requirements-test-wheels.txt
9191
CIBW_TEST_COMMAND: python -m pytest -m "not heavy" {project}/tests
9292
CIBW_BUILD_VERBOSITY: 1
9393

RELEASE_NOTES.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
# Release notes
22

3+
## Changes from 0.5.0 to 0.5.1
4+
5+
* Remove the testing of packing PyTorch or TensorFlow objects during wheels build.
6+
7+
38
## Changes from 0.4.1 to 0.5.0
49

510
* New `pack_tensor`, `unpack_tensor`, `save_tensor` and `load_tensor` functions for serializing/deserializing PyTorch and TensorFlow tensor objects. They also understand NumPy arrays, so these are the new recommended ones for serialization.

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0.5.0
1+
0.5.1

blosc2/core.py

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -583,10 +583,10 @@ def pack_tensor(tensor, chunksize=None, **kwargs):
583583
584584
Examples
585585
--------
586-
>>> import torch
587-
>>> th = torch.arange(1e6, dtype=torch.float32)
586+
>>> import numpy as np
587+
>>> th = np.arange(1e6, dtype=np.float32)
588588
>>> cframe = blosc2.pack_tensor(th)
589-
>>> len(cframe) < th.size()[0] * 4
589+
>>> len(cframe) < th.size * th.itemsize
590590
True
591591
592592
See also
@@ -680,11 +680,10 @@ def unpack_tensor(cframe):
680680
681681
Examples
682682
--------
683-
>>> import torch
684683
>>> import numpy as np
685-
>>> th = torch.arange(1e3, dtype=torch.float32)
684+
>>> th = np.arange(1e3, dtype=np.float32)
686685
>>> cframe = blosc2.pack_tensor(th)
687-
>>> len(cframe) < th.size()[0] * 4
686+
>>> len(cframe) < th.size * th.itemsize
688687
True
689688
>>> th2 = blosc2.unpack_tensor(cframe)
690689
>>> a = np.asarray(th)
@@ -728,10 +727,10 @@ def save_tensor(tensor, urlpath, chunksize=None, **kwargs):
728727
729728
Examples
730729
--------
731-
>>> import torch
732-
>>> th = torch.arange(1e6, dtype=torch.float32)
730+
>>> import numpy as np
731+
>>> th = np.arange(1e6, dtype=np.float32)
733732
>>> serial_size = blosc2.save_tensor(th, "test.bl2", mode="w")
734-
>>> serial_size < th.size()[0] * 4
733+
>>> serial_size < th.size * th.itemsize
735734
True
736735
737736
See also
@@ -766,13 +765,12 @@ def load_tensor(urlpath):
766765
Examples
767766
--------
768767
>>> import numpy as np
769-
>>> import torch
770-
>>> th = torch.arange(1e6, dtype=torch.float32)
768+
>>> th = np.arange(1e6, dtype=np.float32)
771769
>>> size = blosc2.save_tensor(th, "test.bl2", mode="w")
772-
>>> size < th.size()[0] * 4
770+
>>> size < th.size * th.itemsize
773771
True
774772
>>> th2 = blosc2.load_tensor("test.bl2")
775-
>>> np.array_equal(th.numpy(), th2.numpy())
773+
>>> np.array_equal(th, th2)
776774
True
777775
778776
See also

requirements-test-wheels.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
pip
2+
numpy
3+
pytest
4+
psutil
5+
msgpack
Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,12 @@
88
import numpy as np
99
import pytest
1010
import blosc2
11-
import torch
12-
import tensorflow as tf
11+
12+
try:
13+
import torch
14+
import tensorflow as tf
15+
except ImportError:
16+
pytest.skip("skipping torch / tensorflow tests", allow_module_level=True)
1317

1418

1519
##### pack / unpack #####

0 commit comments

Comments
 (0)