zss
Tree edit distance using the Zhang Shasha algorithm
What it is and what it does
zss implements the Zhang-Shasha algorithm for computing tree edit distance—a measure of how many insertions, deletions, and relabelings are needed to transform one tree into another. It provides a default Node class and edit distance function for convenience, but also accepts custom tree formats and distance metrics via callback functions.
The package is designed for comparing hierarchical structures where you need a numeric similarity or difference score. It has no runtime dependencies by default, though optional dependencies (editdist for string-based label comparison, numpy for performance) can be installed. However, the package has been abandoned since 2018 and is no longer maintained, creating risk around compatibility with modern Python and dependency versions.
Use it for:
- Compare abstract syntax trees (ASTs) from different code versions to measure structural changes
- Measure similarity between XML or JSON document structures for data reconciliation
- Detect structural differences in parse trees for natural language processing tasks
- Quantify changes in hierarchical data models or organizational structures over time
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Computes the edit distance between two tree structures using the Zhang-Shasha algorithm, with support for custom node formats and distance metrics.
No. The package is abandoned (last release 2018, last commit 2020) with unclear licensing and unspecified Python support. While the algorithm is sound and there are no known vulnerabilities, the lack of maintenance creates compatibility risk with modern Python versions and dependency ecosystems. Consider maintained alternatives or implementing Zhang-Shasha directly if tree edit distance is critical to your project.
Install
zss on PyPI
pip
pip install zssuv
uv add zsspoetry
poetry add zssInstalling zss
Before you install
High install friction: the package is abandoned (last release March 2018, last commit October 2020) with no declared runtime dependencies but requires compilation from source. No active maintenance.
License in practice
License status is unclear—no SPDX identifier or raw license text provided. Verify licensing terms before use in proprietary or copyleft-sensitive projects.
Quickstart
from zss import simple_distance, Node
A = Node("f").addkid(Node("a")).addkid(Node("e"))
B = Node("f").addkid(Node("a")).addkid(Node("e"))
dist = simple_distance(A, B)
print(dist)
Package is abandoned with no active maintenance; Python version support is unspecified and may not work on modern Python versions.
Verify before relying
- Compatibility with Python 3.10+ and current NumPy/editdist versions
- Whether optional dependencies (editdist, numpy >= 1.7) are still installable and functional
- Actual license terms (no SPDX or raw license text in metadata)
Package facts
| License | not declared (unclear) |
| Python support | not specified |
| Install friction | high — source build required |
| Runtime dependencies | none |
| Maintenance | abandoned — 3,077 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 306,742/month — #7,782 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: zss-1.2.0.tar.gz
Tags
More Scientific/Engineering packages
NumPy provides an N-dimensional array object…
permissive · top 100 on PyPI
pandaspandas provides fast, flexible data structures…
permissive · top 100 on PyPI
scipyscipy provides numerical algorithms for…
permissive · top 100 on PyPI
scikit-learnscikit-learn provides a comprehensive Python…
permissive · top 1,000 on PyPI
dilldill extends Python's pickle module to…
permissive · top 1,000 on PyPI
multiprocessMultiprocess is an enhanced fork of Python's…
permissive · top 1,000 on PyPI
aptedComputes the tree edit distance between two…
permissive · top 15,000 on PyPI
strsimpyImplements a dozen string similarity and…
permissive · top 15,000 on PyPI
textdistanceComputes distance and similarity between text…
permissive · top 5,000 on PyPI
pyjsonCompares the similarity between two JSON files…
permissive · top 15,000 on PyPI
editdistanceComputes the edit distance (Levenshtein…
permissive · top 5,000 on PyPI
recursive-diffRecursively compares two Python data structures…
permissive · top 15,000 on PyPI
editdistpyComputes Levenshtein and Damerau-Levenshtein…
permissive · top 15,000 on PyPI
pylevComputes the Levenshtein distance between two…
permissive · top 5,000 on PyPI
edlibEdlib calculates edit distance (Levenshtein…
permissive · top 15,000 on PyPI
python-LevenshteinComputes Levenshtein edit distance, string…
copyleft · top 5,000 on PyPI