Skip to main content

distroinfo

distroinfo is a python module for parsing, validating and querying distribution/packaging metadata stored in human readable and reviewable text/YAML files.

This is a proper generic (re)implementation of rdoinfo parser which proved well suited for the task of interfacing with distribution metadata in a human friendly way. If you consider code reviews human friendly, that is.

distroinfo is a part of Software Factory project

STATUS

distroinfo is available from Fedora/EPEL repos and is BEING INTEGRATED.

rdopkg and DLRN are first adopters.

rdoinfo compatibility is ensured through offline and online tests.

CI is enabled.

See distroinfo reviews.

Use github Issues to make requests and report bugs.

Installation

from source

If you want to hack distroinfo or just have the latest code without waiting for next release, you can use the git repo directly:

git clone https://github.com/softwarefactory-project/distroinfo
cd distroinfo
python setup.py develop --user

You may set the preference over distroinfo RPM by correctly positioning ~/.local/bin/distroinfo in your $PATH.

Or you can use virtualenv to avoid conflicts with RPM:

git clone https://github.com/softwarefactory-project/distroinfo
cd distroinfo
virtualenv --system-site-packages ~/distroinfo-venv
source ~/distroinfo-venv/bin/activate
python setup.py develop
ln `which distroinfo` ~/bin/distroinfo-dev

distroinfo-dev --version

Required python modules are listed in requirements.txt.

from Fedora/EPEL repos (default)

distroinfo is available on Fedora 27 and newer:

dnf install python2-distroinfo

including Python 3 version:

dnf install python3-distroinfo

On CentOS/RHEL 7, distroinfo is available from EPEL.

On CentOS 7:

yum install epel-release
yum install python2-distroinfo

On RHEL 7:

yum install https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
yum install python2-distroinfo

from PyPI

For your convenience, distroinfo is available from the Cheese Shop:

pip install distroinfo

Usage

You can fetch info files from an URL by specifying remote_info base URL:

from distroinfo.info import DistroInfo

RDOINFO_RAW_URL = \
    'https://raw.githubusercontent.com/redhat-openstack/rdoinfo/master/'

di = DistroInfo('rdo-full.yml',
                remote_info=RDOINFO_RAW_URL)
info = di.get_info()

Or you can fetch info files from a remote git repository using remote_git_info:

from distroinfo.info import DistroInfo

RDOINFO_GIT_URL = \
    'https://github.com/redhat-openstack/rdoinfo'

di = DistroInfo('rdo-full.yml',
                remote_git_info=RDOINFO_GIT_URL)
info = di.get_info()

Or you can fetch info files from a local directory using local_info:

from distroinfo.info import DistroInfo

INFO_PATH = '/path/to/info'

di = DistroInfo('rdo-full.yml',
                local_info=INFO_PATH)
info = di.get_info()

For remote fetchers info files/repos are cached in ~/.distroinfo/cache.

You can navigate info structure yourself or use query module:

from distroinfo import query

# get a package info by strict package name
nova = query.get_package(info, 'openstack-nova')

# find a package by human reference (smart search)
keystone = query.find_package(info, 'keystone')

Alternatively, you can get info with packages and releases as dictionaries indexed by project/release name for easier access using info_dicts=True:

info = di.get_info(info_dicts=True)
nova = info['packages']['nova']

It is also possible to filter packages matching a given criteria. The following query will show all packages matching criteria conf: client AND tags: antelope.

::

# rexen is a dictionary of applied filters. # pkg is the currently processed package. info = di.get_info() pkgs = info[‘packages’] rexen = {“conf”: “client”, “tags”: “antelope”}

finding = query.filter_pkgs(pkgs, rexen)

It is also possible to apply negative filtering with “~” character, which can be combined with other filters, like conf: client.

::

info = di.get_info() pkgs = info[‘packages’] rexen = {“tags”: “~newton”, “conf”: “client”} finding = query.filter_pkgs(pkgs, rexen)

When using this feature, the output will contain packages WITHOUT newton tag but containing conf:client.

Until proper documentation is in place, please refer to:

Command Line Interface

A simple CLI is provided in scripts/di.py which can be used to test basic distroinfo functionality, profile, dump parsed data, etc.

An example of dumping parsed rdoinfo into both YAML and JSON files:

$> ./scripts/di.py dump -y rdoinfo.yaml -j rdoinfo.json -f git \
       'https://github.com/redhat-openstack/rdoinfo' rdo-full.yml

Dumping YAML to: rdoinfo.yaml
Dumping JSON to: rdoinfo.json

Additional docopt module is required to run the CLI.

Bugs

Please use the github Issues to report bugs.

Metadata

Release files for distroinfo 0.6.3

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

Source distribution (sdist)

Source distribution for distroinfo 0.6.3
File Size Uploaded Provenance Actions
distroinfo-0.6.3.tar.gz 242.0 kB Without provenance Details for distroinfo-0.6.3.tar.gz

Built distribution (wheel)

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

Total release size: 262.5 kB

Release files / distroinfo-0.6.3.tar.gz

Download URL distroinfo-0.6.3.tar.gz
Size 242.0 kB
Tags Source
SHA-256 checksum
How to use checksums
0c26340b5f4c0f7f51c2ea713995609c68c12fa3373cc5c303a4e74f20cd1fbd
BLAKE2b-256 checksum
How to use checksums
bb38cda3a80e4450b882042dbb02f41ad2487205aef476bc6ef28385835b9100
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.12.3

Release files / distroinfo-0.6.3-py3-none-any.whl

Download URL distroinfo-0.6.3-py3-none-any.whl
Size 20.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4409fdec9d5af8bebd24316be4cf477253e2ff61d0c587aded718d06eded0534
BLAKE2b-256 checksum
How to use checksums
ac67a946f13f2693aa5f28d0053fb18799f0b67449dabd70bc2ce36372179d26
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.12.3

Security for distroinfo 0.6.3

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

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