Skip to main content

SquashFSSpec

SquashFSSpec Logo

Tests Python Version License: MIT PyPI

A simple fsspec driver for reading SquashFS files.

SquashFSSpec allows you to treat a SquashFS image as a filesystem, enabling seamless integration with tools like xarray, dask, and zarr without needing to mount the image.

Installation

You can install squashfsspec via pip from GitHub:

pip install squashfsspec

Or using pixi:

pixi add squashfsspec --git https://github.com/observingClouds/squashfsspec.git

Usage

Basic Usage with fsspec

import fsspec

squashfs_path = "path/to/your.squash"

# Open a SquashFS file
fs = fsspec.filesystem("squashfs", fo=squashfs_path)

# List files
print(fs.ls("/"))

# Open and read a file
with fs.open("some/file.txt", "rb") as f:
    print(f.read().decode())

Working with Xarray and Zarr

If you have a Zarr store inside a SquashFS image, you can open it directly with xarray:

import xarray as xr

squashfs_path = "path/to/data.squash"

# Open a Zarr store inside a SquashFS file
ds = xr.open_dataset(
    "squashfs:///",
    engine="zarr",
    consolidated=False,  # Set to True if your Zarr store is consolidated
    backend_kwargs={"storage_options": {"fo": squashfs_path}},
)

print(ds)

Accessing Multiple Datasets

If your SquashFS image contains multiple Zarr stores or datasets, you can access them by specifying the internal path:

import xarray as xr

squashfs_path = "path/to/multidata.squash"
dataset_path = "path/in/squashfs/file/to/dataset.zarr"

# Open a specific dataset inside a SquashFS file containing multiple datasets
ds = xr.open_dataset(
    f"squashfs:///{dataset_path}::{squashfs_path}",
    engine="zarr",
    consolidated=True,
)

print(ds)

Development

This project uses pixi for dependency management and development workflows.

Setup

# Install dependencies and setup the dev environment
pixi install -e dev

Running Tests

pixi run -e dev pytest

License

This project is licensed under the MIT License.

Metadata

Release files for squashfsspec 0.1.5

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

Source distribution (sdist)

Source distribution for squashfsspec 0.1.5
File Size Uploaded
squashfsspec-0.1.5.tar.gz 14.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for squashfsspec 0.1.5
File Interpreter ABI Platform
squashfsspec-0.1.5-py3-none-any.whl Python 3 none any Details

Total release size: 29.5 kB

Release files / squashfsspec-0.1.5.tar.gz

Download URL squashfsspec-0.1.5.tar.gz
Size 14.2 kB
Tags Source
SHA-256 checksum
How to use checksums
72bad5358d86f367066cd8ff91303e0023d33d33c06c96d252a32a5a03784955
BLAKE2b-256 checksum
How to use checksums
e7f3d89d865536c0ec7458b8dc48d9a91c74b1fd289be073d7964f913204faf6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via pdm/2.29.2 CPython/3.14.7 Linux/6.17.0-1022-azure

Release files / squashfsspec-0.1.5-py3-none-any.whl

Download URL squashfsspec-0.1.5-py3-none-any.whl
Size 15.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f58833119699db91a1ed0976a9487b3ce54407d1b91e6dec322eccdad73d91c3
BLAKE2b-256 checksum
How to use checksums
848c17f06d2db3cc79601f51e7d9f9698f99706b31ddc08344defba26a811c8b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via pdm/2.29.2 CPython/3.14.7 Linux/6.17.0-1022-azure

Release history Release notifications | RSS feed

0.1.6

2 release files

This release

0.1.5 This release

2 release files

0.1.4

2 release files

0.1.0

2 release files

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