graviti.portex.builder#

Portex type builder related classes.

Module Contents#

Classes#

PackageRepo

The local git repo of the external Portex package.

PackageBuilder

The builder of the external Portex package.

TypeBuilder

The builder of the external Portex template type.

BuilderImports

The imports of the Portex template type.

Functions#

build_package(url, revision)

Build an external package.

Attributes#

graviti.portex.builder.EXTERNAL_TYPE_TO_CONTAINER[source]#
class graviti.portex.builder.PackageRepo(url, revision)[source]#

The local git repo of the external Portex package.

Parameters
  • url (str) – The git repo url of the external package.

  • revision (str) – The git repo revision (tag/commit) of the external package.

get_root(self)[source]#

Get the root directory path of the package repo.

Returns

The root directory path of the package repo.

Raises

TypeError – when the “ROOT.yaml” not found or more than one “ROOT.yaml” found.

Return type

pathlib.Path

class graviti.portex.builder.PackageBuilder(url, revision)[source]#

The builder of the external Portex package.

Parameters
  • url (str) – The git repo url of the external package.

  • revision (str) – The git repo revision (tag/commit) of the external package.

build(self)[source]#

Build the Portex external package.

Returns

The builded Portex external package.

Return type

graviti.portex.package.ExternalPackage

class graviti.portex.builder.TypeBuilder(name, path, builder)[source]#

The builder of the external Portex template type.

Parameters
  • name (str) – The name of the Portex template type.

  • path (pathlib.Path) – The source file path of the Portex template type.

  • package – The package the Portex template type belongs to.

  • builder (PackageBuilder) –

build(self)[source]#

Build the Portex external type.

Returns

The builded Portex external type.

Raises

TypeError – Raise when circular reference detected.

Return type

Type[graviti.portex.external.PortexExternalType]

class graviti.portex.builder.BuilderImports[source]#

Bases: graviti.portex.package.Imports

The imports of the Portex template type.

Parameters

package – The package the portex belongs to.

classmethod from_pyobj(cls, content, builder)[source]#

Create Imports instance from python list.

Parameters
  • content (List[Dict[str, Any]]) – A python list representing imported types.

  • builder (PackageBuilder) – The package builder.

  • cls (Type[_I]) –

Returns

A Imports instance created from the input python list.

Return type

_I

graviti.portex.builder.build_package(url, revision)[source]#

Build an external package.

Parameters
  • url (str) – The git repo url of the external package.

  • revision (str) – The git repo revision (tag/commit) of the external package.

Returns

The ExternalPackage instance.

Return type

graviti.portex.package.ExternalPackage