bagz 0.3.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- bagz-0.3.0/.github/workflows/ci.yml +60 -0
- bagz-0.3.0/.github/workflows/release.yml +105 -0
- bagz-0.3.0/.gitignore +23 -0
- bagz-0.3.0/CMakeLists.txt +316 -0
- bagz-0.3.0/CONTRIBUTING.md +33 -0
- bagz-0.3.0/LICENSE +202 -0
- bagz-0.3.0/PKG-INFO +614 -0
- bagz-0.3.0/README.md +386 -0
- bagz-0.3.0/beam/bagzio.py +264 -0
- bagz-0.3.0/beam/bagzio_test.py +84 -0
- bagz-0.3.0/cmake/bagz_cc.cmake +109 -0
- bagz-0.3.0/cmake/third_party_absl.cmake +26 -0
- bagz-0.3.0/cmake/third_party_gcs.cmake +105 -0
- bagz-0.3.0/cmake/third_party_nanobind.cmake +27 -0
- bagz-0.3.0/cmake/third_party_zstd.cmake +29 -0
- bagz-0.3.0/conftest.py +30 -0
- bagz-0.3.0/plugins/gcs/pyproject.toml +87 -0
- bagz-0.3.0/pyproject.toml +72 -0
- bagz-0.3.0/src/bagz_index.cc +44 -0
- bagz-0.3.0/src/bagz_index.h +65 -0
- bagz-0.3.0/src/bagz_iterator.h +275 -0
- bagz-0.3.0/src/bagz_multi_index.cc +47 -0
- bagz-0.3.0/src/bagz_multi_index.h +68 -0
- bagz-0.3.0/src/bagz_options.h +75 -0
- bagz-0.3.0/src/bagz_reader.cc +700 -0
- bagz-0.3.0/src/bagz_reader.h +252 -0
- bagz-0.3.0/src/bagz_writer.cc +202 -0
- bagz-0.3.0/src/bagz_writer.h +99 -0
- bagz-0.3.0/src/file/file.cc +148 -0
- bagz-0.3.0/src/file/file.h +90 -0
- bagz-0.3.0/src/file/file_system/file_system.cc +65 -0
- bagz-0.3.0/src/file/file_system/file_system.h +69 -0
- bagz-0.3.0/src/file/file_system/mock_file_system.h +186 -0
- bagz-0.3.0/src/file/file_system/pread_file.cc +42 -0
- bagz-0.3.0/src/file/file_system/pread_file.h +70 -0
- bagz-0.3.0/src/file/file_system/shard_spec.cc +136 -0
- bagz-0.3.0/src/file/file_system/shard_spec.h +87 -0
- bagz-0.3.0/src/file/file_system/string_pread_file.cc +45 -0
- bagz-0.3.0/src/file/file_system/string_pread_file.h +54 -0
- bagz-0.3.0/src/file/file_system/write_file.h +48 -0
- bagz-0.3.0/src/file/file_systems/gcs/bagz_gcs.cc +36 -0
- bagz-0.3.0/src/file/file_systems/gcs/gcs_file_system.cc +295 -0
- bagz-0.3.0/src/file/file_systems/gcs/gcs_file_system.h +79 -0
- bagz-0.3.0/src/file/file_systems/posix/posix_file_system.cc +219 -0
- bagz-0.3.0/src/file/file_systems/posix/posix_file_system.h +56 -0
- bagz-0.3.0/src/file/registry/file_system_registry.cc +106 -0
- bagz-0.3.0/src/file/registry/file_system_registry.h +98 -0
- bagz-0.3.0/src/file/registry/register_file_systems.cc +29 -0
- bagz-0.3.0/src/file/registry/register_file_systems.h +28 -0
- bagz-0.3.0/src/internal/bagz_shard_reader.cc +271 -0
- bagz-0.3.0/src/internal/bagz_shard_reader.h +161 -0
- bagz-0.3.0/src/internal/limits_name.cc +37 -0
- bagz-0.3.0/src/internal/limits_name.h +31 -0
- bagz-0.3.0/src/internal/parallel_do.cc +134 -0
- bagz-0.3.0/src/internal/parallel_do.h +63 -0
- bagz-0.3.0/src/internal/records_limits.cc +135 -0
- bagz-0.3.0/src/internal/records_limits.h +37 -0
- bagz-0.3.0/src/internal/recycling_pool.h +103 -0
- bagz-0.3.0/src/internal/serialize.h +42 -0
- bagz-0.3.0/src/internal/shard_indexing.cc +208 -0
- bagz-0.3.0/src/internal/shard_indexing.h +151 -0
- bagz-0.3.0/src/internal/zstd_compressor.cc +59 -0
- bagz-0.3.0/src/internal/zstd_compressor.h +56 -0
- bagz-0.3.0/src/internal/zstd_decompressor.cc +107 -0
- bagz-0.3.0/src/internal/zstd_decompressor.h +73 -0
- bagz-0.3.0/src/python/bagz.cc +45 -0
- bagz-0.3.0/src/python/bagz.pyi +369 -0
- bagz-0.3.0/src/python/bagz_index.cc +147 -0
- bagz-0.3.0/src/python/bagz_index.h +26 -0
- bagz-0.3.0/src/python/bagz_multi_index.cc +167 -0
- bagz-0.3.0/src/python/bagz_multi_index.h +26 -0
- bagz-0.3.0/src/python/bagz_options.cc +109 -0
- bagz-0.3.0/src/python/bagz_options.h +26 -0
- bagz-0.3.0/src/python/bagz_reader.cc +658 -0
- bagz-0.3.0/src/python/bagz_reader.h +26 -0
- bagz-0.3.0/src/python/bagz_test.py +558 -0
- bagz-0.3.0/src/python/bagz_writer.cc +202 -0
- bagz-0.3.0/src/python/bagz_writer.h +27 -0
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
# Copyright 2026 Google LLC
|
|
2
|
+
#
|
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
# you may not use this file except in compliance with the License.
|
|
5
|
+
# You may obtain a copy of the License at
|
|
6
|
+
#
|
|
7
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
#
|
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
# See the License for the specific language governing permissions and
|
|
13
|
+
# limitations under the License.
|
|
14
|
+
|
|
15
|
+
name: CI
|
|
16
|
+
|
|
17
|
+
on:
|
|
18
|
+
push:
|
|
19
|
+
branches:
|
|
20
|
+
- main
|
|
21
|
+
pull_request:
|
|
22
|
+
branches:
|
|
23
|
+
- main
|
|
24
|
+
|
|
25
|
+
permissions:
|
|
26
|
+
contents: read
|
|
27
|
+
|
|
28
|
+
jobs:
|
|
29
|
+
test:
|
|
30
|
+
name: test (${{ matrix.python-version }})
|
|
31
|
+
runs-on: ubuntu-latest
|
|
32
|
+
strategy:
|
|
33
|
+
matrix:
|
|
34
|
+
python-version: ["3.10", "3.11", "3.12"]
|
|
35
|
+
steps:
|
|
36
|
+
- name: Checkout repository
|
|
37
|
+
uses: actions/checkout@v4
|
|
38
|
+
|
|
39
|
+
- name: Install system build dependencies
|
|
40
|
+
run: |
|
|
41
|
+
sudo apt-get update -qq
|
|
42
|
+
sudo apt-get install -y --no-install-recommends libcurl4-openssl-dev libssl-dev ninja-build
|
|
43
|
+
|
|
44
|
+
- name: Set up uv and Python ${{ matrix.python-version }}
|
|
45
|
+
uses: astral-sh/setup-uv@v5
|
|
46
|
+
with:
|
|
47
|
+
enable-cache: true
|
|
48
|
+
python-version: ${{ matrix.python-version }}
|
|
49
|
+
|
|
50
|
+
- name: Build wheels
|
|
51
|
+
run: |
|
|
52
|
+
uv build --wheel --out-dir dist .
|
|
53
|
+
uv build --wheel --out-dir dist plugins/gcs
|
|
54
|
+
|
|
55
|
+
- name: Verify plugin loading and run tests against built wheels
|
|
56
|
+
run: |
|
|
57
|
+
uv run --with dist/bagz-*.whl --with dist/bagz_gcs-*.whl --with pytest --with absl-py --with numpy bash -c '
|
|
58
|
+
python -c "import bagz; import bagz_gcs; print(\"Loaded bagz and bagz_gcs from wheel successfully\")"
|
|
59
|
+
python -m pytest src
|
|
60
|
+
'
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
# Copyright 2026 Google LLC
|
|
2
|
+
#
|
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
# you may not use this file except in compliance with the License.
|
|
5
|
+
# You may obtain a copy of the License at
|
|
6
|
+
#
|
|
7
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
#
|
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
# See the License for the specific language governing permissions and
|
|
13
|
+
# limitations under the License.
|
|
14
|
+
|
|
15
|
+
name: Release
|
|
16
|
+
|
|
17
|
+
on:
|
|
18
|
+
release:
|
|
19
|
+
types: [published]
|
|
20
|
+
workflow_dispatch:
|
|
21
|
+
inputs:
|
|
22
|
+
target:
|
|
23
|
+
description: 'Publishing target'
|
|
24
|
+
required: true
|
|
25
|
+
default: 'testpypi'
|
|
26
|
+
type: choice
|
|
27
|
+
options:
|
|
28
|
+
- testpypi
|
|
29
|
+
- pypi
|
|
30
|
+
|
|
31
|
+
permissions:
|
|
32
|
+
contents: read
|
|
33
|
+
id-token: write
|
|
34
|
+
|
|
35
|
+
jobs:
|
|
36
|
+
build_wheels:
|
|
37
|
+
name: Build wheels on ${{ matrix.os }}
|
|
38
|
+
runs-on: ${{ matrix.os }}
|
|
39
|
+
strategy:
|
|
40
|
+
matrix:
|
|
41
|
+
os: [ubuntu-latest]
|
|
42
|
+
|
|
43
|
+
steps:
|
|
44
|
+
- name: Checkout repository
|
|
45
|
+
uses: actions/checkout@v4
|
|
46
|
+
|
|
47
|
+
- name: Build bagz core wheels
|
|
48
|
+
uses: pypa/cibuildwheel@v2.22.0
|
|
49
|
+
with:
|
|
50
|
+
package-dir: .
|
|
51
|
+
output-dir: wheelhouse
|
|
52
|
+
|
|
53
|
+
- name: Build bagz-gcs plugin wheels
|
|
54
|
+
uses: pypa/cibuildwheel@v2.22.0
|
|
55
|
+
with:
|
|
56
|
+
package-dir: plugins/gcs
|
|
57
|
+
output-dir: wheelhouse
|
|
58
|
+
|
|
59
|
+
- name: Upload wheel artifacts
|
|
60
|
+
uses: actions/upload-artifact@v4
|
|
61
|
+
with:
|
|
62
|
+
name: cibw-wheels
|
|
63
|
+
path: wheelhouse/*.whl
|
|
64
|
+
|
|
65
|
+
build_sdist:
|
|
66
|
+
name: Build source distributions
|
|
67
|
+
runs-on: ubuntu-latest
|
|
68
|
+
steps:
|
|
69
|
+
- name: Checkout repository
|
|
70
|
+
uses: actions/checkout@v4
|
|
71
|
+
|
|
72
|
+
- name: Set up uv
|
|
73
|
+
uses: astral-sh/setup-uv@v5
|
|
74
|
+
|
|
75
|
+
- name: Build sdists
|
|
76
|
+
run: |
|
|
77
|
+
uv build --sdist --out-dir dist .
|
|
78
|
+
uv build --sdist --out-dir dist plugins/gcs
|
|
79
|
+
|
|
80
|
+
- name: Upload sdist artifacts
|
|
81
|
+
uses: actions/upload-artifact@v4
|
|
82
|
+
with:
|
|
83
|
+
name: cibw-sdist
|
|
84
|
+
path: dist/*.tar.gz
|
|
85
|
+
|
|
86
|
+
publish:
|
|
87
|
+
name: Publish to ${{ inputs.target || 'pypi' }}
|
|
88
|
+
needs: [build_wheels, build_sdist]
|
|
89
|
+
runs-on: ubuntu-latest
|
|
90
|
+
environment:
|
|
91
|
+
name: ${{ inputs.target || 'pypi' }}
|
|
92
|
+
url: ${{ (inputs.target == 'testpypi') && 'https://test.pypi.org/p/bagz' || 'https://pypi.org/p/bagz' }}
|
|
93
|
+
|
|
94
|
+
steps:
|
|
95
|
+
- name: Download all artifacts
|
|
96
|
+
uses: actions/download-artifact@v4
|
|
97
|
+
with:
|
|
98
|
+
path: dist
|
|
99
|
+
merge-multiple: true
|
|
100
|
+
|
|
101
|
+
- name: Publish to PyPI or TestPyPI
|
|
102
|
+
uses: pypa/gh-action-pypi-publish@release/v1
|
|
103
|
+
with:
|
|
104
|
+
repository-url: ${{ (inputs.target == 'testpypi') && 'https://test.pypi.org/legacy/' || '' }}
|
|
105
|
+
packages-dir: dist/
|
bagz-0.3.0/.gitignore
ADDED
|
@@ -0,0 +1,316 @@
|
|
|
1
|
+
# Copyright 2025 Google LLC
|
|
2
|
+
#
|
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
# you may not use this file except in compliance with the License.
|
|
5
|
+
# You may obtain a copy of the License at
|
|
6
|
+
#
|
|
7
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
#
|
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
# See the License for the specific language governing permissions and
|
|
13
|
+
# limitations under the License.
|
|
14
|
+
|
|
15
|
+
cmake_minimum_required(VERSION 3.28)
|
|
16
|
+
project(bagz LANGUAGES CXX)
|
|
17
|
+
|
|
18
|
+
include(FetchContent)
|
|
19
|
+
|
|
20
|
+
option(BUILD_SHARED_LIBS ON)
|
|
21
|
+
set(CMAKE_CXX_STANDARD 20)
|
|
22
|
+
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
|
23
|
+
set(CMAKE_POSITION_INDEPENDENT_CODE TRUE)
|
|
24
|
+
set(CMAKE_SUPPRESS_DEVELOPER_WARNINGS TRUE)
|
|
25
|
+
set(CMAKE_SKIP_INSTALL_RULES ON)
|
|
26
|
+
|
|
27
|
+
option(ENABLE_CORE "Enable Core bagz extension" ON)
|
|
28
|
+
option(ENABLE_GCS "Enable GCS filesystem plugin" ON)
|
|
29
|
+
|
|
30
|
+
# Temporarily disable warnings for third-party libraries
|
|
31
|
+
set(SAVED_CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
|
|
32
|
+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -w -Wno-dev")
|
|
33
|
+
|
|
34
|
+
find_package(Python REQUIRED COMPONENTS Interpreter Development.Module OPTIONAL_COMPONENTS Development.SABIModule)
|
|
35
|
+
|
|
36
|
+
include(cmake/third_party_absl.cmake)
|
|
37
|
+
include(cmake/third_party_nanobind.cmake)
|
|
38
|
+
include(cmake/third_party_zstd.cmake)
|
|
39
|
+
|
|
40
|
+
if(ENABLE_GCS)
|
|
41
|
+
include(cmake/third_party_gcs.cmake)
|
|
42
|
+
endif()
|
|
43
|
+
|
|
44
|
+
# Restore original CXX_FLAGS
|
|
45
|
+
set(CMAKE_CXX_FLAGS "${SAVED_CMAKE_CXX_FLAGS}")
|
|
46
|
+
|
|
47
|
+
set(CMAKE_SUPPRESS_DEVELOPER_WARNINGS FALSE)
|
|
48
|
+
|
|
49
|
+
set(CMAKE_SKIP_INSTALL_RULES OFF)
|
|
50
|
+
|
|
51
|
+
include(cmake/bagz_cc.cmake)
|
|
52
|
+
|
|
53
|
+
set(bagz_internal_sources
|
|
54
|
+
"src/internal/bagz_shard_reader.cc"
|
|
55
|
+
"src/internal/limits_name.cc"
|
|
56
|
+
"src/internal/parallel_do.cc"
|
|
57
|
+
"src/internal/records_limits.cc"
|
|
58
|
+
"src/internal/shard_indexing.cc"
|
|
59
|
+
"src/internal/zstd_compressor.cc"
|
|
60
|
+
"src/internal/zstd_decompressor.cc"
|
|
61
|
+
)
|
|
62
|
+
set(bagz_internal_headers
|
|
63
|
+
"src/internal/bagz_shard_reader.h"
|
|
64
|
+
"src/internal/limits_name.h"
|
|
65
|
+
"src/internal/parallel_do.h"
|
|
66
|
+
"src/internal/records_limits.h"
|
|
67
|
+
"src/internal/recycling_pool.h"
|
|
68
|
+
"src/internal/serialize.h"
|
|
69
|
+
"src/internal/shard_indexing.h"
|
|
70
|
+
"src/internal/zstd_compressor.h"
|
|
71
|
+
"src/internal/zstd_decompressor.h"
|
|
72
|
+
)
|
|
73
|
+
|
|
74
|
+
bagz_cc_library(
|
|
75
|
+
bagz_internal
|
|
76
|
+
SOURCES ${bagz_internal_sources}
|
|
77
|
+
HEADERS ${bagz_internal_headers}
|
|
78
|
+
DEPS
|
|
79
|
+
absl::strings
|
|
80
|
+
absl::status
|
|
81
|
+
absl::statusor
|
|
82
|
+
absl::flat_hash_map
|
|
83
|
+
absl::log
|
|
84
|
+
libzstd_static
|
|
85
|
+
)
|
|
86
|
+
|
|
87
|
+
set(bagz_file_system_sources
|
|
88
|
+
"src/file/file_system/file_system.cc"
|
|
89
|
+
"src/file/file_system/pread_file.cc"
|
|
90
|
+
"src/file/file_system/shard_spec.cc"
|
|
91
|
+
"src/file/file_system/string_pread_file.cc"
|
|
92
|
+
)
|
|
93
|
+
set(bagz_file_system_headers
|
|
94
|
+
"src/file/file_system/file_system.h"
|
|
95
|
+
"src/file/file_system/mock_file_system.h"
|
|
96
|
+
"src/file/file_system/pread_file.h"
|
|
97
|
+
"src/file/file_system/shard_spec.h"
|
|
98
|
+
"src/file/file_system/string_pread_file.h"
|
|
99
|
+
"src/file/file_system/write_file.h"
|
|
100
|
+
)
|
|
101
|
+
|
|
102
|
+
bagz_cc_library(
|
|
103
|
+
bagz_file_system
|
|
104
|
+
SOURCES ${bagz_file_system_sources}
|
|
105
|
+
HEADERS ${bagz_file_system_headers}
|
|
106
|
+
DEPS
|
|
107
|
+
absl::flat_hash_map
|
|
108
|
+
absl::log
|
|
109
|
+
absl::status
|
|
110
|
+
absl::statusor
|
|
111
|
+
absl::strings
|
|
112
|
+
bagz_internal
|
|
113
|
+
)
|
|
114
|
+
|
|
115
|
+
set(bagz_file_system_posix_sources
|
|
116
|
+
"src/file/file_systems/posix/posix_file_system.cc"
|
|
117
|
+
)
|
|
118
|
+
set(bagz_file_system_posix_headers
|
|
119
|
+
"src/file/file_systems/posix/posix_file_system.h"
|
|
120
|
+
)
|
|
121
|
+
|
|
122
|
+
bagz_cc_library(
|
|
123
|
+
bagz_file_system_posix
|
|
124
|
+
SOURCES ${bagz_file_system_posix_sources}
|
|
125
|
+
HEADERS ${bagz_file_system_posix_headers}
|
|
126
|
+
DEPS
|
|
127
|
+
absl::status
|
|
128
|
+
absl::statusor
|
|
129
|
+
absl::strings
|
|
130
|
+
bagz_file_system
|
|
131
|
+
bagz_internal
|
|
132
|
+
)
|
|
133
|
+
|
|
134
|
+
if(ENABLE_GCS)
|
|
135
|
+
set(bagz_file_system_gcs_sources
|
|
136
|
+
"src/file/file_systems/gcs/gcs_file_system.cc"
|
|
137
|
+
)
|
|
138
|
+
set(bagz_file_system_gcs_headers
|
|
139
|
+
"src/file/file_systems/gcs/gcs_file_system.h"
|
|
140
|
+
)
|
|
141
|
+
|
|
142
|
+
bagz_cc_library(
|
|
143
|
+
bagz_file_system_gcs
|
|
144
|
+
SOURCES ${bagz_file_system_gcs_sources}
|
|
145
|
+
HEADERS ${bagz_file_system_gcs_headers}
|
|
146
|
+
DEPS
|
|
147
|
+
absl::log
|
|
148
|
+
absl::status
|
|
149
|
+
absl::statusor
|
|
150
|
+
absl::strings
|
|
151
|
+
bagz_file_system
|
|
152
|
+
bagz_internal
|
|
153
|
+
google-cloud-cpp::storage
|
|
154
|
+
)
|
|
155
|
+
endif()
|
|
156
|
+
|
|
157
|
+
set(bagz_file_sources
|
|
158
|
+
"src/file/file.cc"
|
|
159
|
+
"src/file/registry/file_system_registry.cc"
|
|
160
|
+
"src/file/registry/register_file_systems.cc"
|
|
161
|
+
)
|
|
162
|
+
set(bagz_file_headers
|
|
163
|
+
"src/file/file.h"
|
|
164
|
+
"src/file/registry/file_system_registry.h"
|
|
165
|
+
"src/file/registry/register_file_systems.h"
|
|
166
|
+
)
|
|
167
|
+
|
|
168
|
+
bagz_cc_library(
|
|
169
|
+
bagz_file
|
|
170
|
+
SOURCES ${bagz_file_sources}
|
|
171
|
+
HEADERS ${bagz_file_headers}
|
|
172
|
+
DEPS
|
|
173
|
+
absl::log
|
|
174
|
+
absl::status
|
|
175
|
+
absl::statusor
|
|
176
|
+
absl::strings
|
|
177
|
+
bagz_internal
|
|
178
|
+
bagz_file_system
|
|
179
|
+
bagz_file_system_posix
|
|
180
|
+
)
|
|
181
|
+
|
|
182
|
+
set(bagz_core_sources
|
|
183
|
+
"src/bagz_index.cc"
|
|
184
|
+
"src/bagz_multi_index.cc"
|
|
185
|
+
"src/bagz_reader.cc"
|
|
186
|
+
"src/bagz_writer.cc"
|
|
187
|
+
)
|
|
188
|
+
set(bagz_core_headers
|
|
189
|
+
"src/bagz_index.h"
|
|
190
|
+
"src/bagz_iterator.h"
|
|
191
|
+
"src/bagz_multi_index.h"
|
|
192
|
+
"src/bagz_options.h"
|
|
193
|
+
"src/bagz_reader.h"
|
|
194
|
+
"src/bagz_writer.h"
|
|
195
|
+
)
|
|
196
|
+
|
|
197
|
+
bagz_cc_library(
|
|
198
|
+
bagz_core
|
|
199
|
+
SOURCES ${bagz_core_sources}
|
|
200
|
+
HEADERS ${bagz_core_headers}
|
|
201
|
+
DEPS
|
|
202
|
+
absl::flat_hash_map
|
|
203
|
+
absl::log
|
|
204
|
+
absl::status
|
|
205
|
+
absl::statusor
|
|
206
|
+
absl::strings
|
|
207
|
+
bagz_file
|
|
208
|
+
bagz_internal
|
|
209
|
+
libzstd_static
|
|
210
|
+
)
|
|
211
|
+
|
|
212
|
+
set(bagz_python_sources
|
|
213
|
+
"src/python/bagz.cc"
|
|
214
|
+
"src/python/bagz_index.cc"
|
|
215
|
+
"src/python/bagz_multi_index.cc"
|
|
216
|
+
"src/python/bagz_options.cc"
|
|
217
|
+
"src/python/bagz_reader.cc"
|
|
218
|
+
"src/python/bagz_writer.cc"
|
|
219
|
+
)
|
|
220
|
+
|
|
221
|
+
option(ENABLE_CORE "Enable Core bagz extension" ON)
|
|
222
|
+
if(ENABLE_CORE)
|
|
223
|
+
bagz_nanobind_extension(
|
|
224
|
+
bagz
|
|
225
|
+
SOURCES ${bagz_python_sources}
|
|
226
|
+
|
|
227
|
+
DEPS
|
|
228
|
+
absl::flat_hash_map
|
|
229
|
+
absl::log
|
|
230
|
+
absl::status
|
|
231
|
+
absl::statusor
|
|
232
|
+
absl::strings
|
|
233
|
+
bagz_core
|
|
234
|
+
)
|
|
235
|
+
endif()
|
|
236
|
+
|
|
237
|
+
if(ENABLE_GCS)
|
|
238
|
+
bagz_nanobind_extension(
|
|
239
|
+
bagz_gcs
|
|
240
|
+
SOURCES "src/file/file_systems/gcs/bagz_gcs.cc"
|
|
241
|
+
DEPS
|
|
242
|
+
bagz_file_system_gcs
|
|
243
|
+
bagz_file
|
|
244
|
+
google-cloud-cpp::storage
|
|
245
|
+
absl::log
|
|
246
|
+
absl::status
|
|
247
|
+
)
|
|
248
|
+
endif()
|
|
249
|
+
|
|
250
|
+
file(WRITE ${CMAKE_BINARY_DIR}/__init__.py [[# Copyright 2025 Google LLC
|
|
251
|
+
#
|
|
252
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
253
|
+
# you may not use this file except in compliance with the License.
|
|
254
|
+
# You may obtain a copy of the License at
|
|
255
|
+
#
|
|
256
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
257
|
+
#
|
|
258
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
259
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
260
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
261
|
+
# See the License for the specific language governing permissions and
|
|
262
|
+
# limitations under the License.
|
|
263
|
+
|
|
264
|
+
from bagz.lib.bagz import *
|
|
265
|
+
|
|
266
|
+
import importlib.metadata
|
|
267
|
+
import logging
|
|
268
|
+
|
|
269
|
+
def _load_plugins():
|
|
270
|
+
try:
|
|
271
|
+
eps = importlib.metadata.entry_points(group='bagz.plugins')
|
|
272
|
+
except TypeError:
|
|
273
|
+
eps = importlib.metadata.entry_points().get('bagz.plugins', [])
|
|
274
|
+
|
|
275
|
+
for ep in eps:
|
|
276
|
+
try:
|
|
277
|
+
ep.load()
|
|
278
|
+
except Exception as e:
|
|
279
|
+
logging.warning(f"Failed to load bagz plugin {ep.name}: {e}")
|
|
280
|
+
|
|
281
|
+
_load_plugins()
|
|
282
|
+
]])
|
|
283
|
+
|
|
284
|
+
|
|
285
|
+
if(ENABLE_CORE)
|
|
286
|
+
install(
|
|
287
|
+
FILES "${CMAKE_BINARY_DIR}/__init__.py"
|
|
288
|
+
DESTINATION "bagz"
|
|
289
|
+
)
|
|
290
|
+
|
|
291
|
+
install(
|
|
292
|
+
TARGETS bagz
|
|
293
|
+
DESTINATION "bagz/lib"
|
|
294
|
+
)
|
|
295
|
+
endif()
|
|
296
|
+
|
|
297
|
+
if(ENABLE_GCS)
|
|
298
|
+
install(
|
|
299
|
+
TARGETS bagz_gcs
|
|
300
|
+
DESTINATION "bagz_gcs"
|
|
301
|
+
)
|
|
302
|
+
endif()
|
|
303
|
+
|
|
304
|
+
install(
|
|
305
|
+
DIRECTORY "beam/"
|
|
306
|
+
DESTINATION bagz/beam
|
|
307
|
+
FILES_MATCHING
|
|
308
|
+
PATTERN "*.py"
|
|
309
|
+
)
|
|
310
|
+
|
|
311
|
+
install(
|
|
312
|
+
FILES "src/python/bagz.pyi"
|
|
313
|
+
DESTINATION "bagz"
|
|
314
|
+
RENAME "__init__.pyi"
|
|
315
|
+
)
|
|
316
|
+
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# How to contribute
|
|
2
|
+
|
|
3
|
+
We'd love to accept your patches and contributions to this project.
|
|
4
|
+
|
|
5
|
+
## Before you begin
|
|
6
|
+
|
|
7
|
+
### Sign our Contributor License Agreement
|
|
8
|
+
|
|
9
|
+
Contributions to this project must be accompanied by a
|
|
10
|
+
[Contributor License Agreement](https://cla.developers.google.com/about) (CLA).
|
|
11
|
+
You (or your employer) retain the copyright to your contribution; this simply
|
|
12
|
+
gives us permission to use and redistribute your contributions as part of the
|
|
13
|
+
project.
|
|
14
|
+
|
|
15
|
+
If you or your current employer have already signed the Google CLA (even if it
|
|
16
|
+
was for a different project), you probably don't need to do it again.
|
|
17
|
+
|
|
18
|
+
Visit <https://cla.developers.google.com/> to see your current agreements or to
|
|
19
|
+
sign a new one.
|
|
20
|
+
|
|
21
|
+
### Review our community guidelines
|
|
22
|
+
|
|
23
|
+
This project follows
|
|
24
|
+
[Google's Open Source Community Guidelines](https://opensource.google/conduct/).
|
|
25
|
+
|
|
26
|
+
## Contribution process
|
|
27
|
+
|
|
28
|
+
### Code reviews
|
|
29
|
+
|
|
30
|
+
All submissions, including submissions by project members, require review. We
|
|
31
|
+
use GitHub pull requests for this purpose. Consult
|
|
32
|
+
[GitHub Help](https://help.github.com/articles/about-pull-requests/) for more
|
|
33
|
+
information on using pull requests.
|