Skip to main content

Blockdevice

Build pytest Coverage AI Code

A Python library for creating and managing block devices with FUSE filesystem support. Provides persistent object storage with compression options and real-time synchronization capabilities.

Features

  • Block Device Operations: C++ extension for efficient block device operations
  • FUSE Filesystem: Mount block devices as user-space filesystems
  • Persistent Storage: Multiple storage backends including disk-based and compressed storage
  • Real-time Sync: Network synchronization for distributed applications
  • Python Integration: Seamless integration with Python applications

Installation

From Source

git clone https://github.com/Omena0/blockdevice.git
cd blockdevice
pip install .

Quick Start

Basic Usage

from blockdevice import BlockDevice, DiskObject

# Create a block device
dev = BlockDevice("/path/to/device", dolphin=True)

# Create persistent storage
storage = DiskObject("data.pkl")
storage['key'] = 'value'
print(storage['key'])  # 'value'

dev.start(True) # Start FUSE filesystem

Compressed Storage

from blockdevice import CompressedDiskObject

# Create compressed persistent storage
storage = CompressedDiskObject("data.zst", compression_level=10)
storage['large_data'] = 'x' * 10000  # Automatically compressed

Network Synchronization

from blockdevice import NetworkObject

# Create synchronized object (connects to server or becomes server)
sync_obj = NetworkObject('localhost', 8080)
sync_obj['shared_data'] = 'available on all connected instances'

Architecture

The library consists of several key components:

  • BlockDevice: C++ extension providing low-level block operations
  • Storage Objects:
    • Object: Abstract base class for persistent objects
    • DiskObject: Pickle-based disk storage
    • CompressedDiskObject: Zstd-compressed disk storage
    • NetworkObject: Real-time synchronized storage
  • FUSE Integration: BlockDeviceFUSE class for filesystem mounting

Development

Setup

git clone https://github.com/Omena0/blockdevice.git
cd blockdevice
python -m venv .venv
source .venv/bin/activate  # On Windows: .venv\Scripts\activate
pip install -r requirements.txt
pip install -e .

Testing

# Run all tests
pytest

# Run with coverage
pytest --cov=blockdevice --cov-report=html

# Run specific test file
pytest tests/test_utils.py

Building

# Build the C++ extension
python setup.py build_ext --inplace

# Build distribution
python setup.py sdist bdist_wheel

Examples

See the examples/ directory for sample applications:

  • compressed.py: Filesystem implementation with compression
  • network/: Client-server examples

API Reference

BlockDevice

BlockDevice(path: str, dolphin: bool = False)

Core block device operations.

Storage Classes

DiskObject

DiskObject(path: str, default_value=None)

Persistent dictionary stored as pickle file.

CompressedDiskObject

CompressedDiskObject(path: str, default_value=None, compression_level=5)

Compressed persistent storage using zstd.

NetworkObject

NetworkObject(host: str, port: int = None, default_value=None)

Real-time synchronized storage across network.

Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Add tests for new functionality
  4. Ensure all tests pass
  5. Submit a pull request

License

See LICENSE.md for license information.

Metadata

Release files for blockdevice 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for blockdevice 0.1.0
File Size Uploaded Provenance Actions
blockdevice-0.1.0.tar.gz 49.1 kB With provenance Details for blockdevice-0.1.0.tar.gz

Release files / blockdevice-0.1.0.tar.gz

Download URL blockdevice-0.1.0.tar.gz
Size 49.1 kB
Tags Source
SHA-256 checksum
How to use checksums
ef956d4d6c96c79a2463d1ff63e25387a36aa77a8a6b01b7a6897f9126b22cb6
BLAKE2b-256 checksum
How to use checksums
470d684e5a3af986a2c3b67cfb987496b0378f2f62d727698124ada3be90161b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 10, 2026.

Transparency log

Security for blockdevice 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

1 file in this release has been uploaded with provenance metadata.

Attestation for blockdevice-0.1.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 10, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page