Support for pip installing this Orekit data repository
Hi all, in particular @Petrush , this is a proposal to allow Orekit Python users to download this repository via pip as a Python library.
This is particularly useful because it prevents Python projects relying on Orekit from having to either 1) package the Orekit data folder in their own repo or 2) download and manage the Orekit data folder somewhere on the file system (which can be annoying for a cross-platform library or in Docker). Instead the orekit data is installed in the same site-packages
location as any other Python library, and it can be located from Python with the following syntax:
import orekitdata
from orekit.pyhelpers import setup_orekit_curdir
setup_orekit_curdir(filename=orekitdata.__path__[0])
Update: this syntax was actually further simplified in orekit-labs/python-wrapper!5 (merged) :
from orekit.pyhelpers import setup_orekit_curdir
setup_orekit_curdir(from_pip_library=True)
The library installation is also documented in README.md
and in the Python wrapper Wiki:
pip install git+https://gitlab.orekit.org/orekit/orekit-data.git
The Python library receives a new version tag at every commit in this repository so that a Python project depending on this repo can pull the newest version of the orekit data every time this repository is updated. The 7 last characters of the version tag correspond to the 7 first characters of the git hash of the commit: for instance the Python version orekitdata-0+untagged.70.g91b2c79
correspond to the commit of the master
branch of this repository with a githash starting with 91b2c79
.
This introduces 3 new files which shouldn't bother non-Python users too much:
-
pyproject.toml
: defines the properties of the Python library, usingsetuptools
-
._version.py
: hidden file, required for bumping the version of the Python library at every commit, using theversioneer
library -
.gitattributes
: also a hidden file