Skip to main content

suffix_trees

ci codecov PyPI

Python implementation of Suffix Trees and Generalized Suffix Trees. Also provided methods with typical applications of STrees and GSTrees.

Installation

pip install suffix-trees

Requires Python 3.9+ and has no dependencies.

Usage

from suffix_trees import STree

# Suffix-Tree example.
st = STree.STree("abcdefghab")
print(st.find("abc"))  # 0
print(st.find_all("ab"))  # {0, 8}

# Generalized Suffix-Tree example.
a = ["xxxabcxxx", "adsaabc", "ytysabcrew", "qqqabcqw", "aaabc"]
st = STree.STree(a)
print(st.lcs())  # "abc"

# lcsm() returns all longest common substrings when there are ties.
a = ["klexxxabc", "kleyyyabc"]
st = STree.STree(a)
print(st.lcsm())  # ["abc", "kle"]

# bytes input works too (find/find_all/lcs/lcsm then accept and return bytes).
st = STree.STree(b"abcdefghab")
print(st.find(b"abc"))  # 0

# Online mode (Ukkonen's algorithm): text can be appended incrementally and
# the tree queried between appends.
st = STree.STree(online=True)
st.append("abcab")
print(st.find("bca"))  # 1
st.append("xabcd")
print(st.find("abcd"))  # 6

Development

The project is managed with uv:

uv sync            # create venv and install dev dependencies
uv run pytest      # run tests
uv run ruff check  # lint

Release files for suffix-trees 0.4.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for suffix-trees 0.4.0
File Size Uploaded
suffix_trees-0.4.0.tar.gz 11.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for suffix-trees 0.4.0
File Interpreter ABI Platform
suffix_trees-0.4.0-py3-none-any.whl Python 3 none any Details

Total release size: 25.4 kB

Release files / suffix_trees-0.4.0.tar.gz

Download URL suffix_trees-0.4.0.tar.gz
Size 11.2 kB
Tags Source
SHA-256 checksum
How to use checksums
f9dea553f3a909f4b5c2c08baf62f355975572b7cfb47a6244e13119a17e0d39
BLAKE2b-256 checksum
How to use checksums
6faa013713a002a7189282d0ed825ab555575a80cc16d4bf25a0a9c2a629f526
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 31, 2026.

Transparency log

Release files / suffix_trees-0.4.0-py3-none-any.whl

Download URL suffix_trees-0.4.0-py3-none-any.whl
Size 14.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b32fff053218c8122f37e3db80e335a0a50871c9d483375370992a57a5a19436
BLAKE2b-256 checksum
How to use checksums
e015ce69973d3cedb351b36f5dd66be67011fe1f7de31d29de1ccd774ce83463
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 31, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.4.0 This release

2 release files

0.3.0

2 release files

0.2.4.4

1 release file

0.2.4.3

1 release file

0.2.4.2

1 release file

0.2.4.1

1 release file

0.2.4

1 release file

0.2.3

1 release file

0.2.2

1 release file

0.2.1

1 release file

0.2.0

1 release file

0.1.0

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page