Registry / serialization / multivolumefile

multivolumefile

JSON →
library0.2.3pypypi✓ verified 50d ago

multivolumefile is a Python library that provides a file-like object wrapper to automatically split large files into multiple smaller 'volumes' during writing, and merge them back seamlessly during reading. It handles the underlying file operations, creating numbered volume files (e.g., `filename.000`, `filename.001`). The current version is 0.2.3, and it has a moderate release cadence, with several minor updates addressing stability and feature enhancements.

serializationdata
pip install multivolumefile
Install & Compatibility
Where this runs
tested against v0.2.3 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
glibc
py 3.10
4/5 runs
4/5 runs
py 3.11
4/5 runs
4/5 runs
py 3.12
4/5 runs
4/5 runs
py 3.13
4/5 runs
4/5 runs
py 3.9
4/5 runs
4/5 runs
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

MultiVolume
from multivolumefile import MultiVolume
from multivolume import MultivolumeFile
open
from multivolumefile import open
from multivolume import open

This quickstart demonstrates how to write data to a `MultivolumeFile` that automatically splits content into specified `volume_size` chunks, and then how to read the entire content back seamlessly. It also includes cleanup for the generated volume files.

from multivolume import MultivolumeFile import os # Define a base filename for our multivolume file base_filename = "my_test_multi_file" # --- Writing a multivolume file --- # The file will be split into volumes of 1024 bytes each with MultivolumeFile(base_filename, "wb", volume_size=1024) as f: f.write(b"Hello world. This is the first line.\n") # This line will likely span across volumes or start a new one f.write(b"This is a longer line that ensures multiple volumes are created if content is sufficient.\n") f.write(b"End of content.\n") print(f"Successfully wrote content to multivolume file(s) starting with '{base_filename}'.") # --- Reading a multivolume file --- # Open using the same base filename with MultivolumeFile(base_filename, "rb") as f: read_content = f.read() print("\n--- Read content ---") print(read_content.decode('utf-8')) # --- Cleanup (optional) --- # Remove the generated volume files import glob for f_path in glob.glob(f"{base_filename}.*"): os.remove(f_path) print(f"\nCleaned up files matching '{base_filename}.*'")
Debug
Known issues
gotchaWhen reading an existing multivolume file, you must open it using the *base filename* (e.g., 'my_file'). Do not attempt to open individual volume files (e.g., 'my_file.000', 'my_file.001') directly with `MultivolumeFile`, as this will not work as expected and might lead to `FileNotFoundError` or incorrect behavior as the library expects the base name to manage the set of volumes.
fix
Always use `MultivolumeFile("my_base_filename", "rb")` to read a multivolume set.
affects: All versions
gotchaThe `volume_size` parameter is crucial when writing. If omitted, it defaults to a very large value (or no explicit split) effectively creating a single file. Forgetting to set an appropriate `volume_size` can lead to the library not splitting files as intended, or conversely, setting it too small can create an excessive number of tiny files.
fix
Explicitly define `volume_size` in the constructor, e.g., `MultivolumeFile('filename', 'wb', volume_size=1024 * 1024)` for 1MB volumes.
affects: All versions
breakingEarlier versions (pre-0.1.4) had known issues with append mode (`'ab'`), potentially leading to incorrect data writing or file corruption. While fixed in later releases, relying on append mode in very old versions is unstable. It's generally safer to rewrite the entire multivolume file if data integrity is paramount, or carefully test append operations.
fix
Upgrade to version 0.1.4 or newer for stable append mode behavior. When possible, prefer writing in 'wb' mode for fresh data or full overwrites.
affects: <0.1.4
breakingThe `multivolume` library is not installed in the environment. This will lead to a `ModuleNotFoundError` when attempting to import or use it.
fix
Ensure the library is installed using `pip install multivolume` before running scripts that depend on it. It is also recommended to use a virtual environment.
affects: All versions
gotchaThe `multivolume` library was not found in the environment. This typically indicates that the package is not installed (e.g., via `pip install multivolume`) or that the Python interpreter's path does not include the installation location, leading to a `ModuleNotFoundError`.
fix
Ensure the `multivolume` library is installed in the test environment by running `pip install multivolume`.
affects: All versions
Upgrade
Version history
0.2.3latest on PyPI
Audit
Dependencies

No dependency data recorded yet.

Agent activity
12 hits · last 30 days
node
4
ahrefsbot
3
seranking-bot
3
Meta
1
Resources