Python API for the Interactive Tree of Life (iTOL)

License: MIT

Language: Python

Keywords: bioinformatics, computational-biology, phylogenetic-trees, phylogenetics, python, visualization

iTOL Python API

Latest Version Python Version License

Codeship CodeCov CodeClimate Dependency Status

Python API for the Interactive Tree of Life (iTOL)

Created by Albert Wang (git at

With Complements to: iTOL (Interactive Tree of Life), Python requests package.

This iTOL API allows local software to upload trees to iTOL using and export uploaded trees using using direct Python calls or through shell. An active internet connection to the iTOL website is required.


pip install itolapi

Uploading Trees To iTOL (

From Command Line

(If you need to do anything more than displaying basic tree structures, you must call the Python iTOL API from within a Python program)

$ /path/to/example.tree

From Python

Running from a python program is much more flexible than running from command line and allows access to all iTOL options

from itolapi import Itol
itol_uploader = Itol()
itol_uploader.params['treeName'] = 'apple'
status = itol_uploader.upload()
assert status != False
# SUCCESS: 1234567890
# 1234567890
# <ItolExport.ItolExport instance at 0x207c5f0>

An example for using the Python iTOL API can found in examples/

Downloading Trees From iTOL (

From Command Line

(If you would like to set any parameters other than the tree id, location to save the file, file format, and whether to display datasets, you must use ItolExport from a Python program)

Options include:
  • -d: show datasets
  • -v: verbose output
  • -h: help

From Python

Running from a Python program allows you to use all the options that iTOL has available.

from itolapi import ItolExport
itol_exporter = ItolExport()
itol_exporter.add_export_param_value('tree', tree_id)
assert format in ['png', 'svg', 'eps', 'ps', 'pdf', 'nexus', 'newick']
itol_exporter.add_export_param_value('format', format)
itol_exporter.add_export_param_value(param_key, param_value)

Valid param_key and param_value values can be found on the iTOL API page.


Send bugs and comments as issues on the Github repository.


To run tests:

python install
pip install -r requirements-test.txt
mypy itolapi
coverage run test
coverage report -m

To update PyPI:

pip install twine
python sdist bdist_wheel
twine upload dist/*

Project Statistics

Sourcerank 5
Repository Size 623 KB
Stars 12
Forks 5
Watchers 2
Open issues 4
Dependencies 5
Contributors 3
Tags 17
Last updated
Last pushed

Top Contributors See all

Albert Wang Thomas Brockmöller Bitdeli Chef

Packages Referencing this Repo

API for interacting with
Latest release 4.0.0 - Updated - 12 stars

Recent Tags See all

v4.0.0 January 05, 2020
v3.0.3 July 05, 2019
v3.0.2 December 16, 2018
v3.0.1 August 09, 2018
v3.0.0 July 30, 2018
v2.0.2 July 29, 2018
v2.0.1 July 24, 2018
v2.0.0 July 16, 2018
v1.3.2 July 16, 2018
1.3.1 August 24, 2017
1.3.0 February 14, 2016
1.2.2 February 03, 2016
1.2.1 June 22, 2015
1.2.0 April 26, 2015
1.1.2 March 15, 2015

Something wrong with this page? Make a suggestion

Last synced: 2020-01-05 18:09:57 UTC

Login to resync this repository