sharedbox 0.3.1__tar.gz → 0.4.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.
- {sharedbox-0.3.1 → sharedbox-0.4.0}/.github/workflows/ci.yaml +1 -1
- {sharedbox-0.3.1 → sharedbox-0.4.0}/CHANGELOG.md +69 -0
- {sharedbox-0.3.1 → sharedbox-0.4.0}/CLAUDE.md +42 -30
- {sharedbox-0.3.1 → sharedbox-0.4.0}/CMakeLists.txt +3 -1
- {sharedbox-0.3.1 → sharedbox-0.4.0}/PKG-INFO +3 -1
- sharedbox-0.4.0/docs/assets/benchmarks/ops-dark.svg +1209 -0
- sharedbox-0.4.0/docs/assets/benchmarks/ops-light.svg +1209 -0
- sharedbox-0.4.0/docs/assets/benchmarks/roundtrip-dark.svg +334 -0
- sharedbox-0.4.0/docs/assets/benchmarks/roundtrip-light.svg +334 -0
- sharedbox-0.4.0/docs/examples/store_arrays.py +40 -0
- sharedbox-0.4.0/docs/examples/store_collections.py +39 -0
- sharedbox-0.4.0/docs/examples/store_records.py +52 -0
- sharedbox-0.4.0/docs/explanation/field-types.md +91 -0
- {sharedbox-0.3.1 → sharedbox-0.4.0}/docs/explanation/glossary.md +12 -4
- {sharedbox-0.3.1 → sharedbox-0.4.0}/docs/explanation/how-a-box-is-stored.md +5 -6
- {sharedbox-0.3.1 → sharedbox-0.4.0}/docs/explanation/how-the-module-is-built.md +3 -2
- {sharedbox-0.3.1 → sharedbox-0.4.0}/docs/explanation/index.md +4 -0
- {sharedbox-0.3.1 → sharedbox-0.4.0}/docs/explanation/limits.md +14 -7
- sharedbox-0.4.0/docs/explanation/performance.md +78 -0
- {sharedbox-0.3.1 → sharedbox-0.4.0}/docs/how-to/accept-a-box-in-cpp.md +1 -1
- {sharedbox-0.3.1 → sharedbox-0.4.0}/docs/how-to/clean-up-segments.md +3 -3
- {sharedbox-0.3.1 → sharedbox-0.4.0}/docs/how-to/index.md +6 -0
- {sharedbox-0.3.1 → sharedbox-0.4.0}/docs/how-to/make-a-release.md +1 -1
- {sharedbox-0.3.1 → sharedbox-0.4.0}/docs/how-to/run-benchmarks.md +13 -0
- sharedbox-0.4.0/docs/how-to/store-arrays.md +58 -0
- sharedbox-0.4.0/docs/how-to/store-collections.md +59 -0
- sharedbox-0.4.0/docs/how-to/store-records.md +68 -0
- {sharedbox-0.3.1 → sharedbox-0.4.0}/docs/index.md +0 -1
- sharedbox-0.4.0/docs/reference/api/arrays.md +28 -0
- {sharedbox-0.3.1 → sharedbox-0.4.0}/docs/reference/api/box.md +1 -1
- {sharedbox-0.3.1 → sharedbox-0.4.0}/docs/reference/api/index.md +1 -0
- {sharedbox-0.3.1 → sharedbox-0.4.0}/docs/reference/cpp-and-c-api.md +2 -2
- {sharedbox-0.3.1 → sharedbox-0.4.0}/docs/reference/segment-layout.md +255 -48
- {sharedbox-0.3.1 → sharedbox-0.4.0}/include/sharedbox/sharedbox.hpp +1344 -108
- sharedbox-0.4.0/include/sharedbox/sharedbox_c.cpp +321 -0
- sharedbox-0.4.0/include/sharedbox/sharedbox_c.h +131 -0
- {sharedbox-0.3.1 → sharedbox-0.4.0}/includes/abbreviations.md +3 -1
- {sharedbox-0.3.1 → sharedbox-0.4.0}/pyproject.toml +9 -1
- {sharedbox-0.3.1 → sharedbox-0.4.0}/src/sharedbox/__init__.py +5 -0
- sharedbox-0.4.0/src/sharedbox/_arrays.py +163 -0
- {sharedbox-0.3.1 → sharedbox-0.4.0}/src/sharedbox/_box.py +94 -32
- {sharedbox-0.3.1 → sharedbox-0.4.0}/src/sharedbox/_events.py +26 -13
- {sharedbox-0.3.1 → sharedbox-0.4.0}/src/sharedbox/_layout.py +129 -112
- {sharedbox-0.3.1 → sharedbox-0.4.0}/src/sharedbox/_native/codec.cpp +39 -17
- sharedbox-0.4.0/src/sharedbox/_native/codec.hpp +87 -0
- sharedbox-0.4.0/src/sharedbox/_native/module.cpp +947 -0
- sharedbox-0.4.0/src/sharedbox/_native/scalars.cpp +490 -0
- sharedbox-0.4.0/src/sharedbox/_native/scalars.hpp +31 -0
- {sharedbox-0.3.1 → sharedbox-0.4.0}/src/sharedbox/_native/segment.cpp +105 -57
- {sharedbox-0.3.1 → sharedbox-0.4.0}/src/sharedbox/_native/segment.hpp +29 -16
- sharedbox-0.4.0/src/sharedbox/_native/types.cpp +833 -0
- sharedbox-0.4.0/src/sharedbox/_native/types.hpp +110 -0
- {sharedbox-0.3.1 → sharedbox-0.4.0}/src/sharedbox/_native.pyi +99 -9
- {sharedbox-0.3.1 → sharedbox-0.4.0}/src/sharedbox/_refs.py +4 -2
- sharedbox-0.4.0/src/sharedbox/_types.py +985 -0
- {sharedbox-0.3.1 → sharedbox-0.4.0}/src/sharedbox/_version.py +3 -3
- sharedbox-0.4.0/src/sharedbox/benchmarks/__init__.py +5 -0
- {sharedbox-0.3.1 → sharedbox-0.4.0}/src/sharedbox/benchmarks/_app.py +18 -0
- {sharedbox-0.3.1 → sharedbox-0.4.0}/src/sharedbox/benchmarks/ops.py +49 -4
- sharedbox-0.4.0/src/sharedbox/benchmarks/plot.py +161 -0
- {sharedbox-0.3.1 → sharedbox-0.4.0}/stubtest-allowlist.txt +2 -0
- {sharedbox-0.3.1 → sharedbox-0.4.0}/tests/conftest.py +32 -0
- {sharedbox-0.3.1 → sharedbox-0.4.0}/tests/cpp/CMakeLists.txt +1 -1
- {sharedbox-0.3.1 → sharedbox-0.4.0}/tests/cpp/consumer/consumer.c +14 -0
- sharedbox-0.4.0/tests/cpp/table_builder.hpp +49 -0
- {sharedbox-0.3.1 → sharedbox-0.4.0}/tests/cpp/test_c_smoke.c +30 -0
- sharedbox-0.4.0/tests/cpp/test_c_smoke_box.cpp +39 -0
- sharedbox-0.4.0/tests/cpp/test_layout2.cpp +126 -0
- {sharedbox-0.3.1 → sharedbox-0.4.0}/tests/cpp/test_mapping.cpp +7 -6
- {sharedbox-0.3.1 → sharedbox-0.4.0}/tests/cpp/test_result.cpp +1 -1
- sharedbox-0.4.0/tests/cpp/test_types.cpp +293 -0
- sharedbox-0.4.0/tests/cpp/test_values.cpp +237 -0
- sharedbox-0.4.0/tests/crossproc.py +36 -0
- sharedbox-0.4.0/tests/forged_types.py +100 -0
- sharedbox-0.4.0/tests/test_benchbox_plot.py +63 -0
- {sharedbox-0.3.1 → sharedbox-0.4.0}/tests/test_box.py +273 -1
- {sharedbox-0.3.1 → sharedbox-0.4.0}/tests/test_capsule.py +66 -5
- {sharedbox-0.3.1 → sharedbox-0.4.0}/tests/test_doc_examples.py +3 -0
- sharedbox-0.4.0/tests/test_events_bytes.py +56 -0
- {sharedbox-0.3.1 → sharedbox-0.4.0}/tests/test_events_signals.py +29 -0
- {sharedbox-0.3.1 → sharedbox-0.4.0}/tests/test_layout.py +9 -6
- sharedbox-0.4.0/tests/test_layout_v1.py +50 -0
- {sharedbox-0.3.1 → sharedbox-0.4.0}/tests/test_native_segment.py +10 -9
- sharedbox-0.4.0/tests/test_native_types.py +284 -0
- sharedbox-0.4.0/tests/test_properties_forged.py +24 -0
- {sharedbox-0.3.1 → sharedbox-0.4.0}/tests/test_properties_layout.py +3 -2
- sharedbox-0.4.0/tests/test_properties_types.py +136 -0
- {sharedbox-0.3.1 → sharedbox-0.4.0}/tests/test_refs.py +47 -0
- sharedbox-0.4.0/tests/test_types_arrays.py +212 -0
- sharedbox-0.4.0/tests/test_types_arrays_bfloat16.py +34 -0
- sharedbox-0.4.0/tests/test_types_arrays_torch.py +18 -0
- sharedbox-0.4.0/tests/test_types_choices.py +158 -0
- sharedbox-0.4.0/tests/test_types_collections.py +183 -0
- sharedbox-0.4.0/tests/test_types_records.py +311 -0
- sharedbox-0.4.0/tests/test_types_records_attrs.py +21 -0
- sharedbox-0.4.0/tests/test_types_records_msgspec.py +35 -0
- sharedbox-0.4.0/tests/test_types_scalars.py +142 -0
- sharedbox-0.4.0/tests/test_types_unions.py +170 -0
- {sharedbox-0.3.1 → sharedbox-0.4.0}/uv.lock +861 -1
- {sharedbox-0.3.1 → sharedbox-0.4.0}/zensical.toml +6 -0
- sharedbox-0.3.1/include/sharedbox/sharedbox_c.cpp +0 -87
- sharedbox-0.3.1/include/sharedbox/sharedbox_c.h +0 -83
- sharedbox-0.3.1/src/sharedbox/_native/codec.hpp +0 -18
- sharedbox-0.3.1/src/sharedbox/_native/module.cpp +0 -372
- sharedbox-0.3.1/src/sharedbox/benchmarks/__init__.py +0 -3
- sharedbox-0.3.1/tests/cpp/test_c_smoke_box.cpp +0 -26
- sharedbox-0.3.1/tests/test_properties_forged.py +0 -19
- {sharedbox-0.3.1 → sharedbox-0.4.0}/.clang-format +0 -0
- {sharedbox-0.3.1 → sharedbox-0.4.0}/.claude/settings.json +0 -0
- {sharedbox-0.3.1 → sharedbox-0.4.0}/.github/workflows/check-docs.yaml +0 -0
- {sharedbox-0.3.1 → sharedbox-0.4.0}/.github/workflows/codspeed.yml +0 -0
- {sharedbox-0.3.1 → sharedbox-0.4.0}/.github/workflows/publish-docs.yaml +0 -0
- {sharedbox-0.3.1 → sharedbox-0.4.0}/.gitignore +0 -0
- {sharedbox-0.3.1 → sharedbox-0.4.0}/LICENSE +0 -0
- {sharedbox-0.3.1 → sharedbox-0.4.0}/README.md +0 -0
- {sharedbox-0.3.1 → sharedbox-0.4.0}/benchmarks/test_bench_box.py +0 -0
- {sharedbox-0.3.1 → sharedbox-0.4.0}/cmake/sharedbox-config.cmake +0 -0
- {sharedbox-0.3.1 → sharedbox-0.4.0}/cmake/sharedbox-require-cxx.cmake +0 -0
- {sharedbox-0.3.1 → sharedbox-0.4.0}/docs/examples/change_several_fields_at_once.py +0 -0
- {sharedbox-0.3.1 → sharedbox-0.4.0}/docs/examples/clean_up_segments.py +0 -0
- {sharedbox-0.3.1 → sharedbox-0.4.0}/docs/examples/follow_a_whole_reference_graph.py +0 -0
- {sharedbox-0.3.1 → sharedbox-0.4.0}/docs/examples/name_a_box.py +0 -0
- {sharedbox-0.3.1 → sharedbox-0.4.0}/docs/examples/send_a_box_to_another_process.py +0 -0
- {sharedbox-0.3.1 → sharedbox-0.4.0}/docs/examples/set_defaults_and_check_values.py +0 -0
- {sharedbox-0.3.1 → sharedbox-0.4.0}/docs/examples/store_text_and_bytes.py +0 -0
- {sharedbox-0.3.1 → sharedbox-0.4.0}/docs/explanation/checking-a-process-is-alive.md +0 -0
- {sharedbox-0.3.1 → sharedbox-0.4.0}/docs/explanation/closing-and-lifetime.md +0 -0
- {sharedbox-0.3.1 → sharedbox-0.4.0}/docs/explanation/reading-and-writing.md +0 -0
- {sharedbox-0.3.1 → sharedbox-0.4.0}/docs/explanation/references.md +0 -0
- {sharedbox-0.3.1 → sharedbox-0.4.0}/docs/explanation/waiting-for-changes.md +0 -0
- {sharedbox-0.3.1 → sharedbox-0.4.0}/docs/explanation/when-to-use-sharedbox.md +0 -0
- {sharedbox-0.3.1 → sharedbox-0.4.0}/docs/how-to/accept-a-box-in-c.md +0 -0
- {sharedbox-0.3.1 → sharedbox-0.4.0}/docs/how-to/ai-contribution-policy.md +0 -0
- {sharedbox-0.3.1 → sharedbox-0.4.0}/docs/how-to/build-docs.md +0 -0
- {sharedbox-0.3.1 → sharedbox-0.4.0}/docs/how-to/change-several-fields-at-once.md +0 -0
- {sharedbox-0.3.1 → sharedbox-0.4.0}/docs/how-to/commits-and-prs.md +0 -0
- {sharedbox-0.3.1 → sharedbox-0.4.0}/docs/how-to/contribute.md +0 -0
- {sharedbox-0.3.1 → sharedbox-0.4.0}/docs/how-to/follow-a-whole-reference-graph.md +0 -0
- {sharedbox-0.3.1 → sharedbox-0.4.0}/docs/how-to/install-sharedbox.md +0 -0
- {sharedbox-0.3.1 → sharedbox-0.4.0}/docs/how-to/name-a-box.md +0 -0
- {sharedbox-0.3.1 → sharedbox-0.4.0}/docs/how-to/open-a-box-from-a-program.md +0 -0
- {sharedbox-0.3.1 → sharedbox-0.4.0}/docs/how-to/run-commit-checks.md +0 -0
- {sharedbox-0.3.1 → sharedbox-0.4.0}/docs/how-to/run-tests.md +0 -0
- {sharedbox-0.3.1 → sharedbox-0.4.0}/docs/how-to/send-a-box-to-another-process.md +0 -0
- {sharedbox-0.3.1 → sharedbox-0.4.0}/docs/how-to/set-defaults-and-check-values.md +0 -0
- {sharedbox-0.3.1 → sharedbox-0.4.0}/docs/how-to/set-up-development.md +0 -0
- {sharedbox-0.3.1 → sharedbox-0.4.0}/docs/how-to/store-text-and-bytes.md +0 -0
- {sharedbox-0.3.1 → sharedbox-0.4.0}/docs/how-to/write-docs.md +0 -0
- {sharedbox-0.3.1 → sharedbox-0.4.0}/docs/reference/api/errors.md +0 -0
- {sharedbox-0.3.1 → sharedbox-0.4.0}/docs/reference/api/events.md +0 -0
- {sharedbox-0.3.1 → sharedbox-0.4.0}/docs/reference/api/library-authors.md +0 -0
- {sharedbox-0.3.1 → sharedbox-0.4.0}/docs/reference/api/references.md +0 -0
- {sharedbox-0.3.1 → sharedbox-0.4.0}/docs/reference/changelog.md +0 -0
- {sharedbox-0.3.1 → sharedbox-0.4.0}/docs/reference/index.md +0 -0
- {sharedbox-0.3.1 → sharedbox-0.4.0}/docs/tutorials/index.md +0 -0
- {sharedbox-0.3.1 → sharedbox-0.4.0}/docs/tutorials/motor.py +0 -0
- {sharedbox-0.3.1 → sharedbox-0.4.0}/docs/tutorials/react-to-changes.md +0 -0
- {sharedbox-0.3.1 → sharedbox-0.4.0}/docs/tutorials/refer-to-another-box.md +0 -0
- {sharedbox-0.3.1 → sharedbox-0.4.0}/docs/tutorials/share-a-record.md +0 -0
- {sharedbox-0.3.1 → sharedbox-0.4.0}/prek.toml +0 -0
- {sharedbox-0.3.1 → sharedbox-0.4.0}/scripts/check_xrefs.py +0 -0
- {sharedbox-0.3.1 → sharedbox-0.4.0}/scripts/vscode_setup.py +0 -0
- {sharedbox-0.3.1 → sharedbox-0.4.0}/src/sharedbox/_follow.py +0 -0
- {sharedbox-0.3.1 → sharedbox-0.4.0}/src/sharedbox/benchmarks/__main__.py +0 -0
- {sharedbox-0.3.1 → sharedbox-0.4.0}/src/sharedbox/benchmarks/cli.py +0 -0
- {sharedbox-0.3.1 → sharedbox-0.4.0}/src/sharedbox/benchmarks/roundtrip.py +0 -0
- {sharedbox-0.3.1 → sharedbox-0.4.0}/src/sharedbox/benchmarks/size.py +0 -0
- {sharedbox-0.3.1 → sharedbox-0.4.0}/src/sharedbox/benchmarks/size_diff.py +0 -0
- {sharedbox-0.3.1 → sharedbox-0.4.0}/src/sharedbox/py.typed +0 -0
- {sharedbox-0.3.1 → sharedbox-0.4.0}/tests/cpp/compile_fail.cpp +0 -0
- {sharedbox-0.3.1 → sharedbox-0.4.0}/tests/cpp/consumer/CMakeLists.txt +0 -0
- {sharedbox-0.3.1 → sharedbox-0.4.0}/tests/cpp/test_atomics.cpp +0 -0
- {sharedbox-0.3.1 → sharedbox-0.4.0}/tests/cpp/test_fork.cpp +0 -0
- {sharedbox-0.3.1 → sharedbox-0.4.0}/tests/cpp/test_lock.cpp +0 -0
- {sharedbox-0.3.1 → sharedbox-0.4.0}/tests/cpp/test_slots.cpp +0 -0
- {sharedbox-0.3.1 → sharedbox-0.4.0}/tests/cpp/test_small_shm.cpp +0 -0
- {sharedbox-0.3.1 → sharedbox-0.4.0}/tests/cpp/test_wait.cpp +0 -0
- {sharedbox-0.3.1 → sharedbox-0.4.0}/tests/cpp/test_windows_h.cpp +0 -0
- {sharedbox-0.3.1 → sharedbox-0.4.0}/tests/cpp/unique.hpp +0 -0
- {sharedbox-0.3.1 → sharedbox-0.4.0}/tests/forged_open.py +0 -0
- {sharedbox-0.3.1 → sharedbox-0.4.0}/tests/refs_future.py +0 -0
- {sharedbox-0.3.1 → sharedbox-0.4.0}/tests/stress/stress_helpers.py +0 -0
- {sharedbox-0.3.1 → sharedbox-0.4.0}/tests/stress/test_stress_contention.py +0 -0
- {sharedbox-0.3.1 → sharedbox-0.4.0}/tests/stress/test_stress_crashes.py +0 -0
- {sharedbox-0.3.1 → sharedbox-0.4.0}/tests/stress/test_stress_follow.py +0 -0
- {sharedbox-0.3.1 → sharedbox-0.4.0}/tests/stress/test_stress_lock_timeout.py +0 -0
- {sharedbox-0.3.1 → sharedbox-0.4.0}/tests/stress/test_stress_memory.py +0 -0
- {sharedbox-0.3.1 → sharedbox-0.4.0}/tests/stress/test_stress_waiters.py +0 -0
- {sharedbox-0.3.1 → sharedbox-0.4.0}/tests/stress/test_stress_watchers.py +0 -0
- {sharedbox-0.3.1 → sharedbox-0.4.0}/tests/test_doc_tutorials.py +0 -0
- {sharedbox-0.3.1 → sharedbox-0.4.0}/tests/test_events_async.py +0 -0
- {sharedbox-0.3.1 → sharedbox-0.4.0}/tests/test_events_sync.py +0 -0
- {sharedbox-0.3.1 → sharedbox-0.4.0}/tests/test_fields.py +0 -0
- {sharedbox-0.3.1 → sharedbox-0.4.0}/tests/test_follow.py +0 -0
- {sharedbox-0.3.1 → sharedbox-0.4.0}/tests/test_fork.py +0 -0
- {sharedbox-0.3.1 → sharedbox-0.4.0}/tests/test_native_codec.py +0 -0
- {sharedbox-0.3.1 → sharedbox-0.4.0}/tests/test_native_liveness.py +0 -0
- {sharedbox-0.3.1 → sharedbox-0.4.0}/tests/test_native_wait.py +0 -0
- {sharedbox-0.3.1 → sharedbox-0.4.0}/tests/test_native_waiters.py +0 -0
- {sharedbox-0.3.1 → sharedbox-0.4.0}/tests/test_properties_codec.py +0 -0
- {sharedbox-0.3.1 → sharedbox-0.4.0}/tests/test_properties_stateful.py +0 -0
- {sharedbox-0.3.1 → sharedbox-0.4.0}/tests/test_refs_lazy.py +0 -0
- {sharedbox-0.3.1 → sharedbox-0.4.0}/tests/type_checks/box_types.py +0 -0
- {sharedbox-0.3.1 → sharedbox-0.4.0}/tests/type_checks/events_types.py +0 -0
|
@@ -118,7 +118,7 @@ jobs:
|
|
|
118
118
|
env:
|
|
119
119
|
CIBW_BUILD: ${{ matrix.python }}-${{ matrix.platform_id }}
|
|
120
120
|
CIBW_CONTAINER_ENGINE: "docker; create_args: --shm-size=1g"
|
|
121
|
-
CIBW_TEST_REQUIRES: pytest hypothesis
|
|
121
|
+
CIBW_TEST_REQUIRES: pytest hypothesis numpy
|
|
122
122
|
CIBW_TEST_COMMAND: pytest {project}/tests
|
|
123
123
|
with:
|
|
124
124
|
package-dir: .
|
|
@@ -7,6 +7,73 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
Dates are marked as `DD-MM-YYYY`
|
|
9
9
|
|
|
10
|
+
## [Unreleased]
|
|
11
|
+
|
|
12
|
+
## [0.4.0] - 05-10-2026
|
|
13
|
+
|
|
14
|
+
### Added
|
|
15
|
+
|
|
16
|
+
- `benchbox plot`: draws the results of `benchbox all` as SVG charts, in a
|
|
17
|
+
light and a dark variant. The `benchmarks` extra now includes
|
|
18
|
+
matplotlib.
|
|
19
|
+
- `SharedBox`: fields of type `complex`, `datetime.date`, `datetime.time`,
|
|
20
|
+
`datetime.datetime`, `datetime.timedelta`, `uuid.UUID` and
|
|
21
|
+
`Annotated[decimal.Decimal, Capacity(n)]`.
|
|
22
|
+
- `SharedBox`: `enum.Enum`, `enum.Flag` and `typing.Literal` fields.
|
|
23
|
+
- `SharedBox`: `X | None` and union fields.
|
|
24
|
+
- `SharedBox`: record fields: dataclasses, `NamedTuple`, fixed-length
|
|
25
|
+
tuples, `TypedDict`, attrs classes and `msgspec.Struct`.
|
|
26
|
+
- `SharedBox`: `list`, `tuple[T, ...]`, `set`, `frozenset`, `dict` and
|
|
27
|
+
`bytearray` fields and their `collections.abc` forms, with a `Capacity`
|
|
28
|
+
in elements.
|
|
29
|
+
- `Shape`, `DType`, `SupportsDLPack`, `register_array_type`: array fields
|
|
30
|
+
through DLPack.
|
|
31
|
+
- `sharedbox.hpp`: `type_view`, `handle::field_type`,
|
|
32
|
+
`handle::types_table`, `handle::major_version`, `oldest_layout_major`,
|
|
33
|
+
`time_value`, `datetime_value`, `timedelta_value`, the kind codes
|
|
34
|
+
`kind_complex` to `kind_decimal` and `kind_enum` to `kind_array`,
|
|
35
|
+
`max_type_depth`, `max_types_size`, `max_mapping_size`,
|
|
36
|
+
`first_described_kind`, `max_date_ordinal`, `unix_epoch_ordinal`,
|
|
37
|
+
`micros_per_day`, `max_offset_minutes`, `literal_none` to
|
|
38
|
+
`literal_enum`, `type_head`, `dl_dtype`, `literal_value`,
|
|
39
|
+
`encode_*` and `decode_*` functions for complex, date, time, datetime,
|
|
40
|
+
timedelta, uuid, flag and position values, `decode_bool`,
|
|
41
|
+
`decode_present`, `decode_tag`, `decode_length`, `handle::read_used`,
|
|
42
|
+
`handle::read_large`, `handle::read_record_large` and
|
|
43
|
+
`handle::write_large`.
|
|
44
|
+
- `sharedbox_c.h`: `sbx_field_desc`, the structs `sbx_time`,
|
|
45
|
+
`sbx_datetime` and `sbx_timedelta`, and typed reads and writes of
|
|
46
|
+
complex, date, time, datetime, timedelta, UUID, enum and literal
|
|
47
|
+
positions, flag bits and optional presence.
|
|
48
|
+
- `benchbox ops`: rows for datetime, record, list and array fields.
|
|
49
|
+
|
|
50
|
+
```python
|
|
51
|
+
class Frame(SharedBox):
|
|
52
|
+
taken: datetime.datetime
|
|
53
|
+
image: Annotated[np.ndarray, Shape(480, 640), DType("uint8")]
|
|
54
|
+
tags: Annotated[list[Annotated[str, Capacity(16)]], Capacity(8)] = field(default_factory=list)
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
### Changed
|
|
58
|
+
|
|
59
|
+
- Segments use layout 2.0. Releases 0.3.0 and 0.3.1 cannot open a box made
|
|
60
|
+
by this version; this version opens boxes made by them.
|
|
61
|
+
- `SharedBox.events` and `SharedBox.watch()`: a field counts as changed
|
|
62
|
+
when its stored bytes change. Writing `NaN` again no longer emits;
|
|
63
|
+
`-0.0` after `0.0` does.
|
|
64
|
+
- `Capacity`: also sets the most elements of a collection.
|
|
65
|
+
- `sharedbox.hpp`: the inline namespace is `v2`; `handle::create` and
|
|
66
|
+
`handle::create_unpublished` take a description table.
|
|
67
|
+
- The `benchmarks` extra includes numpy.
|
|
68
|
+
- `SharedBox.update` and `SharedBox.snapshot`: native methods, unless a
|
|
69
|
+
class defines or inherits its own.
|
|
70
|
+
|
|
71
|
+
### Fixed
|
|
72
|
+
|
|
73
|
+
- `SharedBox`: a class with more than one box base keeps the defaults and
|
|
74
|
+
default factories of the fields it inherits from every base, not only
|
|
75
|
+
the first.
|
|
76
|
+
|
|
10
77
|
## [0.3.1] - 01-10-2026
|
|
11
78
|
|
|
12
79
|
### Added
|
|
@@ -212,6 +279,8 @@ stage.events.nested.connect(lambda path, new, old: print(path, new))
|
|
|
212
279
|
|
|
213
280
|
- Initial release
|
|
214
281
|
|
|
282
|
+
[Unreleased]: https://github.com/jacopoabramo/sharedbox/compare/v0.4.0...HEAD
|
|
283
|
+
[0.4.0]: https://github.com/jacopoabramo/sharedbox/compare/v0.3.1...v0.4.0
|
|
215
284
|
[0.3.1]: https://github.com/jacopoabramo/sharedbox/compare/v0.3.0...v0.3.1
|
|
216
285
|
[0.3.0]: https://github.com/jacopoabramo/sharedbox/compare/0.2.4...v0.3.0
|
|
217
286
|
[0.2.4]: https://github.com/jacopoabramo/sharedbox/compare/0.1.0...0.2.4
|
|
@@ -13,8 +13,8 @@ the layout and the native module converts values.
|
|
|
13
13
|
```text
|
|
14
14
|
sharedbox/
|
|
15
15
|
|-- include/sharedbox/
|
|
16
|
-
| |-- sharedbox.hpp layout 1.0 and its protocols: create, publish, open, lock, read, write, waiter slots, capsule handle
|
|
17
|
-
| |-- sharedbox_c.h minimal C interface: sbx_open, sbx_import, sbx_read, sbx_write, sbx_schema_hash, sbx_release
|
|
16
|
+
| |-- sharedbox.hpp layout 2.0 (and 1.0 reading) and its protocols: create, publish, open, lock, read, write, description table, waiter slots, capsule handle
|
|
17
|
+
| |-- sharedbox_c.h minimal C interface: sbx_open, sbx_import, sbx_read, sbx_write, sbx_schema_hash, sbx_release, sbx_field_desc, typed sbx_read_* and sbx_write_*
|
|
18
18
|
| `-- sharedbox_c.cpp its implementation, compiled by the consumer (CMake target sharedbox::c)
|
|
19
19
|
|-- cmake/
|
|
20
20
|
| |-- sharedbox-config.cmake find_package(sharedbox) from an installed wheel; the build writes
|
|
@@ -24,6 +24,8 @@ sharedbox/
|
|
|
24
24
|
| |-- __init__.py re-exports the public API, get_include()
|
|
25
25
|
| |-- _box.py SharedBox: class keywords, fields, fields(), create/attach, __post_init__, update, snapshot, unlink, __sharedbox_box__
|
|
26
26
|
| |-- _layout.py Capacity, field() and Field, field offsets and kind codes, schema hash
|
|
27
|
+
| |-- _types.py annotation parsing into TypeSpec, the description table
|
|
28
|
+
| |-- _arrays.py Shape, DType, SupportsDLPack, register_array_type
|
|
27
29
|
| |-- _events.py BoxEvents, FieldWatch, the watcher thread
|
|
28
30
|
| |-- _follow.py BoxEvents.follow and unfollow: forwarding the events of boxes that references reach
|
|
29
31
|
| |-- _refs.py reference fields: BoxRef, the class registry, BrokenReferenceError, UnknownBoxClassError
|
|
@@ -31,16 +33,25 @@ sharedbox/
|
|
|
31
33
|
| |-- py.typed
|
|
32
34
|
| |-- benchmarks/ the benchbox command (extra: benchmarks)
|
|
33
35
|
| | |-- cli.py entry point; exits with an install hint without Typer
|
|
34
|
-
| | |-- _app.py Typer commands: ops, roundtrip, size, all
|
|
36
|
+
| | |-- _app.py Typer commands: ops, roundtrip, size, plot, all
|
|
35
37
|
| | |-- ops.py pyperf timings of single operations, against the stdlib
|
|
36
38
|
| | |-- roundtrip.py cross-process round trip percentiles
|
|
39
|
+
| | |-- plot.py SVG charts of the ops and roundtrip results (matplotlib)
|
|
37
40
|
| | |-- size.py wheel and extension size (standard library only)
|
|
38
41
|
| | `-- size_diff.py wheel size table against main, for CI (standard library only)
|
|
39
42
|
| `-- _native/
|
|
40
|
-
| |-- module.cpp nanobind module: Segment, the Field descriptor
|
|
41
|
-
|
|
|
43
|
+
| |-- module.cpp nanobind module: Segment, the Field descriptor, the BoxMethod type
|
|
44
|
+
| | (native update and snapshot) and the error classes
|
|
45
|
+
| |-- codec.{hpp,cpp} converts field values to and from their stored bytes; encode_all
|
|
46
|
+
| | checks every value of an update before any is written,
|
|
47
|
+
| | with_record reads the whole record at once
|
|
48
|
+
| |-- types.{hpp,cpp} Types: conversions of kinds above 5, arrays
|
|
49
|
+
| |-- scalars.{hpp,cpp} kinds 6 to 12, the datetime C API on full-API builds
|
|
42
50
|
| `-- segment.{hpp,cpp} Segment: a sharedbox::handle plus error messages and the lifetime lock
|
|
43
51
|
|-- tests/ pytest; many tests spawn processes
|
|
52
|
+
| |-- crossproc.py helpers that run a box in another process
|
|
53
|
+
| |-- forged_types.py builds segments with forged description tables
|
|
54
|
+
| |-- test_benchbox_plot.py benchbox plot; skipped without matplotlib and pyperf
|
|
44
55
|
| |-- test_capsule.py __sharedbox_box__, and the C consumer in tests/cpp/consumer/
|
|
45
56
|
| |-- test_doc_examples.py runs each docs/examples/*.py script
|
|
46
57
|
| |-- test_doc_tutorials.py runs docs/tutorials/motor.py and checks the output its pages show
|
|
@@ -59,7 +70,7 @@ sharedbox/
|
|
|
59
70
|
|-- docs/ Diataxis site built by Zensical: tutorials/, how-to/, explanation/, reference/
|
|
60
71
|
| |-- tutorials/motor.py the script the three tutorials build and include
|
|
61
72
|
| |-- examples/ one script per how-to guide, included by the guide
|
|
62
|
-
| `-- reference/segment-layout.md layout 1.0, names and protocols
|
|
73
|
+
| `-- reference/segment-layout.md layout 2.0 and 1.0, names and protocols
|
|
63
74
|
|-- includes/abbreviations.md acronym tooltips appended to every page
|
|
64
75
|
|-- zensical.toml site configuration and navigation
|
|
65
76
|
|-- .github/workflows/ci.yaml lint, docs check, C++ tests, cibuildwheel wheels, tests, stress,
|
|
@@ -92,42 +103,43 @@ the class's identity (the `identity` class keyword, by default
|
|
|
92
103
|
`module.qualname`, with `__mp_main__` counted as `__main__`). Creating
|
|
93
104
|
always asks for a new name and raises `SegmentExistsError` if it is taken.
|
|
94
105
|
|
|
95
|
-
Layout
|
|
106
|
+
Layout 2.0, from offset 0:
|
|
96
107
|
|
|
97
108
|
- Header, 128 bytes. Line 0, written once at creation: `magic`,
|
|
98
|
-
`layout_major`
|
|
99
|
-
`schema_hash`, `record_size`, `record`, `tail` (always 128), `size`,
|
|
100
|
-
|
|
101
|
-
|
|
109
|
+
`layout_major` 2, `layout_minor` 0, `field_count`, `waiter_slots`,
|
|
110
|
+
`schema_hash`, `record_size`, `record`, `tail` (always 128), `size`,
|
|
111
|
+
`types_size` (offset 60; 0 in layout 1.0), and the creator fields
|
|
112
|
+
`create_id`, `creator_start`, `creator_pid`. Line 1, changed by writes
|
|
113
|
+
and waits: `seq` (sequence lock; the generation is
|
|
102
114
|
`seq >> 1`, there is no generation field), `writer_pid`, `wake_word`,
|
|
103
115
|
`waiters`, `creator_pidns`. Both lines keep reserved zero bytes.
|
|
104
116
|
- The tail: `field_count` field table entries of 8 bytes (`u32 offset`,
|
|
105
|
-
`u32 capacity_and_kind`:
|
|
106
|
-
|
|
107
|
-
|
|
117
|
+
`u32 capacity_and_kind`: top 8 bits the kind code, the low 24 the
|
|
118
|
+
capacity or size, or for kinds 64 and up the offset of the field's
|
|
119
|
+
description), one `u64` write count per field, then `waiter_slots` slots
|
|
120
|
+
of 24 bytes (`owner_start`, `owner_pidns`, `owner_pid`, `interrupt`),
|
|
121
|
+
then the description table of `types_size` bytes. Kinds are 0 to 5 as
|
|
122
|
+
in layout 1.0, 6 to 12 (fixed-size scalars) and 64 to 74 (described
|
|
123
|
+
types).
|
|
108
124
|
- The record, at a multiple of 64. The mapping size is rounded up to 4 KiB.
|
|
125
|
+
`record + record_size <= 2**32 - 4096`.
|
|
109
126
|
|
|
110
127
|
`magic` is stored last on create, with release ordering, after the initial
|
|
111
|
-
values are in the record; attach waits for it. Attach
|
|
112
|
-
`layout_major
|
|
113
|
-
copies the field table and uses only the copy.
|
|
114
|
-
`sharedbox.hpp` check every `sizeof` and `offsetof`.
|
|
128
|
+
values are in the record; attach waits for it. Attach accepts
|
|
129
|
+
`layout_major` 1 and 2 and refuses another, checks every geometry field
|
|
130
|
+
against the mapping size, copies the field table and uses only the copy.
|
|
131
|
+
`static_assert`s in `sharedbox.hpp` check every `sizeof` and `offsetof`.
|
|
115
132
|
|
|
116
133
|
### Record encoding
|
|
117
134
|
|
|
118
|
-
Fields are packed by descending alignment
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
135
|
+
Fields are packed by descending alignment, not declaration order, each
|
|
136
|
+
starting at a multiple of its own alignment. The native module converts
|
|
137
|
+
values to and from these bytes; nothing is pickled. Everything is
|
|
138
|
+
little-endian. `docs/reference/segment-layout.md` gives every kind and its
|
|
139
|
+
bytes.
|
|
122
140
|
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
- `float`: 8 bytes, IEEE 754 double.
|
|
126
|
-
- `str`, `bytes`: `u32` length, then up to `capacity` bytes (UTF-8 for `str`).
|
|
127
|
-
- `ref` (kind 5): 144 bytes, `u64 create_id` (0 = empty), `u64 schema_hash`,
|
|
128
|
-
then the box name NUL-padded to 128 bytes.
|
|
129
|
-
|
|
130
|
-
At most 256 fields; a capacity is 1 byte to 1 MiB.
|
|
141
|
+
At most 256 fields; a capacity is 1 byte to 1 MiB, and a collection's
|
|
142
|
+
capacity counts elements, 1 to 1048576.
|
|
131
143
|
|
|
132
144
|
### Lifecycle
|
|
133
145
|
|
|
@@ -44,7 +44,9 @@ nanobind_add_module(_native
|
|
|
44
44
|
NB_DOMAIN sharedbox
|
|
45
45
|
src/sharedbox/_native/codec.cpp
|
|
46
46
|
src/sharedbox/_native/module.cpp
|
|
47
|
-
src/sharedbox/_native/
|
|
47
|
+
src/sharedbox/_native/scalars.cpp
|
|
48
|
+
src/sharedbox/_native/segment.cpp
|
|
49
|
+
src/sharedbox/_native/types.cpp)
|
|
48
50
|
target_link_libraries(_native PRIVATE sharedbox::headers)
|
|
49
51
|
|
|
50
52
|
if(WIN32)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: sharedbox
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.4.0
|
|
4
4
|
Summary: Python containers using shared memory.
|
|
5
5
|
Author-Email: Jacopo Abramo <jacopo.abramo@gmail.com>
|
|
6
6
|
License-Expression: Apache-2.0
|
|
@@ -16,6 +16,8 @@ Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
|
16
16
|
Requires-Python: >=3.11
|
|
17
17
|
Requires-Dist: psygnal>=0.16.1
|
|
18
18
|
Provides-Extra: benchmarks
|
|
19
|
+
Requires-Dist: matplotlib>=3.11.2; extra == "benchmarks"
|
|
20
|
+
Requires-Dist: numpy>=2.4.6; extra == "benchmarks"
|
|
19
21
|
Requires-Dist: pyperf>=2.10.0; extra == "benchmarks"
|
|
20
22
|
Requires-Dist: typer>=0.27.2; extra == "benchmarks"
|
|
21
23
|
Description-Content-Type: text/markdown
|