I wrote a super simple python3 package called real2tex.
You can install it with pip:
pip install real2tex
And use it as follows:
from real2tex import real2tex
tex = real2tex(1.2345e-6, precision=2)
print(tex) # "1.23 \cdot 10^{\minus 6}"
If you want to see how it works or edit the code, you can found the source on GitHub.
The code consist of only one file (/src/real2tex.py) and two functions.