modulemd package

Submodules

modulemd.api module

class modulemd.api.ModuleAPI[source]

Bases: object

Class representing a particular module API.

add_rpm(s)[source]

Adds a binary RPM package to the API set.

Parameters:s (str) – Binary RPM package name
clear_rpms()[source]

Clear the API binary RPM package set.

del_rpm(s)[source]

Removes the supplied package name from the API package set.

Parameters:s (str) – Binary RPM package name
rpms

A set of binary RPM packages defining this module’s API.

modulemd.artifacts module

class modulemd.artifacts.ModuleArtifacts[source]

Bases: object

Class representing a particular module artifacts.

add_rpm(s)[source]

Adds an NEVRA to the artifact set.

Parameters:s (str) – RPM NEVRA
clear_rpms()[source]

Clear the RPM artifacts set.

del_rpm(s)[source]

Removes the supplied NEVRA from the artifact set.

Parameters:s (str) – RPM NEVRA
rpms

A set of NEVRAs listing this module’s RPM artifacts.

modulemd.filter module

class modulemd.filter.ModuleFilter[source]

Bases: object

Class representing a particular module filter.

add_rpm(s)[source]

Adds a binary RPM package to the filter set.

Parameters:s (str) – Binary RPM package name
clear_rpms()[source]

Clear the filter binary RPM package set.

del_rpm(s)[source]

Removes the supplied package name from the filter package set.

Parameters:s (str) – Binary RPM package name
rpms

A set of binary RPM packages defining this module’s filter.

modulemd.profile module

class modulemd.profile.ModuleProfile[source]

Bases: object

Class representing a particular module profile.

add_rpm(s)[source]

Adds a binary RPM package to the profile set.

Parameters:s (str) – Binary RPM package name
clear_rpms()[source]

Clear the profile binary RPM package set.

del_rpm(s)[source]

Removes the supplied package name from the profile package set.

Parameters:s (str) – Binary RPM package name
description

A string property representing a detailed description of the profile.

rpms

A set of binary RPM packages included in this profile.

Module contents

Module metadata manipulation library.

A python library for manipulation of the proposed module metadata format.

Example usage:

import modulemd
mmd = modulemd.ModuleMetadata()
mmd.load("metadata.yaml")
mmd.add_module_license("ISC")
mmd.components.clear_rpms()
mmd.components.add_rpm("example", "with reason", multilib=["x86_64"])
mmd.dump("out.yaml")
class modulemd.ModuleMetadata[source]

Bases: object

Class representing the whole module.

REPODATA_FILENAME = 'modulemd'
add_buildrequires(n, v)[source]

Adds a module build dependency.

Parameters:
  • n (str) – Required module name
  • v (str) – Required module stream name
add_content_license(s)[source]

Adds a content license to the set.

Parameters:s (str) – License name
add_module_license(s)[source]

Adds a module license to the set.

Parameters:s (str) – License name
add_requires(n, v)[source]

Adds a required module dependency.

Parameters:
  • n (str) – Required module name
  • v (str) – Required module stream name
api

A ModuleAPI instance representing the module’s public API.

artifacts

A ModuleArtifacts instance representing the module’s artifacts.

buildopts

A ModuleBuildopts instance representing the additional module components build options.

buildrequires

A dictionary property representing the required build dependencies of the module.

Keys are the required module names (strings), values are their required stream names (also strings).

clear_buildrequires()[source]

Removes all build dependencies.

clear_content_licenses()[source]

Clears the content licenses set.

clear_module_licenses()[source]

Clears the module licenses set.

clear_requires()[source]

Removes all required runtime dependencies.

community

A string property representing a link to the upstream community for this module.

components

A ModuleComponents instance property representing the components defining the module.

content_licenses

A set of strings, a property, representing the license terms of the module contents.

del_buildrequires(n)[source]

Deletes the build dependency on the supplied module.

Parameters:n (str) – Required module name
del_content_license(s)[source]

Removes the supplied license from the content licenses set.

Parameters:s (str) – License name
del_module_license(s)[source]

Removes the supplied license from the module licenses set.

Parameters:s (str) – License name
del_requires(n)[source]

Deletes the dependency on the supplied module.

Parameters:n (str) – Required module name
description

A string property representing a detailed description of the module.

documentation

A string property representing a link to the upstream documentation for this module.

dump(f)[source]

Dumps the metadata into the supplied file.

Parameters:f (str) – File name of the destination
dumpd()[source]

Dumps the metadata into a dictionary.

Return type:dict
dumps()[source]

Dumps the metadata into a string.

Return type:str
filter

A ModuleFilter instance representing the module’s filter.

load(f)[source]

Loads a metadata file into the instance.

Parameters:f (str) – File name to load
loadd(d)[source]

Loads metadata from a dictionary.

Parameters:d (dict) – YAML metadata parsed into a dict
Raises:ValueError – If the metadata is invalid or unsupported.
loads(s)[source]

Loads metadata from a string.

Parameters:s (str) – Raw metadata in YAML
mdversion

An int property representing the metadata format version used.

This is automatically set to the highest supported version for new objects or set by the loaded document. This value can be changed to one of the supported_mdversions to alter the output format.

module_licenses

A set of strings, a property, representing the license terms of the module itself.

name

A string property representing the name of the module.

profiles

A dictionary property representing the module profiles.

requires

A dictionary property representing the required dependencies of the module.

Keys are the required module names (strings), values are their required stream names (also strings).

stream

A string property representing the stream name of the module.

summary

A string property representing a short summary of the module.

tracker

A string property representing a link to the upstream bug tracker for this module.

update_buildrequires(n, v)

Adds a module build dependency.

Parameters:
  • n (str) – Required module name
  • v (str) – Required module stream name
update_requires(n, v)

Adds a required module dependency.

Parameters:
  • n (str) – Required module name
  • v (str) – Required module stream name
version

An integer property representing the version of the module.

xmd

A dictionary property containing user-defined data.

modulemd.dump_all(f, l)[source]

Dumps a list of ModuleMetadata instances into a file.

Parameters:
  • f (str) – Output filename
  • l (list) – List of ModuleMetadata instances
modulemd.dumps_all(l)[source]

Dumps a list of ModuleMetadata instance into a YAML multidocument string.

Parameters:l (list) – List of ModuleMetadata instances
modulemd.load_all(f)[source]

Loads a metadata file containing multiple modulemd documents into a list of ModuleMetadata instances.

Parameters:f (str) – File name to load
modulemd.loads_all(s)[source]

Loads multiple modulemd documents from a YAML multidocument string.

Parameters:s (str) – String containing multiple YAML documents.