hydra.error.packaging module

Error types for module and package validation.

class hydra.error.packaging.ConflictingModuleNameError(first: Annotated[ModuleName, 'The first module name'], second: Annotated[ModuleName, 'The second module name that conflicts with the first'])

Bases: object

A module name which, when mapped to a target language’s directory or package structure, conflicts with another module’s mapped name. For example, hydra.foo.bar and hydra.fooBar might both map to the same directory in a case-insensitive filesystem.

class Builder(_first: 'hydra.packaging.ModuleName' = None, _second: 'hydra.packaging.ModuleName' = None)

Bases: object

build()
first(first)
second(second)
FIRST = Name(value='first')
SECOND = Name(value='second')
TYPE_ = Name(value='hydra.error.packaging.ConflictingModuleNameError')
static builder()
first: Annotated[ModuleName, 'The first module name']
second: Annotated[ModuleName, 'The second module name that conflicts with the first']
with_first(first)
with_second(second)
class hydra.error.packaging.ConflictingVariantNameError(module_name: Annotated[ModuleName, 'The name of the module containing the conflict'], type_name: Annotated[Name, 'The name of the union type'], variant_name: Annotated[Name, 'The name of the variant field causing the conflict'], conflicting_name: Annotated[Name, 'The name of the other type definition that conflicts with the generated constructor name'])

Bases: object

A union type variant name which, when capitalized and concatenated with its type name, conflicts with another type definition name. For example, a union type Foo with a variant bar produces FooBar, which conflicts with an existing type definition FooBar. This is currently a problem only for the Haskell target.

class Builder(_module_name: 'hydra.packaging.ModuleName' = None, _type_name: 'hydra.core.Name' = None, _variant_name: 'hydra.core.Name' = None, _conflicting_name: 'hydra.core.Name' = None)

Bases: object

build()
conflicting_name(conflicting_name)
module_name(module_name)
type_name(type_name)
variant_name(variant_name)
CONFLICTING_NAME = Name(value='conflictingName')
MODULE_NAME = Name(value='moduleName')
TYPE_ = Name(value='hydra.error.packaging.ConflictingVariantNameError')
TYPE_NAME = Name(value='typeName')
VARIANT_NAME = Name(value='variantName')
static builder()
conflicting_name: Annotated[Name, 'The name of the other type definition that conflicts with the generated constructor name']
module_name: Annotated[ModuleName, 'The name of the module containing the conflict']
type_name: Annotated[Name, 'The name of the union type']
variant_name: Annotated[Name, 'The name of the variant field causing the conflict']
with_conflicting_name(conflicting_name)
with_module_name(module_name)
with_type_name(type_name)
with_variant_name(variant_name)
class hydra.error.packaging.DefinitionNotInModuleNameError(module_name: Annotated[ModuleName, 'The name of the module'], name: Annotated[Name, 'The definition name that does not match the module name'])

Bases: object

A definition whose name does not have the module’s name as a prefix. If the module name is foo.bar, all definition names must have the form foo.bar.quux.

class Builder(_module_name: 'hydra.packaging.ModuleName' = None, _name: 'hydra.core.Name' = None)

Bases: object

build()
module_name(module_name)
name(name)
MODULE_NAME = Name(value='moduleName')
NAME = Name(value='name')
TYPE_ = Name(value='hydra.error.packaging.DefinitionNotInModuleNameError')
static builder()
module_name: Annotated[ModuleName, 'The name of the module']
name: Annotated[Name, 'The definition name that does not match the module name']
with_module_name(module_name)
with_name(name)
class hydra.error.packaging.DefinitionsOutOfOrderError(module_name: Annotated[ModuleName, 'The name of the module containing the misordered definitions'], preceding_name: Annotated[Name, 'The definition that appears first in the list'], following_name: Annotated[Name, 'The definition that appears next, but should sort earlier than precedingName'])

Bases: object

