amt package¶
Module contents¶
Top-level package for Artifact Management Tool.
-
amt.uid(source)[source]¶ Return a dictionary of unique id’s.
The entire data structure loaded from the given source will be searched for unique id’s, and a dictionary will be returned that contains all the unique id’s as keys, and the source document as a value.
- Parameters
source (str or dict) – A path to a file or directory or a dictionary
documenents with unique id's. (containing) –
- Returns
The return dictioanry.
- Return type
dict
-
amt.render(source)[source]¶ Render a set of artifacts.
The target can be a directory or file, and can contain plain yaml, or canonicalized artifact data. If a directory is specified, it will be walked recursively and all files will be loaded into the return data structure.
- Parameters
source (string) – The directory or file to be loaded.
- Returns
dict. The fully read data structure containing all artifacts from the loaded target.
-
amt.rendernode(value, uids)[source]¶ The node renderer. This is a mako template implementation of a node renderer, but is intended to be overwritten by users wanting to use a different rendering engine.
Note: If there is any error during the rendering of a node, it should be logged as an error, and the original content of the node must be returned.
- Parameters
value (string) – The content of the node to be rendered in the artifacts tree.
uids (dict) – Map of artifacts to unique identifiers.
- Returns
The renderend node.
- Return type
string
-
amt.canonical(path)[source]¶ Enforce a canonical representation of the artifact tree.
When directly working with artifact trees, there are many different representations of formatting that will result in the same artifact tree. This can cause issues when colaboratively working an atrifact tree within a version control system. This function will return a consistently formatted artifact tree to ensure no user specific style is captured.
- Parameters
path (str) – The artifact tree location.
- Returns
A canonical representation of the input artifacts tree.
- Return type
string
-
amt.save(path, data, header=None, footer=None)[source]¶ Save an artifacts tree to a file or directory location.
- Parameters
path (str) – The file or directory location to save the artifacts tree to.
data (str or list or dict) – The artifacts tree.
header (
str, optional) – Header for artifacts files.footer (
str, optional) – Footer for artifacts files.
-
amt.load(target, toplevel=True)[source]¶ Load a directory or file containing artifacts.
The target can be a directory or file, and can contain plain yaml, or canonicalized artifact data. If a directory is specified, it will be walked recursively and all files will be loaded into the return data structure.
- Parameters
target (str) – The directory or file to be loaded.
toplevel (bool, optional) – Utilized in recursive operations with this function.
- Returns
- The fully read data structure containing all
artifacts from the loaded target.
- Return type
dict or list or string
-
class
amt.MetaDict[source]¶ Bases:
dictDictionary with metadata.
This object is used to store dictionaries in an object tree with metadata about source. An example is if an artifact tree is loaded from a heirarchy of files, then then relative path information of source files will be stored in the metadata.