A Python module to read and write the Newick format, commonly used for phylogenetic trees. Current version: 1.11.0. Release cadence is irregular; maintained on GitHub.
pip install newickVerified import paths — ran on the pinned version, not inferred.
Parses a Newick string into a tree of Node objects and serializes back.
tree = loads(newick_str)[0]
Ensure node names are properly escaped or quoted in the Newick string.
Use load() for reading files and dump() for writing.
Use 'node.parent' instead of 'node.ancestor'.
Upgrade to latest: pip install --upgrade newick. Check import: from newick import loads
Ensure the Newick string is valid and ends with ';'. Check: tree = loads(newick_str); assert tree
Use dumps(node) to serialize, not load(). load() is for reading from file.
Quote the name using single quotes in the Newick string, e.g., "'My:Node'".
No dependency data recorded yet.