Using the API

To use the API in Python scripts, you need a Python interpreter. You can run a Python interpreter through an IDE (integrated development environment) like Spyder or PyCharm.

You can also start a Python interpreter by running python. If you installed mako via conda, make sure to start the Python interpreter from conda so the interpreter can find the mako package. The screenshot below shows how the interpreter can be started from conda. After the interpreter has started, you can copy Python code shown on the webpage and run this line by line.

Command prompt showing how a conda environment is used to start a Python interpreter and import mako in that interpreter.
Figure 1: Command prompt showing how a conda environment is used to start a Python interpreter and import mako in that interpreter.

Most of the Python code used in the case studies is also provided as a separate script. Assuming that you have a conda environment called myenv that contains mako, you can run the scripts from that environment. For example, to run a script called custom_queries.py, run the following code:


conda activate myenv
python custom_queries.py