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.6

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.6
File Size Uploaded
squashfsspec-0.1.6.tar.gz 14.6 kB Details

Built distribution (wheel)

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

Total release size: 30.3 kB

Release files / squashfsspec-0.1.6.tar.gz

Download URL squashfsspec-0.1.6.tar.gz
Size 14.6 kB
Tags Source
SHA-256 checksum
How to use checksums
87fdc15f10e015362dd511935122325067df5e1fd8ff5ac8b6a1bc083890f7f7
BLAKE2b-256 checksum
How to use checksums
83268c83bcd075371a1dc66f1bf5055eed8eeb23e76a5ae9ed9ef92ed008bcee
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.6-py3-none-any.whl

Download URL squashfsspec-0.1.6-py3-none-any.whl
Size 15.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
eac8ea2a7d54053a5799529e468b1ffd4617a3d126339dd5492eda0bab1d3174
BLAKE2b-256 checksum
How to use checksums
859911264131dae7e9cdf1af2b6644378264884d70fbd6a08145bd6deddcbe7f
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

This release

0.1.6 This release

2 release files

0.1.5

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