latexify
A library to generate LaTeX expression from Python code
... relations—into equations suitable for papers, notebooks, and slide decks. The tool aims to preserve semantics such as exponentiation, summations, products, piecewise definitions, and function application while hiding Pythonic scaffolding. Users can control rendering details for names and operators so the output conforms to a project’s notation style. Because it works directly from Python source, it enables a tight authoring loop.