objectgraph
A basic graph library
What it is and what it does
Objectgraph is a graph library for Python 3 that lets you represent directed graphs where nodes are arbitrary objects (identified by a hashable 'identifier' attribute) and edges can carry arbitrary attributes. The library uses a non-standard edge model: multiple edges between the same pair of nodes are allowed, but edges with identical attributes are automatically collapsed into a single edge, reducing redundancy.
The package is a complete rewrite of the ObjectGraph class from altgraph, built from scratch for Python 3 with full test coverage. It depends only on typing_extensions and supports Python 3.10 through 3.15, including free-threading support in Python 3. The codebase is marked Production/Stable and has been actively maintained since its initial release in 2019, though recent activity has slowed.
Use it for:
- Build dependency graphs or call graphs where you need to track relationships between arbitrary Python objects.
- Model network topologies or system architectures where nodes represent entities and edges represent connections with metadata.
- Analyze object relationships in memory profiling or debugging tools that need to represent object references.
- Implement graph-based algorithms on custom domain objects without writing graph infrastructure from scratch.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Objectgraph provides a Python class for representing directed graphs with arbitrary objects as nodes and multi-edge support, where edges with identical attributes collapse into a single edge.
Yes, if you need a lightweight, permissively licensed graph library for Python 3.10+. The single dependency, Production/Stable status, and zero known vulnerabilities make it low-risk. The aging maintenance status (no release in 266 days) is a minor concern for a stable library but worth monitoring if you plan long-term use. Suitable for small to medium graph use cases; verify performance characteristics for larger workloads.
Install
objectgraph on PyPI
pip
pip install objectgraphuv
uv add objectgraphpoetry
poetry add objectgraphInstalling objectgraph
Before you install
Low install friction; single lightweight dependency on typing_extensions. Maintenance status is aging—last commit was 2026-01-02 and no release in 266 days—but the codebase is marked Production/Stable and supports current Python versions through 3.15.
License in practice
MIT license (permissive) places no restrictions on use, modification, or distribution in commercial or private projects.
Quickstart
pip install objectgraph
from objectgraph import ObjectGraph
graph = ObjectGraph()
# Add nodes and edges via the graph API
Requires Python 3.10 or later.
Verify before relying
- Whether the graph implementation is optimized for large-scale use or primarily suited to small to medium graphs.
- Performance characteristics compared to other graph libraries or whether benchmarks exist.
- Whether the 'identifier' attribute requirement for nodes imposes practical constraints on object types.
Package facts
| License | MIT (permissive) |
| Python support | supports the current Python release (>=3.10) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 1 — typing_extensions |
| Maintenance | aging — 266 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 129,438/month — #11,670 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: objectgraph-1.0.5-py3-none-any.whl
Tags
More Python Modules packages
Converts domain names between Unicode and…
permissive · top 100 on PyPI
setuptoolsSetuptools is a Python build backend and…
permissive · top 100 on PyPI
PyYAMLPyYAML parses and emits YAML 1.1 data format,…
permissive · top 100 on PyPI
pydanticPydantic validates Python data structures…
permissive · top 100 on PyPI
annotated-typesProvides reusable metadata objects for use with…
permissive · top 100 on PyPI
typing-inspectionProvides runtime tools to inspect and…
permissive · top 100 on PyPI
altgraphaltgraph constructs and analyzes graphs…
permissive · top 5,000 on PyPI
PenmanPenman is a Python library for reading,…
permissive · top 15,000 on PyPI
DijkstarDijkstar implements Dijkstra's shortest-path…
permissive · top 15,000 on PyPI
toposortImplements topological sorting of directed…
permissive · top 5,000 on PyPI
pinjectPinject is a dependency injection library that…
permissive · top 15,000 on PyPI
modulegraph2Modulegraph2 builds and introspects a…
permissive · top 15,000 on PyPI
networkxNetworkX provides data structures and…
permissive · top 1,000 on PyPI
objgraphObjgraph lets you visualize and explore Python…
permissive · top 5,000 on PyPI
modulegraphmodulegraph analyzes Python module dependencies…
permissive · top 15,000 on PyPI
nebula3-pythonA Python client library for connecting to and…
permissive · top 15,000 on PyPI