ocebuild.cli.commands.lock#

CLI entrypoint for the lock command.

Module Contents#

Functions#

rich_resolver(→ ocebuild.pipeline.lock.Union[str, None])

Returns a rich formatted specifier resolver.

rich_revision(→ str)

Returns a rich formatted revision hash.

format_resolvers(→ rich.table.Table)

Prints the resolved specifiers for the given resolvers.

get_lockfile(→ ocebuild.pipeline.lock.Tuple[dict, ...)

Reads the project's lockfile.

resolve_lockfile(→ ocebuild.pipeline.lock.Tuple[dict, ...)

Resolves the project's lockfile.

cli(env, cwd, check, update, force)

Updates the project's lockfile.

ocebuild.cli.commands.lock.rich_resolver(resolver: ocebuild.sources.resolver.ResolverType, resolver_props: dict, resolution: str) ocebuild.pipeline.lock.Union[str, None][source]#

Returns a rich formatted specifier resolver.

Parameters:
  • resolver – The resolver class.

  • resolver_props – The resolver properties.

  • resolution – The specifier resolution.

Returns:

A rich formatted specifier resolver.

ocebuild.cli.commands.lock.rich_revision(revision: str) str[source]#

Returns a rich formatted revision hash.

Parameters:

revision – The revision entry.

Returns:

A rich formatted commit or checksum hash.

ocebuild.cli.commands.lock.format_resolvers(resolvers: ocebuild.cli.logging.List[dict]) rich.table.Table[source]#

Prints the resolved specifiers for the given resolvers.

Resolvers are presented in a table with the following columns:
  • Type: The resolver type.

  • Name: The resolver name.

  • Version: The resolver version, optionally with the commit or checksum hash.

  • Resolution: The specifier resolution.

Parameters:

resolvers – A dictionary of resolver entries.

Returns:

A rich formatted table of the resolved specifiers.

ocebuild.cli.commands.lock.get_lockfile(cwd: ocebuild.pipeline.lock.Union[str, ocebuild.third_party.cpython.pathlib.Path], project_dir: ocebuild.pipeline.lock.Union[str, ocebuild.third_party.cpython.pathlib.Path]) ocebuild.pipeline.lock.Tuple[dict, ocebuild.third_party.cpython.pathlib.Path][source]#

Reads the project’s lockfile.

Parameters:
  • cwd – The current working directory.

  • project_dir – The project directory.

Returns:

  • The lockfile dictionary.

  • The lockfile metadata.

  • The lockfile path.

Return type:

A tuple containing

ocebuild.cli.commands.lock.resolve_lockfile(cwd: ocebuild.pipeline.lock.Union[str, ocebuild.third_party.cpython.pathlib.Path], check: bool = False, update: bool = False, force: bool = False, build_config: ocebuild.cli.logging.Optional[dict] = None, project_dir: ocebuild.cli.logging.Optional[ocebuild.third_party.cpython.pathlib.Path] = None) ocebuild.pipeline.lock.Tuple[dict, ocebuild.cli.logging.List[dict], ocebuild.third_party.cpython.pathlib.Path][source]#

Resolves the project’s lockfile.

Parameters:
  • env – The CLI environment.

  • cwd – The current working directory.

  • check – Whether to check if the lockfile is consistent with the build file.

  • update – Whether to update the lockfile.

  • force – Whether to force the lockfile update.

  • build_config – The build configuration. (Optional)

  • project_dir – The project directory. (Optional)

Returns:

  • The lockfile dictionary.

  • The resolved specifiers.

Return type:

A tuple containing

ocebuild.cli.commands.lock.cli(env, cwd, check, update, force)[source]#

Updates the project’s lockfile.