easyfabric.buildinfo
Identity of the wheel build that is actually running.
The customer wheel is published under a fixed name and version
(easyfabric-0.0-py3-none-any.whl) so that every fresh Fabric session
installs whatever is newest — deliberate, but it costs the version number as an
identifier in the package metadata. version here is therefore
easyfabric.VERSION from the source, whatever the file was called. Beside it
stand the commit the build came from, when it was built, and a fingerprint over
the installed code itself, which separate two builds of the same version.
init_logging writes all of this under easyfabric into the context of
its START row, so every notebook activity in the log names its build.
::
from easyfabric import print_build_info print_build_info()
Every wheel carries a stamp module that hatch_build.py writes while the
package is built, so the build moment is always known — a local hatch build
as much as a pipelineAn automated "conveyor belt" that moves data from one place to another or performs a task automatically. run. The commit comes from the build environment, or from
git when the source is a checkout; the build number only the pipeline knows.
Whatever could not be determined reads None rather than a guess, and an
editable install or a source checkout carries no stamp at all.
The fingerprint needs no stamp: two installations sharing it run byte-for-byte the same Python code.
code_fingerprint
def code_fingerprint(package_dir: str | os.PathLike | None = None) -> str
Returns a short hash over every .py file of the installed package.
Line endings are normalised, so a wheel built on Windows and one built on Linux from the same source fingerprint alike — the hash identifies the code, not the build host. The build stamp is left out for the same reason: a stamped pipeline build and a local one off the same commit must match.
Arguments:
package_dir- Directory to hash. Defaults to the installed package.
Returns:
str- The first :data:FINGERPRINT_LENGTHhex characters of the digest.
build_info
def build_info() -> dict
Returns the facts that identify this installation, without printing them.
Keys: version, commit, build_number, built_at,
fingerprint, installed_at and path. Everything the pipeline did
not stamp is None; fingerprint and path are always present.
print_build_info
def print_build_info() -> None
Prints :func:build_info as one readable block, for a notebook cell.