$npx skillfedfor your agent

pygtrie

A pure Python trie data structure implementation.

With conditionsPyPI Python ModulesReleased Jul 202213.9M downloads / moApache-2.0Pure Python

Decision gist · record as of 2026-08-14

pure-Python wheel — pygtrie-2.5.0-py3-none-any.whl
v2.5.0 · released 2022-07-16

Yes, if you need trie-based prefix lookups and can tolerate dormant maintenance. The package is stable, has no dependencies, and solves a specific problem well. However, verify that the empty requires_python field doesn't mask compatibility issues with your Python version, and be aware that bug fixes or updates are unlikely without community contribution.AI-flagged interpretation of the facts on this page — verify before relying

Before you install

  • Installation is straightforward with no runtime dependencies.
  • The package is marked Production/Stable but dormant—last release was 2022-07-16 and the repository received its last commit 2024-03-26, so expect no active maintenance or rapid bug fixes.

License · maintenance · safety

Apache-2.0 (permissive) — Licensed under Apache-2.0 (permissive), so you can use, modify, and distribute pygtrie freely in commercial and private projects with minimal restrictions.

last release 2022-07-16 (1490 days) · last repo commit 2024-03-26 · 42 stars

0 known vulnerabilities (OSV.dev, 2026-08-14) · 13,875,383 downloads/mo, #1,261 on PyPI

Verify before relying

pip install pygtrie

from pygtrie import StringTrie

trie = StringTrie({'foo/bar': 42}, separator='/')
print(trie['foo/bar'])  # 42
print(list(trie.prefixes('foo/bar/baz')))  # prefix lookup
  • Whether the package is actively maintained or receives security updates despite dormant status
  • Performance characteristics and memory usage compared to alternative trie implementations
  • Compatibility with Python versions beyond 2.7 and 3.x (requires_python field is empty)
Same gist for agents: .md · .json

What it is and what it does

pygtrie is a pure Python trie (prefix tree) library that stores key-value pairs organized by shared prefixes, allowing efficient prefix-based lookups and iteration. It provides three main classes—Trie, CharTrie, and StringTrie—each implementing Python's mutable mapping interface (dict-like behavior), plus a PrefixSet class for storing sets of prefixes where membership includes all keys sharing a stored prefix.

The library is useful when you need to query or iterate over all keys with a common prefix, find shortest or longest prefix matches, or delete entire subtrees of keys at once. It works as a drop-in dict replacement in most cases but shines when prefix operations are central to your use case. The package has no runtime dependencies and is compatible with Python 2.x and 3.x, though it is currently dormant—last release was 2022-07-16.

Use it for

  • Autocomplete and search-as-you-type systems that need to retrieve all keys starting with a user's input prefix
  • IP routing tables or CIDR block lookups where you need longest-prefix matching
  • Dictionary or spell-checker implementations that support prefix-based word lookups and suggestions
  • File path or URL hierarchies where you need to query or delete all entries under a given path prefix
  • Storing and querying hierarchical configuration keys or namespaced settings by prefix

Worth the install?

AI-flagged interpretation of the facts on this page. Verify before relying on it.

With conditions

Yes, if you need trie-based prefix lookups and can tolerate dormant maintenance.

The package is stable, has no dependencies, and solves a specific problem well. However, verify that the empty requires_python field doesn't mask compatibility issues with your Python version, and be aware that bug fixes or updates are unlikely without community contribution.

Install

pygtrie on PyPI

Before you install

Installation is straightforward with no runtime dependencies. The package is marked Production/Stable but dormant—last release was 2022-07-16 and the repository received its last commit 2024-03-26, so expect no active maintenance or rapid bug fixes.

License in practice

Licensed under Apache-2.0 (permissive), so you can use, modify, and distribute pygtrie freely in commercial and private projects with minimal restrictions.

Quickstart

pip install pygtrie

from pygtrie import StringTrie

