Skip to main content
Have a personal or library account? Click to login
OGRePy: An Object-Oriented General Relativity Package for Python Cover

OGRePy: An Object-Oriented General Relativity Package for Python

By: Barak Shoshany  
Open Access
|Jul 2025

Abstract

OGRePy is a modern, open-source Python package designed to perform symbolic tensor calculations, with a particular focus on applications in general relativity. Built on an object-oriented architecture, OGRePy encapsulates tensors, metrics, and coordinate systems as self-contained objects, automatically handling raising and lowering of indices, coordinate transformations, contractions, partial or covariant derivatives, and all tensor operations. By leveraging the capabilities of SymPy and Jupyter Notebook, OGRePy provides a robust, user-friendly environment that facilitates both research and teaching in general relativity and differential geometry. This Python package reproduces the functionality of the popular Mathematica package OGRe, while greatly improving upon it by making use of Python’s native object-oriented syntax. In this paper, we describe OGRePy’s design and implementation, and discuss its potential for reuse across research and education in mathematics and physics.

DOI: https://doi.org/10.5334/jors.558 | Journal eISSN: 2049-9647
Language: English
Submitted on: Feb 16, 2025
Accepted on: Jul 16, 2025
Published on: Jul 23, 2025
Published by: Ubiquity Press
In partnership with: Paradigm Publishing Services
Publication frequency: 1 issue per year

© 2025 Barak Shoshany, published by Ubiquity Press
This work is licensed under the Creative Commons Attribution 4.0 License.