gigl.scripts.post_install#

Once GiGL is installed w/ pip install gigl, this script can be executed by running: gigl-post-install

This script is used to install the dependencies for GIGL. - Currently, it installs GLT: it reuses a cached wheel if one exists, otherwise builds it with install_glt.sh.

Attributes#

Functions#

cache_root_from_environment()

Returns the wheel cache root, or None when the cache is disabled.

install_glt_wheel(cache_entry, build_wheel, ...)

Installs a verified GLT wheel, building it only if the cache has no good one.

main()

Main entry point for the post-install script.

Module Contents#

gigl.scripts.post_install.cache_root_from_environment()[source]#

Returns the wheel cache root, or None when the cache is disabled.

The cache only pays off on a developer machine that creates several environments. It is off when GIGL_GLT_WHEEL_CACHE is 0, when GIGL_GLT_WHEEL_CACHE_DIR is set but empty, when CI is set, or when running as root (image builds, CI runners), so no wheel is ever written into an image layer or a shared runner’s home directory.

Example

>>> os.environ["GIGL_GLT_WHEEL_CACHE"] = "0"
>>> cache_root_from_environment() is None
True
Returns:

The cache root directory, GIGL_GLT_WHEEL_CACHE_DIR or ~/.cache/gigl/glt-wheels, or None when the cache is disabled.

Return type:

pathlib.Path | None

gigl.scripts.post_install.install_glt_wheel(cache_entry, build_wheel, install_wheel, verify)[source]#

Installs a verified GLT wheel, building it only if the cache has no good one.

On a cache hit the cached wheel is installed and verified; if either step fails, the entry is deleted and the wheel is built. After a fresh build, a failure to install or verify is fatal. The callables signal a bad wheel by raising subprocess.CalledProcessError; any other exception propagates and leaves the entry in place.

With cache_entry None the cache is disabled: the wheel is built, installed and verified from a temp dir and nothing is published.

The caller must hold cache_entry_lock(cache_entry) so the check, eviction, build and publish of one key are serialized across processes.

Example

>>> entry = Path("/tmp/cache/glt-key")
>>> with cache_entry_lock(entry):
...     install_glt_wheel(entry, build_wheel, install_wheel, verify)
GLT wheel cache miss: /tmp/cache/glt-key
Parameters:
  • cache_entry (pathlib.Path | None) – Cache entry directory for this wheel’s cache key, or None to bypass the cache.

  • build_wheel (collections.abc.Callable[[pathlib.Path], None]) – Builds a wheel into the given directory.

  • install_wheel (collections.abc.Callable[[pathlib.Path], None]) – Installs the given wheel.

  • verify (collections.abc.Callable[[], None]) – Checks that the patches are live in the installed wheel.

Return type:

None

gigl.scripts.post_install.main()[source]#

Main entry point for the post-install script.

gigl.scripts.post_install.GLT_CUDA_ARCH_LIST: Final = '7.5'[source]#