trie = StringTrie({'foo/bar': 42}, separator='/')
print(trie['foo/bar'])  # 42
print(list(trie.prefixes('foo/bar/baz')))  # prefix lookup

Verify before relying

  • Whether the package is actively maintained or receives security updates despite dormant status
  • Performance characteristics and memory usage compared to alternative trie implementations
  • Compatibility with Python versions beyond 2.7 and 3.x (requires_python field is empty)

Package facts

LicenseApache-2.0 permissive
Python supportNot specified
Install frictionLow. Pure-Python wheel
Runtime dependenciesNone
MaintenanceDormant 1,490 days since the last release
Last repo commit
First released
Downloads13,875,383 / month, #1,261 on PyPI 30-day window, as of 2026-08-14
Known vulnerabilitiesNone known OSV.dev, checked 2026-08-14
Classifiers
Development Status :: 5 - Production/StableIntended Audience :: DevelopersLicense :: OSI Approved :: Apache Software LicenseOperating System :: OS IndependentProgramming Language :: PythonProgramming Language :: Python :: 2Programming Language :: Python :: 2.7Programming Language :: Python :: 3Topic :: Software Development :: Libraries :: Python Modules

Evidence: pygtrie-2.5.0-py3-none-any.whl

Tags

Capabilities
trie data structure pythonprefix tree implementationradix tree libraryprefix lookup dictionarystring prefix matchingtrie prefix setpython mutable mapping trie
Topics
data-structuresprefix-matching
PyPI keywords
trieprefix treedata structure

Let your AI agent find packages like this

Example. Real query, live index.

You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.

wish › “prefix lookup dictionary”

  • pygtriepygtrie provides pure Python implementations of trie (prefix tree)…
  • py-radixImplements a radix tree data structure for efficient storage and…
  • DAWG2-PythonRead-only access to DAWG (directed acyclic word graph) files created…

Give your agent the search over MCP, or paste the wish link into any chat.

More Python Modules packages

idna Worth it
PyPI · Python Modules · released Jun 2026

Converts domain names between Unicode and ASCII-compatible encoding (Punycode) according to IDNA 2008 and Unicode Technical Standard 46, with security validation and broader script coverage than the standard library.

Install it if you work with internationalized domain names, need to validate domains, or use HTTP clients that depend on it transitively.

BSD-3-Clausepure Python · 3.9+
1.8Bdownloads / mo
setuptools Worth it
PyPI · Python Modules · released Aug 2026

Setuptools is a Python build backend and package management tool that handles building, distributing, and installing Python packages, including support for C/C++ extension modules.

MITpure Python · 3.10+
1.6Bdownloads / mo
PyYAML Worth it
PyPI · Python Modules · released Sep 2025

PyYAML parses and emits YAML 1.1 data format, enabling serialization and deserialization of configuration files and Python objects to and from human-readable YAML text.

MITcompiled wheel · 3.8+
1.2Bdownloads / mo
pydantic Worth it
PyPI · Python Modules · released May 2026

Pydantic validates Python data structures against type hints, coercing and checking input at runtime to ensure it matches a declared schema.

MITpure Python · 3.9+
1.1Bdownloads / mo
annotated-types Worth it
PyPI · Python Modules · released Jul 2026

Provides reusable metadata objects for use with PEP-593 `typing.Annotated` to express common constraints like bounds, collection sizes, and predicates on types.

Install it if you use or build libraries that need to express type constraints in a standardized, inspectable way—or if you want to annotate your own types with…

MITpure Python · 3.10+
871.3Mdownloads / mo
typing-inspection Worth it
PyPI · Python Modules · released Aug 2026

Provides runtime tools to inspect and introspect Python type annotations, enabling programmatic examination of type hints at execution time.

MITpure Python · 3.10+
783.0Mdownloads / mo

See also marisa-trie · PyTrie · sqltrie · trie · py-radix · cidr-trie · retrie · treelib · immutables · multi_key_dict