How gnome/pygobject works
PyGObject exposes Python bindings for GObject-based libraries. The main workflow is: Python imports a namespace, the dynamic importer loads its introspection module, and runtime wrappers expose library types and functions while the native extension handles calls and values. Overrides adapt APIs such as GLib, GObject, and GTK; event-loop helpers and GObject signal/property support are additional capabilities. The source index documents key module references, but several runtime implementations were not sampled, so some internal links are omitted rather than inferred.
Main entry points: __init__.py Override framework · gimodule.c Native extension · module.py Introspection module · pygobject-object.c GObject instances
Components 20
Namespace loading
- GI public API
gi/__init__.py - Namespace importer
gi/repository/__init__.py - Dynamic importer
gi/importer.py - Introspection module
gi/module.py
Native binding runtime
- GI repository
gi/pygi-repository.c - Native extension
gi/gimodule.c - GI metadata wrappers
gi/pygi-info.c - Call marshalling
gi/pygi-invoke.c - Type wrappers
gi/pygi-type.c - GObject instances
gi/pygobject-object.c - Value conversion
gi/pygi-value.c
API adaptations
- Override framework
gi/overrides/__init__.py - GLib overrides
gi/overrides/GLib.py - GObject overrides
gi/overrides/GObject.py - GTK overrides
gi/overrides/Gtk.py
Events and callbacks
- Event loop helpers
gi/events.py - Signal helpers
gi/_signalhelper.py - Signal closures
gi/pygi-signal-closure.c - Async marshalling
gi/pygi-async.c
Other components
- Python application
Connections 21
- Python application → GI public API: uses bindings
- GI public API → GI repository: selects versions
gi/__init__.py - Namespace importer → Dynamic importer: registers importer
gi/repository/__init__.py - Dynamic importer → Introspection module: loads namespace
- Introspection module → GI repository: requires and looks up
gi/module.py - Native extension → GI repository: registers types
gi/gimodule.c - Native extension → GI metadata wrappers: registers types
gi/gimodule.c - GI metadata wrappers → Call marshalling: uses call metadata
gi/pygi-info.c - Introspection module → Type wrappers: creates wrappers
gi/module.py - Type wrappers → GObject instances: uses object wrappers
gi/pygi-type.c - GObject instances → Value conversion: converts properties
gi/pygobject-object.c - Call marshalling → Value conversion: marshals values
- Override framework → Dynamic importer: imports registry
gi/overrides/__init__.py - GLib overrides → Override framework: registers adaptations
gi/overrides/GLib.py - GObject overrides → Override framework: registers adaptations
gi/overrides/GObject.py - GTK overrides → Override framework: registers adaptations
gi/overrides/Gtk.py - GLib overrides → Event loop helpers: runs event loop
gi/overrides/GLib.py - Event loop helpers → GI public API: uses signal helpers
gi/_ossighelper.py - GObject overrides → Signal helpers: uses helpers
gi/overrides/GObject.py - GObject instances → Signal closures: uses closures
gi/pygobject-object.c - Native extension → Async marshalling: registers types
gi/gimodule.c