{"id":1828,"library":"etils","title":"etils - Eclectic Python Utilities","description":"etils (eclectic utils) is an open-source collection of Python utilities designed for machine learning and scientific computing workflows. Each top-level submodule is self-contained and independent, prefixed by 'e' (e.g., `epath`, `epy`) to avoid name collisions. This modular design allows users to import only the necessary components, minimizing dependencies. The library is actively maintained, with frequent updates.","status":"active","version":"1.14.0","language":"en","source_language":"en","source_url":"https://github.com/google/etils","tags":["utilities","python-utils","machine-learning","scientific-computing","path-management","dataclasses","numpy","jax","tensorflow"],"install":[{"cmd":"pip install etils","lang":"bash","label":"Base installation (minimal dependencies)"},{"cmd":"pip install etils[array_types,epath,epy,etree]","lang":"bash","label":"Installation with common optional modules"}],"dependencies":[{"reason":"For typing annotations for JAX and NumPy arrays","package":"array_types","optional":true},{"reason":"For pathlib-like API with cloud storage support (gs://, s3://)","package":"epath","optional":true},{"reason":"For general-purpose Python utilities","package":"epy","optional":true},{"reason":"For universal tree manipulation utilities (TensorFlow, JAX, DeepMind tree)","package":"etree","optional":true},{"reason":"For NumPy utilities","package":"enp","optional":true},{"reason":"For Colab/Jupyter utilities","package":"ecolab","optional":true},{"reason":"For dataclass utilities","package":"edc","optional":true},{"reason":"For Absl flags/app utilities","package":"eapp","optional":true}],"imports":[{"note":"Path utilities with cloud storage support (gs://, s3://)","symbol":"epath","correct":"from etils import epath"},{"note":"Collection of generic Python utilities","symbol":"epy","correct":"from etils import epy"},{"note":"Tree utilities for tf.nest, jax.tree_utils, DeepMind tree","symbol":"etree","correct":"from etils import etree"},{"note":"NumPy utilities","symbol":"enp","correct":"from etils import enp"},{"note":"Colab/Jupyter utilities","symbol":"ecolab","correct":"from etils import ecolab"},{"note":"Dataclass utilities","symbol":"edc","correct":"from etils import edc"},{"note":"Absl flags/app utilities","symbol":"eapp","correct":"from etils import eapp"},{"note":"Typing annotations for JAX, NumPy, and other arrays","symbol":"array_types","correct":"from etils import array_types"}],"quickstart":{"code":"from etils import epath\n\n# epath provides a pathlib-like API with cloud storage support (gs://, s3://)\n# For local paths, it behaves like pathlib.Path\nlocal_path = epath.Path(\"/tmp/etils_example.txt\")\nlocal_path.write_text(\"Hello from etils epath!\")\nprint(f\"File created at: {local_path}\")\nprint(f\"Content: {local_path.read_text()}\")\n\n# Clean up (optional)\nlocal_path.unlink()","lang":"python","description":"This example demonstrates the usage of `epath` for basic file operations. `epath.Path` extends `pathlib.Path` to seamlessly handle both local and cloud-based file paths (e.g., `gs://`, `s3://`) by integrating with respective cloud storage libraries."},"warnings":[{"fix":"Always use `from etils import <submodule>` for required functionality. Do not expect `import etils` to make all sub-utilities available.","message":"Etils is designed with independent submodules; importing `etils` directly does not expose all functionalities. Users must explicitly `from etils import <submodule>` (e.g., `from etils import epath`) to access specific utilities.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Install `etils` with the specific extras corresponding to the submodules you intend to use, e.g., `pip install etils[epath,epy]`.","message":"Many features are behind optional dependencies (extras). Installing only `pip install etils` will lead to `ModuleNotFoundError` if you attempt to use functionality from submodules like `epath` or `ejax` without installing `pip install etils[epath]` or similar.","severity":"breaking","affected_versions":"All versions"},{"fix":"Carefully review the documentation for `epath.Path.stat()` and adapt code to its specific return structure, or use only commonly available attributes for maximum compatibility.","message":"The return value format of `epath.Path.stat()` might not strictly match `pathlib.Path.stat()`. This can cause subtle incompatibilities or `AttributeError` if code expects specific attributes only present in `pathlib`'s `stat` result.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Consult the `etils` release notes or GitHub issues for migration guides. For `epy.cached_property`, consider using standard library `functools.cached_property` if applicable to your Python version.","message":"Previous versions may have included or exposed certain utilities (e.g., `epy.cached_property`) that have since been removed or relocated, leading to `AttributeError` on upgrade.","severity":"deprecated","affected_versions":"<=1.13.0 (potentially)"},{"fix":"Monitor GitHub issues for a resolution. As a workaround, inspect your logging configuration to prevent duplicate handlers or adjust `eapp.better_logging()` parameters if available.","message":"There's an open issue (#756) regarding `eapp.better_logging()` potentially causing double logging output. This can lead to redundant or confusing log messages in applications using `eapp`.","severity":"gotcha","affected_versions":"All versions"}],"env_vars":null,"last_verified":"2026-04-09T00:00:00.000Z","next_check":"2026-07-08T00:00:00.000Z"}