VersionInfo
Documentation for eth_defi.version_info.VersionInfo Python class.
- class VersionInfo
Bases:
objectReflect the git version information embedded in the Docker image during build.
All fields are
Nonewhen running outside a stamped Docker image, e.g. from a source checkout. Individual fields can also beNoneinside a stamped image when the corresponding build ARG was not passed — in particulartagisNonefor images built from an untagged commit. SeeDockerfile.vault-scannerfor how the stamp files are written.Attributes summary
Git tag at build time, e.g.
The latest git commit message at build time.
Git commit SHA hash at build time.
Methods summary
__init__([tag, commit_message, commit_hash])as_dict()Return a JSON-serialisable dict for embedding in data exports.
Serialise this version stamp for Parquet file metadata.
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.
- tag: Optional[str]
Git tag at build time, e.g.
v0.30.Often
None: only set when the image was built with theGIT_VERSION_TAGbuild ARG, which requires a tagged commit. Usecommit_hashas the primary build identifier.
- commit_message: Optional[str]
The latest git commit message at build time.
- commit_hash: Optional[str]
Git commit SHA hash at build time.
- 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
Noneif the file does not exist, is empty, or contains theUNSPECIFIED_SENTINELplaceholder written when the build ARG was not passed.- Return type
- 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_defiinstall root.- Returns
Populated version info, or
Nonefor every field when the stamp files are absent (e.g. running from a source checkout).- Return type
- as_dict()
Return a JSON-serialisable dict for embedding in data exports.
- as_parquet_metadata()
Serialise this version stamp for Parquet file metadata.
Uses
PARQUET_VERSION_METADATA_KEYwith the exact mapping returned byas_dict(). This is the Parquet equivalent of themetadata.versionobject included in vault scanner JSON exports.