Skip to main content

rpmfile

Tests PyPI version

Tools for inspecting RPM files in python. This module is modeled after the tarfile module.

Install

$ python -m pip install -U rpmfile

If you want to use rpmfile with zstd compressed rpms, you'll need to install the zstandard module.

zstd also requires that you are using Python >= 3.5

$ python -m pip install -U zstandard

Example

See the tests for more examples.

import rpmfile

with rpmfile.open('file.rpm') as rpm:

    # Inspect the RPM headers
    print(rpm.headers.keys())
    print(rpm.headers.get('arch', 'noarch'))

    # Extract a fileobject from the archive
    fd = rpm.extractfile('./usr/bin/script')
    print(fd.read())

    for member in rpm.getmembers():
        print(member)

Command line usage

You can use rpmfile via it's module invocation or via rpmfile command if your PATH environment variable is configured correctly. Pass --help for all options.

List RPM contents

curl -sfL 'https://example.com/some.rpm.gz' | gzip -d - | python -m rpmfile -l -
./path/to/file

Extract files

curl -sfL 'https://example.com/some.rpm.gz' | gzip -d - | rpmfile -xv -
./path/to/file

Extract files to directory

curl -sfL 'https://example.com/some.rpm.gz' | gzip -d - | rpmfile -xvC /tmp -
/tmp/path/to/file

Display RPM information (similar to command rpm -qip in Linux)

curl -sfL 'https://example.com/some.rpm.gz' |gzip -d - | rpmfile -i -
Name        : something
Version     : 1.02
Release     : 1
Architecture: noarch
Group       : default
Size        : 1234
License     : BSD
Signature   : None
Source RPM  : some.src.rpm
Build Date  : Tue Apr  9 08:55:16 2019
Build Host  : demo
URL         : http://example.com/some
Summary     : Example of something
Description : 
The description of something.
It can display more than one line.

Classes

  • rpmfile.RPMFile: The RPMFile object provides an interface to a RPM archive
  • rpmfile.RPMInfo: An RPMInfo object represents one member in a RPMFile.

Contributing

The black formater should be used on all files before submitting a contribution. Version 19.10b0.

$ pip install black==26.3.1
$ black .

Code in this module was borrowed from:

Release files for rpmfile 2.2.1

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

Source distribution (sdist)

Source distribution for rpmfile 2.2.1
File Size Uploaded
rpmfile-2.2.1.tar.gz 15.3 kB Details

Built distribution (wheel)

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

Total release size: 33.3 kB

Release files / rpmfile-2.2.1.tar.gz

Download URL rpmfile-2.2.1.tar.gz
Size 15.3 kB
Tags Source
SHA-256 checksum
How to use checksums
8ffc44d15f8d2b6cad1ea885b09e1ca5f1744532c24710554f3fe4873506e9da
BLAKE2b-256 checksum
How to use checksums
5fe9a9befd2823e8a52630fc35af5167c806c1d65899eeeda0833e7b8c21765e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

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 May 6, 2026.

Transparency log

Release files / rpmfile-2.2.1-py3-none-any.whl

Download URL rpmfile-2.2.1-py3-none-any.whl
Size 18.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
bf2a4c488702638a95b85c4852891390bb8e54d174569c217fb21f591ead19c3
BLAKE2b-256 checksum
How to use checksums
b8d42500c7778e14d7b98209fc5da575bea8c4c9c24edd7fb8be509e02de53d7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

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 May 6, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

2.2.1 This release

2 release files

2.2.0

2 release files

2.1.0

2 release files

2.0.0

2 release files

1.1.1

2 release files

1.0.8

2 release files

1.0.7

2 release files

1.0.6

2 release files

1.0.5

1 release file

1.0.4

1 release file

1.0.3

1 release file

1.0.2

1 release file

1.0.1

1 release file

1.0.0

2 release files

0.1.6

1 release file

0.1.4

1 release file

0.1.3

1 release file

0.1.2

1 release file

0.1.1

1 release file

0.1

1 release file

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