Registry / http-networking / linkify-it-py

linkify-it-py

JSON →
library2.1.0pypypi✓ verified 52d ago

Linkify-it-py is a Python port of the popular JavaScript library 'linkify-it', designed for robust links recognition with full Unicode support. It excels at high-quality link pattern detection in plain text, accommodating international domains and astral characters. The library provides flexibility for extending its rules and implementing custom normalizers. As of March 2026, the current stable version is 2.1.0, and it maintains an active release cadence.

http-networkingserialization
pip install linkify-it-py
Install & Compatibility
Where this runs
tested against v2.1.0 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.925 runs
installs and imports cleanly · install 0.0s · import 0.010s · 18.1MB
glibc
py 3.103.925 runs
installs and imports cleanly · install 1.6s · import 0.010s · 19MB
16MB installed
● package 16MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

LinkifyIt
from linkify_it import LinkifyIt

This quickstart demonstrates basic linkification using `LinkifyIt` with default settings, showing how to test for and extract link matches. It also includes an example of customizing the linkifier by adding TLDs, protocol aliases, and enabling fuzzy IP detection.

from linkify_it import LinkifyIt # Initialize linkifier with default schemas (http, https, ftp, mailto, fuzzy links) linkify = LinkifyIt() text1 = "Visit our site: github.com!" matches1 = linkify.match(text1) print(f"Text: '{text1}'") for match in matches1: print(f" Matched: '{match.raw}' at index {match.index}-{match.last_index}, URL: {match.url}") text2 = "Email me at user@example.com or check //example.net/path" matches2 = linkify.match(text2) print(f"\nText: '{text2}'") for match in matches2: print(f" Matched: '{match.raw}' at index {match.index}-{match.last_index}, URL: {match.url}") # Example with custom options from linkify_it.tlds import TLDS linkify_custom = ( LinkifyIt() .tlds(TLDS) # Reload with full official TLDs list .tlds("onion", True) # Add unofficial .onion domain .add("git:", "http:") # Treat 'git:' as an alias for 'http:' .set({"fuzzy_ip": True}) # Enable IPs in fuzzy links (without schema) ) text3 = "Check out git:repo.git or a fuzzy IP 192.168.1.1/admin" matches3 = linkify_custom.match(text3) print(f"\nText: '{text3}' (custom linkify)") for match in matches3: print(f" Matched: '{match.raw}' at index {match.index}-{match.last_index}, URL: {match.url}")
linkify-it-py --version
Debug
Known issues
breakingVersion 2.0.0 introduced significant changes, including the addition of `matchAtStart` and fixes for paired symbols. While not all API changes were explicitly marked as breaking in `linkify-it-py`'s changelog, a major version bump indicates potential behavioral shifts that may affect applications relying on specific older parsing behaviors. Reviewing release notes is advised for upgrades from `v1.x.x`.
fix
Thoroughly test existing linkification logic after upgrading to `v2.x.x`. Pay attention to how punctuation and boundary conditions are handled, especially if your application relied on specific behaviors in `v1.x.x`.
affects: >=2.0.0
gotchaThe library explicitly requires Python 3.10 or higher. Attempting to install or run `linkify-it-py` on older Python versions (e.g., 3.9 or earlier) will result in installation failures or runtime errors due to `Requires-Python` metadata.
fix
Ensure your project's Python environment is 3.10 or newer before installing `linkify-it-py`. Upgrade your Python interpreter if necessary.
affects: <2.1.0 (and potentially future versions for new Python minimums)
gotchaBy default, `LinkifyIt()` is initialized with predefined schemas for `http(s)://`, `ftp://`, `mailto:`, `//` (protocol-neutral), as well as 'fuzzy' links (like `example.com`) and email addresses. Users sometimes mistakenly try to re-add these default schemas, which is unnecessary and can lead to unexpected behavior if custom rules conflict.
fix
Consult the documentation to understand the default schemas and options. Use `add()` method only for new, custom schemas or to override/disable existing ones. For example, `linkify.add('ftp:', None)` disables the FTP protocol.
affects: All versions
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'linkify_it'
The `linkify-it-py` package was installed, but the import statement used an incorrect module name, such as `linkify-it-py` or `linkify_it_py`, instead of the correct `linkify_it`.
fix
Correct the import statement to `from linkify_it import LinkifyIt`.
ModuleNotFoundError: Linkify enabled but not installed.
This error occurs when using a dependent library like `markdown-it-py` or `myst-parser` with its linkify functionality enabled, but the `linkify-it-py` library, which provides this feature, has not been installed in the environment.
fix
Install the `linkify-it-py` library using pip: `pip install linkify-it-py`.
AttributeError: 'LinkifyIt' object has no attribute 'some_non_existent_method'
The user is attempting to call a method that does not exist on the `LinkifyIt` instance, likely due to a misunderstanding of the library's API. For example, trying to call `linkify.find_links()` instead of the correct `linkify.match()` or `linkify.test()`.
fix
Refer to the `linkify-it-py` official documentation and use the correct methods provided by the `LinkifyIt` object, such as `linkify.match(text)` to retrieve matches or `linkify.test(text)` for a boolean check.
Upgrade
Version history
2.1.0latest on PyPI
Audit
Dependencies
uc-micro-pyrequiredRequired for Unicode character processing and classification.
Agent activity
16 hits · last 30 days
node
4
seranking-bot
3
ahrefsbot
2
amazonbot
2
chatgpt-user
1
Resources