Two consecutive definitions in a module’s definitions list that are not in alphabetical order by local name. Hydra requires definitions to appear in lexicographic ASCII order of their local names.

class Builder(_module_name: 'hydra.packaging.ModuleName' = None, _preceding_name: 'hydra.core.Name' = None, _following_name: 'hydra.core.Name' = None)

Bases: object

build()
following_name(following_name)
module_name(module_name)
preceding_name(preceding_name)
FOLLOWING_NAME = Name(value='followingName')
MODULE_NAME = Name(value='moduleName')
PRECEDING_NAME = Name(value='precedingName')
TYPE_ = Name(value='hydra.error.packaging.DefinitionsOutOfOrderError')
static builder()
following_name: Annotated[Name, 'The definition that appears next, but should sort earlier than precedingName']
module_name: Annotated[ModuleName, 'The name of the module containing the misordered definitions']
preceding_name: Annotated[Name, 'The definition that appears first in the list']
with_following_name(following_name)
with_module_name(module_name)
with_preceding_name(preceding_name)
class hydra.error.packaging.DuplicateDefinitionNameError(module_name: Annotated[ModuleName, 'The name of the module containing the duplicates'], name: Annotated[Name, 'The duplicated definition name'])

Bases: object

Two or more definitions in the same module share the same name.

class Builder(_module_name: 'hydra.packaging.ModuleName' = None, _name: 'hydra.core.Name' = None)

Bases: object

build()
module_name(module_name)
name(name)
MODULE_NAME = Name(value='moduleName')
NAME = Name(value='name')
TYPE_ = Name(value='hydra.error.packaging.DuplicateDefinitionNameError')
static builder()
module_name: Annotated[ModuleName, 'The name of the module containing the duplicates']
name: Annotated[Name, 'The duplicated definition name']
with_module_name(module_name)
with_name(name)
class hydra.error.packaging.DuplicateModuleNameError(module_name: Annotated[ModuleName, 'The duplicated module name'])

Bases: object

Two or more modules in the same package share the same name.

class Builder(_module_name: 'hydra.packaging.ModuleName' = None)

Bases: object

build()
module_name(module_name)
MODULE_NAME = Name(value='moduleName')
TYPE_ = Name(value='hydra.error.packaging.DuplicateModuleNameError')
static builder()
module_name: Annotated[ModuleName, 'The duplicated module name']
with_module_name(module_name)
class hydra.error.packaging.InvalidDefinitionNameError(module_name: Annotated[ModuleName, 'The name of the module containing the definition'], name: Annotated[Name, 'The definition name that violates the naming convention'], expected_convention: Annotated[CaseConvention, 'The case convention the name should have followed (camel for term-level, pascal for type-level)'])

Bases: object

A definition whose local name does not match the expected naming convention. Term-level definitions must be camelCase; type-level definitions must be PascalCase.

class Builder(_module_name: 'hydra.packaging.ModuleName' = None, _name: 'hydra.core.Name' = None, _expected_convention: 'hydra.util.CaseConvention' = None)

Bases: object

build()
expected_convention(expected_convention)
module_name(module_name)
name(name)
EXPECTED_CONVENTION = Name(value='expectedConvention')
MODULE_NAME = Name(value='moduleName')
NAME = Name(value='name')
TYPE_ = Name(value='hydra.error.packaging.InvalidDefinitionNameError')
static builder()
expected_convention: Annotated[CaseConvention, 'The case convention the name should have followed (camel for term-level, pascal for type-level)']
module_name: Annotated[ModuleName, 'The name of the module containing the definition']
name: Annotated[Name, 'The definition name that violates the naming convention']
with_expected_convention(expected_convention)
with_module_name(module_name)
with_name(name)
class hydra.error.packaging.InvalidModuleError

Bases: object

