import hashlib import logging import os import sys import pkg_resources from guild import config from guild import entry_point_util from guild import guildfile from guild import namespace from guild import resource log = logging.getLogger("guild") _models = entry_point_util.EntryPointResources("guild.models", "model") ModelRef = collections.namedtuple( "ModelRef", ["dist_type", "dist_name", "dist_version", "model_name"]) class Model(object): def __init__(self, ep): self.name = self._ep_model_name(ep) self.dist = ep.dist self.modeldef = self._init_modeldef() self._fullname = None # lazy self._reference = None # lazy @staticmethod def _ep_model_name(ep):
from guild import cli from guild import config from guild import entry_point_util from guild import guildfile from guild import model as modellib from guild import op_util from guild import plugin as pluginlib from guild import python_util from guild import util from guild import var IMPLICIT_ALL_FLAGS = object() _flag_importers = entry_point_util.EntryPointResources( "guild.python.flags", "Python flag importer" ) class DataLoadError(Exception): pass class PythonScriptOpdefSupport(object): """Interface for Python script opdef support. `python_script_opdef_loaded` is called to potentially update opdef. """ def python_script_opdef_loaded(self, opdef):
# Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. from guild import entry_point_util from guild import namespace _resources = entry_point_util.EntryPointResources("guild.resources", "resource") class Resource(object): def __init__(self, ep): self.name = ep.name self.dist = ep.dist self.resdef = self._init_resdef() self._fullname = None # lazy def __repr__(self): return "<guild.resource.Resource '%s'>" % self.fullname @property def fullname(self): if self._fullname is None:
# # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. from __future__ import absolute_import from __future__ import division import logging from guild import __pkgdir__ from guild import entry_point_util _plugins = entry_point_util.EntryPointResources("guild.plugins", "plugin") class NotSupported(Exception): pass class Plugin(object): """Abstract interface for a Guild plugin.""" name = None provides = [] resolve_model_op_priority = 100 def __init__(self, ep):
# Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. from __future__ import absolute_import from __future__ import division import re from guild import config as configlib from guild import entry_point_util from guild import opref _remote_types = entry_point_util.EntryPointResources("guild.remotetypes", "remotetype") class NoSuchRemote(ValueError): pass class UnsupportedRemoteType(ValueError): pass class ConfigError(ValueError): pass class MissingRequiredConfig(ConfigError):