Skip to content

Dependencies Installation and Imports

Dependencies installation

The micropip package installs dependencies in Pyodide kernel used in JupyterLite notebooks.

For the helper imports to work in provided api-examples notebooks, one needs to install the mat3ra-notebooks-utils package in the beginning of the notebook:

1
2
3
import micropip

await micropip.install('mat3ra-notebooks-utils', deps=False)

This will allow imports like:

1
from mat3ra.notebooks_utils.material import get_materials

Listing notebook dependencies in config.yaml

Some of the necessary packages are compiled into pure Python wheels and provided in the top-level packages folder of the api-examples repository. The dependencies for each notebook and default ones are listed in the config.yml file on the top-level.

To install packages required for the notebook, one can use install_packages function from mat3ra.notebooks_utils.packages module and provide the name of the notebook entry in config.yml, a pattern such as made or made|api_examples:

1
2
from mat3ra.notebooks_utils.packages import install_packages
await install_packages("made")