VersionInfo

Documentation for eth_defi.version_info.VersionInfo Python class.

class VersionInfo

Bases: object

Reflect the git version information embedded in the Docker image during build.

All fields are None when running outside a stamped Docker image, e.g. from a source checkout. Individual fields can also be None inside a stamped image when the corresponding build ARG was not passed — in particular tag is None for images built from an untagged commit. See Dockerfile.vault-scanner for how the stamp files are written.

Attributes summary

tag

commit_message

commit_hash

Methods summary

__init__([tag, commit_message, commit_hash])

as_dict()

Return a JSON-serialisable dict for embedding in data exports.

read_docker_version([root])

Read version information burnt within the Docker file system during image build.

read_version_file(name[, root])

Read one version stamp file written by the Docker build.

__init__(tag=None, commit_message=None, commit_hash=None)
Parameters
Return type

None

as_dict()

Return a JSON-serialisable dict for embedding in data exports.

Returns

Dict with tag, commit_message and commit_hash keys.

Return type

dict[str, str | None]

classmethod read_docker_version(root=PosixPath('/home/runner/work/web3-ethereum-defi/web3-ethereum-defi'))

Read version information burnt within the Docker file system during image build.

Parameters

root (pathlib.Path) – Directory holding the stamp files. Defaults to the eth_defi install root.

Returns

Populated version info, or None for every field when the stamp files are absent (e.g. running from a source checkout).

Return type

eth_defi.version_info.VersionInfo

static read_version_file(name, root=PosixPath('/home/runner/work/web3-ethereum-defi/web3-ethereum-defi'))

Read one version stamp file written by the Docker build.

Parameters
  • name (str) – Stamp file name, e.g. GIT_VERSION_HASH.txt.

  • root (pathlib.Path) – Directory holding the stamp files.

Returns

Stripped file content, or None if the file does not exist, is empty, or contains the UNSPECIFIED_SENTINEL placeholder written when the build ARG was not passed.

Return type

Optional[str]