feat: add python bindings - #92
Conversation
|
Ah, just seen someone has already done this and is maintaining it in a separate repository! It looks like they have more surface coverage, too. |
|
Tick the box to add this pull request to the merge queue (same as
|
|
Hi, re-opening this PR. I tried using https://github.com/fief-dev/zxcvbn-rs-py, but it didn't work for our use case, as its output can't be serialised or iterated over. So, I created a PR there (fief-dev/zxcvbn-rs-py#9) back in March, but I've had no response, so thought I'd try this route again. This PR would help create a PyPi package called Would you be interested in supporting Python bindings to this package, please? |
Code Review SummaryStatus: 3 Issues Found | Recommendation: Address before merge Overview
Issue Details (click to expand)WARNING
SUGGESTION
Files Reviewed (3 files)
Fix these issues in Kilo Cloud Previous Review Summaries (2 snapshots, latest commit ce5c122)Current summary above is authoritative. Previous snapshots are kept for context only. Previous review (commit ce5c122)Status: 7 Issues Found | Recommendation: Address before merge Overview
Issue Details (click to expand)CRITICAL
WARNING
SUGGESTION
Files Reviewed (9 files)
Fix these issues in Kilo Cloud Previous review (commit cf4c157)Status: 4 Issues Found | Recommendation: Address before merge Overview
Issue Details (click to expand)WARNING
SUGGESTION
Files Reviewed (8 files)
Reviewed by kimi-k2.7-code-20260612 · Input: 51K · Output: 13.6K · Cached: 298.8K |
|
I had Codex (GPT-5.5) review the PR and @kilo-code-bot's comments. It has produced a series of commits and this response:- • I’ve pushed four follow-up commits addressing the review feedback:
The Python ABI3 wheel builds successfully and all nine binding tests pass. One clarification on the feedback thread: current |
|
Next iteration done with Codex. It's comment:- I’ve pushed two additional cleanup commits addressing the latest review:
The remaining suggestions require no code changes: all current dictionary variants are explicitly mapped, and The update removes 25 net lines. The ABI3 wheel builds successfully, cargo check passes, and all eight tests pass. |
Hi,
Would you be willing to add Python bindings to
zxcvbn-rs? I have a separate Issue that arises as the existingzxcvbn-pythonlibrary outputs integers larger than 64-bits, which another rust-python libraryorjsonthen breaks on.By adding Python bindings, I have found the
zxcvbnfunction outputs only 64-bit integers, maximum, fixing the incompatibility issue we have between Python'szxcvbnandorjsonpackages.Honest disclosure: Codex (GPT-5.3) added these Python bindings and I have otherwise done minimal review. It has added some unit tests, which pass, and it works for my needs, too.
Summary
A single function is exposed to Python and can be used as a drop-in replacement for the
zxcvbn-pythonpackage's function.Usage
Output
The only difference I can see is the rust version does not have a
max_lengthargument, which the Python version allows. Instead, itOnly evaluate the first 100 characters of the input. This prevents potential DoS attacks from sending extremely long input strings., which I think is fine.Would you be happy to take this on? 🙏
Benchmarks
Shows a 17x speedup for this 128-bit long random base64 string.
Cheers,
Alex