types-objgraph

raw JSON →
3.6.0.20260408 verified Mon Apr 27 auth: no python

Typing stubs for the objgraph library, providing type hints for objgraph functions. Version 3.6.0.20260408 corresponds to objgraph 3.6.x. Released as part of typeshed, updated periodically.

pip install types-objgraph
error Cannot find reference 'count' in 'objgraph.pyi'
cause Stale IDE cache or missing stub package.
fix
Run 'pip install --upgrade types-objgraph' and restart IDE.
error Module 'objgraph' has no attribute 'growth'
cause Using objgraph < 2.0 or stub not covering older versions.
fix
Upgrade objgraph to >= 2.0 and ensure types-objgraph matches.
gotcha types-objgraph only provides type hints; it does not replace the objgraph runtime package. You must install objgraph separately.
fix Ensure 'objgraph' is in your dependencies (e.g., pip install objgraph).
gotcha The stub versions (3.6.0.20260408) mirror objgraph's version with a date suffix. Do not expect all objgraph 3.x features to be stubbed if the stub package is outdated.
fix Check typeshed updates or contribute missing stubs.
gotcha Some objgraph functions like 'show_most_common_types()' may not have complete type annotations (e.g., return types partially unknown).
fix Use 'Any' or cast if strict type checking fails.

Basic usage of objgraph with type stubs. The stubs just provide type annotations; runtime behavior is unchanged.

import objgraph

# Count number of list objects
count = objgraph.count('list')
print(f"Number of list objects: {count}")

# Show growth of objects between two points
import gc
gc.collect()
before = {id(o): o for o in gc.get_objects()}
# ... some code ...
gc.collect()
diff = objgraph.growth(limit=10)
print(diff)