skillfed

extras

Useful extra bits for Python - things that shold be in the standard library

extras v1.0.0 599.3K downloads/30d#5,829 on PyPI4
Permissive license UNKNOWN AGING released

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 on this page — 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

extras on PyPI

pip

pip install extras

uv

uv add extras

poetry

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 not specified
Install friction low — pure-Python wheel
Runtime dependencies none
Maintenance aging — 3,740 days since the last release
Last repo commit
First released
Downloads 599,330/month — #5,829 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: extras-1.0.0-py2.py3-none-any.whl

Intended Audience :: DevelopersLicense :: OSI Approved :: MIT LicenseProgramming Language :: PythonProgramming Language :: Python :: 3

Tags

optional import handlingsafe attribute checkingconditional imports pythontry import utilitystandard library extensionssafe hasattrimport fallback
import-utilitiesstdlib-extension

More Software Development packages