Dealing with json and bson files
Project description
cvxbson
IPC
IPC stands for InterProcess Communication. It is a mechanism that allows to share data between processes. A traditional way to do so is to use json files. Json files are rather flexible and can be used to share data between different programming languages. However, they are not very efficient.
Here we use their binary counterpart, bson files. Bson files are much more efficient but somewhat lack the flexibility of json files. Here we rely on the bson package to read and write bson files. We are interested in parsing dictionaries of numpy arrays, pandas and polars dataframes as fast as possible.
There might be faster ways to achieve this goal and we are open to suggestions and pull requests.
We recommend using json files to transfer configurations and small amounts of data. Bson files can then be used to transfer large matrices. A coexistence is possible and encouraged.
Demo
import numpy as np
from src.cvx.bson import read_bson, write_bson
data = {"A": np.random.rand(50, 50), "B": np.random.rand(50)}
write_bson("test.bson", data)
recovered = read_bson("test.bson")
assert np.allclose(data["A"], recovered["A"])
assert np.allclose(data["B"], recovered["B"])
We have also implemented the same functionality in for json files but would advise against using it. It is much slower and less efficient.
You may want to avoid the explicit construction of files. It is possible to work directly with bson strings. We provide methods for that, too.
uv
You need to install task. Starting with
task cvxbson:install
will install uv and create the virtual environment defined in pyproject.toml and locked in uv.lock.
marimo
We install marimo on the fly within the aforementioned virtual environment. Executing
task cvxbson:marimo
will install and start marimo.
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 Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file cvxbson-0.1.3.tar.gz.
File metadata
- Download URL: cvxbson-0.1.3.tar.gz
- Upload date:
- Size: 58.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
819a45104b4cc448566307710317dad7d4f3e0998209b31ecff8e52edd9e0309
|
|
| MD5 |
8cd9601082ecf1d17b1bcd78040248b7
|
|
| BLAKE2b-256 |
df36df50f2c1e1d5f0ac413cf6443e4dd81f60c4fa88fbe71de172cae2379641
|
Provenance
The following attestation bundles were made for cvxbson-0.1.3.tar.gz:
Publisher:
release.yml on cvxgrp/cvxbson
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
cvxbson-0.1.3.tar.gz -
Subject digest:
819a45104b4cc448566307710317dad7d4f3e0998209b31ecff8e52edd9e0309 - Sigstore transparency entry: 167762170
- Sigstore integration time:
-
Permalink:
cvxgrp/cvxbson@c55244dcc435a22a819476e5918f06bf6ab86353 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/cvxgrp
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@c55244dcc435a22a819476e5918f06bf6ab86353 -
Trigger Event:
workflow_run
-
Statement type:
File details
Details for the file cvxbson-0.1.3-py3-none-any.whl.
File metadata
- Download URL: cvxbson-0.1.3-py3-none-any.whl
- Upload date:
- Size: 12.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d0fc0e2714da47a5adbdc4e3b13a514920a29af167d1100b60436055ffcbea38
|
|
| MD5 |
b6fdbe6fa6787c377ab4ec68230722ca
|
|
| BLAKE2b-256 |
bedc82255070ab9db3e044db8a34aa16bb18ea280e469ea50a2e7242c694f936
|
Provenance
The following attestation bundles were made for cvxbson-0.1.3-py3-none-any.whl:
Publisher:
release.yml on cvxgrp/cvxbson
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
cvxbson-0.1.3-py3-none-any.whl -
Subject digest:
d0fc0e2714da47a5adbdc4e3b13a514920a29af167d1100b60436055ffcbea38 - Sigstore transparency entry: 167762172
- Sigstore integration time:
-
Permalink:
cvxgrp/cvxbson@c55244dcc435a22a819476e5918f06bf6ab86353 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/cvxgrp
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@c55244dcc435a22a819476e5918f06bf6ab86353 -
Trigger Event:
workflow_run
-
Statement type: