Skip to main content

python handle for reading sif images

Project description

# SIF (Python)

Sif Python (sif) is the Python API for working with the Singularity SIF image
format. This library is under development, and contributions are welcome!
The basic functionality so far is to parse the header, only using Python:

from sif.main import SIFHeader

boxes.simg is a SIF file.
SIF Header version 01
SIF Header arch 02
SIF Header uuid 0eae46df-1975-e44c-888b-8b9915f87f52
SIF Header ctime 1544537033
SIF Header mtime 1546726508
SIF Header dfree 45
SIF Header dtotal 48
SIF Header descroff 4096
SIF Header descrlen 28080
SIF Header dataoff 32768
SIF Header datalen 196953019

Architecture: AMD64 arch code

Deffile Datatype 16385
Deffile Used True
Deffile ID 1
Deffile Groupid 4026531841
Deffile Link 0
Deffile Fileoff 32768
Deffile Filelen 39
Deffile Storelen 39
Deffile Ctime 1544537033
Deffile Mtime 1544537033
Deffile UID 0
Deffile Gid 0
Deffile name .
Deffile extra

Partition Datatype 16388
Partition Used True
Partition ID 2
Partition Groupid 4026531841
Partition Link 0
Partition Fileoff 36864
Partition Filelen 196947968
Partition Storelen 196952025
Partition Ctime 1544537033
Partition Mtime 1544537033
Partition UID 0
Partition Gid 0
Partition name squashfs-955608129.img
Partition fstype 1
Partition partype 2
Partition extra 02

Signature Datatype 16389
Signature Used True
Signature ID 3
Signature Groupid 4026531841
Signature Link 2
Signature Fileoff 196984832
Signature Filelen 955
Signature Storelen 955
Signature Ctime 1546726508
Signature Mtime 1546726508
Signature UID 0
Signature Gid 0
Signature name part-signature
Signature hastype 2
Signature publicKey -----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256



## Usage

By default, the SIF header version provided is the most up to date with Singularity.
If you need to specify a particular header, set the environment variable for it:


### Python

In Python, you will likely want to start with an image, and load it for inspection.
The client will quickly tell you if it's a SIF header or not based on the `SIF_MAGIC`
after the interpreter line:

**This is a SIF image**

image = 'salad.simg'
from sif.main import SIFHeader
header = SIFHeader(image)

boxes.simg is a SIF file.
Architecture: AMD64 arch code
Found SIF version 01
Found SIF arch 02

You don't have to load the header right away:

header = SIFHeader('boxes.simg', load=False)
boxes.simg is a SIF file.


Architecture: AMD64 arch code
Found SIF version 01
Found SIF arch 02

**This is not a SIF image**

image = 'salad.simg'
from sif.main import SIFHeader
header = SIFHeader(image)
ERROR salad.simg is not a SIF file.

## Licenses

This code is licensed under the Affero GPL, version 3.0 or later [LICENSE](LICENSE).
The SIF Header format is licesed by [Sylabs](

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

sif-0.0.11.tar.gz (38.1 kB view hashes)

Uploaded source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page