API

Specification Interface

hallmarkfe.spec.parse_generic(arg)[source]

Create Hallmark specification object

Parameters:arg (object) – Specification (a dictionary) or file location (a string)
hallmarkfe.spec.register(cls)[source]

Register specification handler

Parameters:cls (class) – Handler class
hallmarkfe.spec.unregister(cls)[source]

Unregister specification handler

Parameters:cls (class) – Handler class
class hallmarkfe.spec.SpecRegistry[source]

Bases: object

Registry of all the loaded specification handlers

classmethod find_handler_for_schema(spec)[source]

Find loader for a given schema.

A class can load one or more schema types.

classmethod find_handler_generic(arg)[source]

Find the handler class and load file

A class can load one or more schema types.

classmethod register(cls)[source]

Add handler to the registry

classmethod schema_get(schema)[source]

List known schemas and handling classes

classmethod schema_list()[source]

List known schemas and handling classes

classmethod unregister(cls)[source]

Add handler to the registry

class hallmarkfe.spec.SpecMeta(name, bases, dct)[source]

Bases: abc.ABCMeta

Meta class for all elements with schemas. This allows for registration, validation, and tracking of the schema implementors.

mro() → list

return a type’s method resolution order

register(subclass)

Register a virtual subclass of an ABC.

Returns the subclass, to allow usage as a class decorator.

validate_handler(dct)[source]

Validate the class implementing schema

validate_handler_schema(dct)[source]

Validate schema specification

class hallmarkfe.spec.SpecBase(*args, **kwargs)[source]

Bases: object

Base abstract class for spec implementors

description

Property-like access to specification’s description element

dump()[source]

Return the specification as a dictionary

dumps()[source]

Dump the internal structure into JSON-formatted string

initialize(*args, **kwargs)[source]

Initialize the state of the metadata object

load(spec)[source]

Load a dictionary. Call element-specific handler if it exists.

loads(s)[source]

Load a serialized string into a object

classmethod match(schemas)[source]

Check if this handler can service a given set of schemas

This is a conservative function

name

Property-like access to specification’s name element

order = None

Order in which the elements must be stored/printed

owner

Property-like access to specification’s owner element

prettyprint(max_width=80)[source]

Dump content in a neat form..

schema = 'global:default:v1'

Every Spec metadata class should specify a schema (a string or a list of strings)

spec = None

Internal dict representation of the specification

required elements: name, description

validate(spec=None)[source]

Check if the spec is valid

Parameters:spec (dict) – Optional spec dict to be validated. If not specified, will use the class’s metadata attribute.
class hallmarkfe.spec.SpecManagerBase(*args, **kwargs)[source]

Bases: object

Manage a specification directory

clear()[source]

Clear the state

load(path)[source]

Load a directory

specs = None

Accept path and read list of spec files available in path.

required prefix: spec_

exception hallmarkfe.spec.SpecNoHandler[source]

Bases: Exception

Not class to handle metadata with a given schema

with_traceback()

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.

exception hallmarkfe.spec.SpecInvalidSchema[source]

Bases: Exception

Invalid schema definition

with_traceback()

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.

exception hallmarkfe.spec.SpecMissingSchema[source]

Bases: Exception

Schema not defined in the given merit subclass

with_traceback()

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.

exception hallmarkfe.spec.SpecInvalidSpecification[source]

Bases: Exception

Specification cannot be loaded due to missing or invalid fields.

with_traceback()

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.

CLI

hfe

Commandline for Hallmark Specifications

hfe [OPTIONS] COMMAND [ARGS]...

schema

Discovery and operation specification formats

hfe schema [OPTIONS] COMMAND [ARGS]...

list

List available schemas

hfe schema list [OPTIONS]