Skip to content

Commit bf51831

Browse files
Marvin182copybara-github
authored andcommitted
Release ArrayRecord 0.4.1.
PiperOrigin-RevId: 554817684
1 parent 39728a7 commit bf51831

File tree

5 files changed

+9
-21
lines changed

5 files changed

+9
-21
lines changed

.github/workflows/python-tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ jobs:
99
runs-on: ubuntu-latest
1010
strategy:
1111
matrix:
12-
python-version: ['3.8', '3.9', '3.10']
12+
python-version: ['3.9', '3.10']
1313
env:
1414
DOCKER_BUILDKIT: 1
1515
TMP_FOLDER: /tmp/array_record

python/BUILD

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,7 @@ py_library(
3434
srcs = ["array_record_data_source.py"],
3535
data = [":array_record_module.so"],
3636
deps = [
37-
"//pyglib:gfile",
3837
# Implicit etils (/epath) dependency.
39-
"//third_party/py/grain/google/ntk/array_record/python:fast_array_record",
4038
],
4139
)
4240

@@ -51,8 +49,6 @@ py_test(
5149
],
5250
deps = [
5351
":array_record_data_source",
54-
"//third_party/py/grain/google/ntk/array_record/python:fast_array_record",
55-
"//third_party/py/numpy",
5652
"@com_google_absl_py//absl/testing:absltest",
5753
"@com_google_absl_py//absl/testing:flagsaver",
5854
"@com_google_absl_py//absl/testing:parameterized",

python/array_record_data_source.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@ def __getitem__(self, record_keys: Sequence[int]) -> Sequence[T]:
4646
from absl import logging
4747
from etils import epath
4848

49+
from . import array_record_module
50+
4951
# TODO(jolesiak): Decide what to do with these flags, e.g., remove them (could
5052
# be appropriate if we decide to use asyncio) or move them somewhere else and
5153
# pass the number of threads as an argument. For now, since we experiment, it's
@@ -156,7 +158,7 @@ def get_read_instruction(path: PathLikeOrFileInstruction) -> _ReadInstruction:
156158
end = int(m.group(3))
157159
else:
158160
path = os.fspath(path)
159-
reader = array_record.ArrayRecordReader(path)
161+
reader = array_record_module.ArrayRecordReader(path)
160162
start = 0 # Using whole file.
161163
end = reader.num_records()
162164
reader.close()
@@ -173,15 +175,15 @@ def get_read_instruction(path: PathLikeOrFileInstruction) -> _ReadInstruction:
173175

174176
def _create_reader(filename: epath.PathLike):
175177
"""Returns an ArrayRecordReader for the given filename."""
176-
return array_record.ArrayRecordReader(
178+
return array_record_module.ArrayRecordReader(
177179
filename,
178180
options="readahead_buffer_size:0",
179181
file_reader_buffer_size=32768,
180182
)
181183

182184

183185
def _check_group_size(
184-
filename: epath.PathLike, reader: array_record.ArrayRecordReader
186+
filename: epath.PathLike, reader: array_record_module.ArrayRecordReader
185187
) -> None:
186188
"""Logs an error if the group size of the underlying file is not 1."""
187189
options = reader.writer_options_string()

python/array_record_data_source_test.py

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
from absl.testing import absltest
2424
from absl.testing import flagsaver
2525
from absl.testing import parameterized
26-
import numpy as np
2726

2827
from array_record.python import array_record_data_source
2928
from array_record.python import array_record_module
@@ -138,15 +137,6 @@ def test_array_record_data_source_random_order(self):
138137
self.assertEqual(expected_data, actual_data)
139138
self.assertTrue(all(reader is None for reader in ar._readers))
140139

141-
def test_array_record_data_source_numpy_index(self):
142-
# some random permutation
143-
with array_record_data_source.ArrayRecordDataSource([
144-
self.testdata_dir / "digits.array_record-00000-of-00002",
145-
self.testdata_dir / "digits.array_record-00001-of-00002",
146-
]) as ar:
147-
actual_data = ar[np.int64(3)]
148-
self.assertEqual(b"3", actual_data)
149-
150140
def test_array_record_data_source_random_order_batched(self):
151141
# some random permutation
152142
indices_to_read = [3, 0, 5, 9, 2, 1, 4, 7, 8, 6]

setup.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,21 +10,21 @@
1010

1111
setup(
1212
name='array_record',
13-
version='0.4.0',
13+
version='0.4.1',
1414
description='A file format that achieves a new frontier of IO efficiency',
1515
author='ArrayRecord team',
1616
author_email='no-reply@google.com',
1717
packages=find_packages(),
1818
include_package_data=True,
1919
package_data={'': ['*.so']},
20-
python_requires='>=3.8',
20+
python_requires='>=3.9',
2121
install_requires=REQUIRED_PACKAGES,
2222
url='https://github.com/google/array_record',
2323
license='Apache-2.0',
2424
classifiers=[
25-
'Programming Language :: Python :: 3.8',
2625
'Programming Language :: Python :: 3.9',
2726
'Programming Language :: Python :: 3.10',
27+
'Programming Language :: Python :: 3.11',
2828
],
2929
zip_safe=False,
3030
)

0 commit comments

Comments
 (0)