Registry / serialization / fastdiff

fastdiff

JSON →
library0.3.0pypypi✓ verified 29d ago

fastdiff is a Python library (current version 0.3.0) that offers a fast, native implementation of a diff algorithm, including a pure Python fallback. It re-implements the core functionality of Python's built-in `difflib` by leveraging Rust compiled to WebAssembly, which can lead to significant performance improvements for string comparisons. The project has an infrequent release cadence, with its last update in May 2021.

pip install fastdiff
INSTALL
IMPORT
SIG · FASTDIFF
F
fastdiff
serializationpythonv0.3.0
Install
1.8s avg
Import
57ms
Disk
18MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.9–3.13
musl
3.9–3.13
Install & Compatibility
Where this runs
tested against v0.3.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.10–3.95 runs
installs and imports cleanly · install 0.0s · import 0.026s · 18MB
glibc
py 3.10–3.95 runs
installs and imports cleanly · install 1.8s · import 0.088s · 28MB
18MB installed
● package 18MB
Code
Verified usage

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

compare
✓ from fastdiff import compare
The primary function for comparing two strings.

This example demonstrates how to import the `compare` function and use it to find the differences between two multi-line strings. The `compare` function returns an iterator of diff operations similar to `difflib`.

from fastdiff import compare str1 = 'hello\nworld\npython\n' str2 = 'hello\nwasm\npython\n' diff_result = compare(str1, str2) print(list(diff_result))
Debug
Known issues
gotchaDespite reaching version 0.3.0, the library is officially classified as '2 - Pre-Alpha' on PyPI. This indicates it might not be production-ready, could have unstable APIs, or be subject to significant changes without a major version bump.
fix
Review the project's GitHub for recent activity or explicit stability guarantees if using in a production environment.
affects: <=0.3.0
gotchaThe advertised performance benefits of fastdiff are contingent on the successful loading and execution of its native WebAssembly component. If the underlying `wasmer` runtime or the WASM binary encounters issues, the library will silently fall back to a pure Python implementation, effectively losing its speed advantage without explicit warnings to the user.
fix
Consider benchmarking your specific use case to confirm native performance is active. Ensure your environment is compatible with `wasmer` and WebAssembly execution.
affects: <=0.3.0
gotchaThe project exhibits a slow maintenance pace, with the last release (0.3.0) in May 2021. Users should be aware that new features, bug fixes, or compatibility updates for newer Python versions or underlying technologies might not be frequent.
fix
Evaluate if the current feature set and stability meet your needs, as future development may be limited.
affects: All
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'fastdiff'
The 'fastdiff' library is not installed in the current Python environment.
fix
pip install fastdiff
ImportError: DLL load failed while importing _fastdiff: The specified module could not be found.
The native Rust extension component of 'fastdiff' failed to build or load, often due to missing Rust toolchain or C/C++ build tools required for compilation, especially on Windows.
fix
Ensure the Rust toolchain and necessary C/C++ build tools are installed for your OS (e.g., Visual C++ Build Tools on Windows), then reinstall fastdiff.
TypeError: argument of type 'int' is not iterable
The 'fastdiff.diff' function expects string-like (iterable) arguments but received non-string types (e.g., integers).
fix
Pass valid string or sequence arguments to 'fastdiff.diff', for example: fastdiff.diff('string1', 'string2')
Upgrade
Version history
0.3.0latest on PyPI · released May 12, 2021
Audit
Dependencies

No dependency data recorded yet.

Agent activity
11 hits · last 30 days
node
10
Resources
fastdiff — pip install fastdiff · libregistry