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 :ref:`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]
netcdf
: enables storing/loading of IDS to/from netCDF filesxarray
: enables loading IDS (entire IDS or part of it) into an xarraydataset
h5py
: enablesanalyze-db
CLI optiondocs
: installs required packages to build the Sphinx documentationtest
: installs required packages to run the tests withpytest
andasv
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)
We recommend using a :external:py:mod:`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 .
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