rgpycrumbs._aux¶
Attributes¶
Classes¶
Proxy that defers |
Functions¶
|
Return True when a usable NVIDIA GPU is present. |
|
Return the per-user dependency cache directory. |
|
Return the pip install spec for module_name, respecting CUDA. |
|
Install package_spec into target using uv (falling back to pip). |
|
Import module_name through a 5-step priority chain. |
|
Return a lazy proxy for module_name. |
|
Return the absolute path as a string. |
Return the root of the current git repository as a Path. |
|
|
Context manager that temporarily changes the working directory. |
|
Import a module from parent interpreter's site-packages as a fallback. |
Module Contents¶
- rgpycrumbs._aux._has_cuda() bool[source]¶
Return True when a usable NVIDIA GPU is present.
Checks for
nvidia-smion PATH and verifies it exits cleanly. The result is cached for the lifetime of the process.
- rgpycrumbs._aux._get_dep_cache_dir() pathlib.Path[source]¶
Return the per-user dependency cache directory.
Defaults to
$XDG_CACHE_HOME/rgpycrumbs/deps/(typically~/.cache/rgpycrumbs/deps/).
- rgpycrumbs._aux._resolve_pip_spec(module_name: str) str[source]¶
Return the pip install spec for module_name, respecting CUDA.
If the host lacks a CUDA device and a CPU-only override exists, the override is returned instead of the default spec.
- rgpycrumbs._aux._uv_install(package_spec: str, target: pathlib.Path) None[source]¶
Install package_spec into target using uv (falling back to pip).
Raises
RuntimeErrorif both installers fail.
- rgpycrumbs._aux.ensure_import(module_name: str)[source]¶
Import module_name through a 5-step priority chain.
Current environment (importlib)
Parent environment (RGPYCRUMBS_PARENT_SITE_PACKAGES)
uv cache directory on sys.path
uv/pip install into cache (opt-in via RGPYCRUMBS_AUTO_DEPS=1)
Raise ImportError with an actionable message
Returns the imported module object.
Added in version 1.3.0.
- class rgpycrumbs._aux._LazyModule(module_name: str)[source]¶
Proxy that defers
ensure_importuntil first attribute access.After resolution the proxy replaces its own
__dict__with the real module’s attributes so subsequent access carries zero overhead.Added in version 1.3.0.
- rgpycrumbs._aux.lazy_import(module_name: str) _LazyModule[source]¶
Return a lazy proxy for module_name.
The actual import (via
ensure_import()) is deferred until the first attribute access on the returned object.Added in version 1.3.0.
- rgpycrumbs._aux.getstrform(pathobj)[source]¶
Return the absolute path as a string.
Added in version 0.0.1.
- rgpycrumbs._aux.get_gitroot()[source]¶
Return the root of the current git repository as a Path.
Added in version 0.0.1.