--- id: extras version: "1.0.0" license: UNKNOWN license_treatment: permissive maintenance: aging --- # extras — Useful extra bits for Python - things that shold be in the standard library License: permissive · Maintenance: aging · Downloads: 599.3K/mo ## What it is and what it does extras is a small standard-library extension module originally factored out from testtools. It provides three utility functions for safer and more flexible attribute and import handling: try_import attempts to import a module and returns None on failure, try_imports tries a sequence of imports and returns the first successful one, and safe_hasattr checks for attribute existence without triggering property side effects. The package has no runtime dependencies and installs as a pure-Python wheel with low friction. It is intended for developers who want cleaner code when dealing with optional dependencies or when they need to check for attributes in ways that avoid unintended side effects from property getters. Use it for: - Gracefully handle optional dependencies in a library without try-except boilerplate - Attempt imports from multiple sources and use the first available one - Check for attribute existence on objects with properties that have side effects - Reduce defensive import patterns in helper modules ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. Provides three utility functions—try_import, try_imports, and safe_hasattr—that extend Python's standard library to handle optional imports and safe attribute checking. Yes, if you need safe optional-import handling or attribute checking without side effects. The package is stable, has no dependencies, and carries permissive licensing. However, the last release was 2016-05-18 and the codebase is aging; verify that its behavior aligns with your Python version and use case before adopting it in new projects. ## Install pip install extras uv add extras poetry add extras ## Installing extras Before you install: Low install friction with a pure-Python wheel. Maintenance is aging: last release was 2016-05-18 and repository has not been updated since 2026-02-03, though it remains unarchived. License in practice: Distributed under the MIT license, which is permissive and carries no restrictions on commercial or private use. Quickstart: pip install extras import extras mod = extras.try_import('some_optional_module') has_attr = extras.safe_hasattr(obj, 'attribute_name') Verify before relying: - Whether try_import and try_imports handle exceptions beyond ImportError - Whether safe_hasattr differs meaningfully from getattr with a default in modern Python - Current compatibility with Python 3 versions beyond what the fact sheet specifies ## Package facts - License: UNKNOWN (permissive) - Python support: unspecified - Install friction: low - Maintenance: aging - Downloads: 599.3K/month (top 15,000 on PyPI) - Known vulnerabilities: none known ## Tags optional import handling, safe attribute checking, conditional imports python, try import utility, standard library extensions, safe hasattr, import fallback, import-utilities, stdlib-extension [View on SkillFed](https://skillfed.io/packages/extras) · [View on PyPI](https://pypi.org/project/extras/)