InvalidModuleErrorConflictingVariantName | InvalidModuleErrorDefinitionNotInModuleName | InvalidModuleErrorDefinitionsOutOfOrder | InvalidModuleErrorDuplicateDefinitionName | InvalidModuleErrorInvalidDefinitionName | InvalidModuleErrorInvalidModuleNameConvention | InvalidModuleErrorMissingDocumentation

CONFLICTING_VARIANT_NAME = Name(value='conflictingVariantName')
DEFINITIONS_OUT_OF_ORDER = Name(value='definitionsOutOfOrder')
DEFINITION_NOT_IN_MODULE_NAME = Name(value='definitionNotInModuleName')
DUPLICATE_DEFINITION_NAME = Name(value='duplicateDefinitionName')
INVALID_DEFINITION_NAME = Name(value='invalidDefinitionName')
INVALID_MODULE_NAME_CONVENTION = Name(value='invalidModuleNameConvention')
MISSING_DOCUMENTATION = Name(value='missingDocumentation')
TYPE_ = Name(value='hydra.error.packaging.InvalidModuleError')
class hydra.error.packaging.InvalidModuleErrorConflictingVariantName(value: T)

Bases: Node[ConflictingVariantNameError]

A union variant name that conflicts with another type definition when mapped to a target language

class hydra.error.packaging.InvalidModuleErrorDefinitionNotInModuleName(value: T)

Bases: Node[DefinitionNotInModuleNameError]

A definition whose name does not have the module’s name as a prefix

class hydra.error.packaging.InvalidModuleErrorDefinitionsOutOfOrder(value: T)

Bases: Node[DefinitionsOutOfOrderError]

Two consecutive definitions in the definitions list that are not in alphabetical order

class hydra.error.packaging.InvalidModuleErrorDuplicateDefinitionName(value: T)

Bases: Node[DuplicateDefinitionNameError]

Two or more definitions in the same module share the same name

class hydra.error.packaging.InvalidModuleErrorInvalidDefinitionName(value: T)

Bases: Node[InvalidDefinitionNameError]

A definition whose local name does not match the expected naming convention

class hydra.error.packaging.InvalidModuleErrorInvalidModuleNameConvention(value: T)

Bases: Node[InvalidModuleNameConventionError]

A module whose name does not match the module-name naming convention

class hydra.error.packaging.InvalidModuleErrorMissingDocumentation(value: T)

Bases: Node[MissingDocumentationError]

A top-level definition lacking a description annotation

class hydra.error.packaging.InvalidModuleNameConventionError(module_name: Annotated[ModuleName, 'The module name that violates the convention'])

Bases: object

A module whose name does not match the dotted-lowercase naming convention. Module names must be dot-separated lowercase segments, each starting with a letter, e.g. hydra.core or hydra.overlay.python.lib.lists.

class Builder(_module_name: 'hydra.packaging.ModuleName' = None)

Bases: object

build()
module_name(module_name)
MODULE_NAME = Name(value='moduleName')
TYPE_ = Name(value='hydra.error.packaging.InvalidModuleNameConventionError')
static builder()
module_name: Annotated[ModuleName, 'The module name that violates the convention']
with_module_name(module_name)
class hydra.error.packaging.InvalidPackageError

Bases: object

InvalidPackageErrorConflictingModuleName | InvalidPackageErrorDuplicateModuleName | InvalidPackageErrorInvalidModule | InvalidPackageErrorInvalidPackageName | InvalidPackageErrorUndeclaredDependency

CONFLICTING_MODULE_NAME = Name(value='conflictingModuleName')
DUPLICATE_MODULE_NAME = Name(value='duplicateModuleName')
INVALID_MODULE = Name(value='invalidModule')
INVALID_PACKAGE_NAME = Name(value='invalidPackageName')
TYPE_ = Name(value='hydra.error.packaging.InvalidPackageError')
UNDECLARED_DEPENDENCY = Name(value='undeclaredDependency')
class hydra.error.packaging.InvalidPackageErrorConflictingModuleName(value: T)

