ocebuild.pipeline.lock
#
Methods for handling and resolving lock files.
Module Contents#
Functions#
|
Parses a semver version entry or specifier for parameters. |
|
Parses a specifier string for a resolver class. |
|
Reads a lockfile from the specified path. |
|
Writes a lockfile to the specified path. |
|
Prunes the lockfile of entries that are not in the build configuration. |
|
Prunes a resolver entry from the list of resolvers. |
|
Resolves the specifiers for each entry in the build configuration. |
|
Verifies that the lockfile is consistent with the build file. |
Attributes#
The current metadata for the lockfile system. |
|
The warning comment generated for new lockfiles. |
- ocebuild.pipeline.lock.LOCKFILE_WARNING_COMMENT = Multiline-String[source]#
Show Value
""" # This file is generated by running "ocebuild" inside your project. # Manual changes might be lost - proceed with caution! """
The warning comment generated for new lockfiles.
- ocebuild.pipeline.lock.parse_semver_params(entry: ocebuild.sources.resolver.Union[str, dict], specifier: str, parameters: ocebuild.sources.resolver.Optional[dict] = None) Dict[str, str] [source]#
Parses a semver version entry or specifier for parameters.
- Parameters:
entry – The entry to parse additional properties from.
specifier – The specifier string to parse.
parameters – The parameters dictionary to mutate. (Optional)
- Returns:
The parameters dictionary.
- ocebuild.pipeline.lock.parse_specifier(name: str, entry: ocebuild.sources.resolver.Union[str, Dict[str, any]], base_path: ocebuild.sources.resolver.Optional[str] = getcwd()) ocebuild.sources.resolver.Union[ocebuild.sources.resolver.GitHubResolver, ocebuild.sources.resolver.PathResolver, ocebuild.sources.resolver.DortaniaResolver, None] [source]#
Parses a specifier string for a resolver class.
- Parameters:
name – The name of the entry to parse.
entry – The entry to parse.
base_path – The base path to use for relative paths. (Optional)
- Returns:
The resolver class for the specifier.
- ocebuild.pipeline.lock.read_lockfile(lockfile_path: str, metadata: bool = False) ocebuild.sources.resolver.Union[dict, ocebuild.sources.resolver.Tuple[dict, dict]] [source]#
Reads a lockfile from the specified path.
- ocebuild.pipeline.lock.write_lockfile(lockfile_path: str, lockfile: dict, resolvers: dict, metadata: ocebuild.sources.resolver.Optional[dict] = None) dict [source]#
Writes a lockfile to the specified path.
- Parameters:
lockfile_path – The path to write the lockfile to.
lockfile – The lockfile to write.
resolvers – The resolved entries to write to the lockfile.
metadata – The lockfile metadata to write. (Optional)
- ocebuild.pipeline.lock.prune_lockfile(build_config: dict, lockfile: dict) ocebuild.sources.resolver.List[dict] [source]#
Prunes the lockfile of entries that are not in the build configuration.
- Parameters:
build_config – The build configuration to prune against.
lockfile – The lockfile to prune.
- Returns:
A list of removed lockfile entries.
- ocebuild.pipeline.lock.prune_resolver_entry(resolvers: ocebuild.sources.resolver.List[dict], key: str, value: any) None [source]#
Prunes a resolver entry from the list of resolvers.
- Parameters:
resolvers – The list of resolvers to prune from.
key – The key to prune by.
value – The value to prune by.
- Raises:
ValueError – If the resolver entry does not exist.
- ocebuild.pipeline.lock.resolve_specifiers(build_config: dict, lockfile: dict, base_path: str = getcwd(), update: bool = False, force: bool = False, *args, __wrapper: ocebuild.sources.resolver.Optional[Iterator] = None, **kwargs) ocebuild.sources.resolver.List[dict] [source]#
Resolves the specifiers for each entry in the build configuration.
- Parameters:
build_config – The build configuration to resolve specifiers for.
lockfile – The lockfile to resolve specifiers against.
base_path – The base path to use for relative paths. (Optional)
update – Whether to update outdated entries in the lockfile. (Optional)
force – Whether to force resolve all entries in the build configuration. (Optional)
*args – Additional arguments to pass to the optional iterator wrapper.
__wrapper – A wrapper function to apply to the iterator. (Optional)
**kwargs – Additional keyword arguments to pass to the optional iterator wrapper.
- Raises:
ValueError – If a resolver or the build configuration is invalid.
- Returns:
The resolved build configuration.
- ocebuild.pipeline.lock.validate_dependencies(lockfile: dict, build_config: dict) None [source]#
Verifies that the lockfile is consistent with the build file.
- Parameters:
lockfile – The lockfile dictionary.
build_config – The build configuration dictionary.
- Raises:
AssertionError – If the lockfile does not match the build file.