Installing IMAS-Python¶
IMAS-Python is a pure Python package. While it can be used without it, for full functionality of the package you need an installation of the IMAS Core library. See IMAS-Python 5 minute introduction for a quick overview of its most basic functionalities.
To get started, you can install it from pypi.org:
pip install imas-python
You can also install optional dependencies (e.g. netCDF and xarray):
pip install imas-python[netcdf,xarray]
List of optional dependencies¶
netcdf: enables storing/loading of IDS to/from netCDF filesxarray: enables loading IDS (entire IDS or part of it) into an xarraydataseth5py: enablesanalyze-dbCLI optiondocs: installs required packages to build the Sphinx documentationtest: installs required packages to run the tests withpytestandasvsaxonche: installs saxonche to enable creation of MDSplus models for the selected versions of the IMAS Data Dictionary (only relevant when working withimas_core)
Note
Some tests will be skipped unless you also have imas_core installed
(it is not yet available on PyPI, so you will need to install it from sources
if you have access to them at https://git.iter.org/projects/IMAS/repos/al-core)
Local installation from sources¶
We recommend using a venv. Then, clone the IMAS-Python repository
and run pip install:
python3 -m venv ./venv
. venv/bin/activate
git clone git@github.com:iterorganization/IMAS-Python.git
cd IMAS-Python
pip install --upgrade pip
pip install --upgrade wheel setuptools
pip install .
Development installation¶
For development an installation in editable mode may be more convenient, and you will need some extra dependencies to run the test suite and build documentation.
pip install -e .[test,docs]
Test your installation by trying
cd ~
python -c "import imas; print(imas.__version__)"
This is how to run the IMAS-Python test suite:
# inside the IMAS-Python git repository
pytest imas --mini
# run with a specific backend, requires IMAS-Core installed
pytest imas --ascii --mini
And to build the IMAS-Python documentation, execute:
make -C docs html