Bases: Node[ConflictingModuleNameError]

Two module names that conflict when mapped to a target language

class hydra.error.packaging.InvalidPackageErrorDuplicateModuleName(value: T)

Bases: Node[DuplicateModuleNameError]

Two or more modules in the same package share the same name

class hydra.error.packaging.InvalidPackageErrorInvalidModule(value: T)

Bases: Node[InvalidModuleError]

A module within the package is invalid

class hydra.error.packaging.InvalidPackageErrorInvalidPackageName(value: T)

Bases: Node[InvalidPackageNameError]

A package whose name does not match the package-name naming convention

class hydra.error.packaging.InvalidPackageErrorUndeclaredDependency(value: T)

Bases: Node[UndeclaredDependencyError]

A module references a name owned by another module that is not among its declared dependencies

class hydra.error.packaging.InvalidPackageNameError(package_name: Annotated[PackageName, 'The package name that violates the convention'])

Bases: object

A package whose name does not match the hyphen-separated lowercase naming convention. Package names must be hyphen-separated lowercase segments, each starting with a letter, e.g. hydra-kernel or hydra-python.

class Builder(_package_name: 'hydra.packaging.PackageName' = None)

Bases: object

build()
package_name(package_name)
PACKAGE_NAME = Name(value='packageName')
TYPE_ = Name(value='hydra.error.packaging.InvalidPackageNameError')
static builder()
package_name: Annotated[PackageName, 'The package name that violates the convention']
with_package_name(package_name)
class hydra.error.packaging.MissingDocumentationError(module_name: Annotated[ModuleName, 'The name of the module containing the undocumented definition'], name: Annotated[Name, 'The name of the undocumented definition'])

Bases: object

A top-level definition whose term (or type, for type definitions) lacks a description annotation. Every definition in a Hydra module is expected to be wrapped in a doc “…” annotation at its top level.

class Builder(_module_name: 'hydra.packaging.ModuleName' = None, _name: 'hydra.core.Name' = None)

Bases: object

build()
module_name(module_name)
name(name)
MODULE_NAME = Name(value='moduleName')
NAME = Name(value='name')
TYPE_ = Name(value='hydra.error.packaging.MissingDocumentationError')
static builder()
module_name: Annotated[ModuleName, 'The name of the module containing the undocumented definition']
name: Annotated[Name, 'The name of the undocumented definition']
with_module_name(module_name)
with_name(name)
class hydra.error.packaging.UndeclaredDependencyError(module_name: Annotated[ModuleName, 'The name of the module containing the undeclared reference'], referenced_name: Annotated[Name, "The free name referenced by the module's definitions"], owning_module_name: Annotated[ModuleName, 'The name of the module that actually defines the referenced name'])

Bases: object

A module references a name owned by another module which is not among its declared moduleDependencies. Like a missing import: the reference may still resolve today via another module’s transitive dependencies, but the declared dependency list no longer reflects what the module actually uses, and inference-time resolution is not guaranteed.

class Builder(_module_name: 'hydra.packaging.ModuleName' = None, _referenced_name: 'hydra.core.Name' = None, _owning_module_name: 'hydra.packaging.ModuleName' = None)

Bases: object

build()
module_name(module_name)
owning_module_name(owning_module_name)
referenced_name(referenced_name)
MODULE_NAME = Name(value='moduleName')
OWNING_MODULE_NAME = Name(value='owningModuleName')
REFERENCED_NAME = Name(value='referencedName')
TYPE_ = Name(value='hydra.error.packaging.UndeclaredDependencyError')
static builder()
module_name: Annotated[ModuleName, 'The name of the module containing the undeclared reference']
owning_module_name: Annotated[ModuleName, 'The name of the module that actually defines the referenced name']
referenced_name: Annotated[Name, "The free name referenced by the module's definitions"]
with_module_name(module_name)
with_owning_module_name(owning_module_name)
with_referenced_name(referenced_name)