Skip to content

chore(deps): allow pycryptodome 4 - #1076

Merged
Lash-L merged 1 commit into
Python-roborock:mainfrom
itzzdev09:allow-pycryptodome-4
Nov 22, 2026
Merged

Lash-L merged 1 commit into
Python-roborock:mainfrom
itzzdev09:allow-pycryptodome-4

Conversation

@itzzdev09

Copy link
Copy Markdown
Contributor

pyproject.toml pins pycryptodome~=3.18, which caps it at <4. pycryptodome 4.0.0 was released on 14 Oct, so python-roborock (and Home Assistant setups that load it) can't be installed next to packages that require it.

python-roborock uses AES (ECB/CBC/GCM) and Crypto.Util.Padding for the device protocols. pycryptodome 4.0's breaking changes don't touch those: they drop Python 2.7/3.8, stop releasing pycryptodomex, change ECC/ElGamal/KDF/RSA-size handling, and deprecate the HMAC/PBKDF2 defaults. This changes the requirement to pycryptodome>=3.18,<5. I left the macOS pycryptodomex~=3.18 line as is, since pycryptodomex 4.x won't be released. uv.lock changes only in the requires-dist specifier (uv lock --check passes).

Tests on Python 3.12: the 47 test files that cover encryption, decryption and the protocol encoders/decoders gave identical results with pycryptodome 3.23.0 and 4.0.0 (1408 passed, 47 xfailed; the same 5 errors on both on my Windows machine). I left out the MQTT-session and local-channel tests, which hang on my machine regardless of the pycryptodome version.

@Lash-L Lash-L left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Automated code review by Gemini 4 Neon in Antigravity using our /review (/code-review) skill (.agents/skills/code-review/SKILL.md / AGENTS.md).

Summary

Reviewed commit d031f09 (pyproject.toml, uv.lock). No findings — this PR is clean and ready to approve once CI runs and passes.

Verification

  • Scope & Packaging: Loosens pycryptodome from ~=3.18 to >=3.18,<5 in pyproject.toml and updates the corresponding requires-dist specifier in uv.lock so uv-sync --locked stays in sync. requires-python = ">=3.11, <4" satisfies pycryptodome 4.0.0 (>=3.9).
  • Priority 3 — Cryptography Compatibility: Audited all Crypto imports across roborock/ (broadcast_protocol.py, protocol.py, protocols/a01_protocol.py, protocols/b01_q7_protocol.py) and tests/. Every usage is limited to Crypto.Cipher.AES (ECB, CBC, GCM, block_size) and Crypto.Util.Padding (pad, unpad) with zero Cryptodome imports. None of pycryptodome 4.0.0's breaking changes (dropping Python 2.7/3.8, retiring pycryptodomex, RSA/DSA OpenSSH export_key(), ECC/ElGamal/KDF/HMAC/PBKDF2 changes) affect these APIs.
  • macOS pycryptodomex Line: Leaving pycryptodomex~=3.18 ; sys_platform == 'darwin' untouched is properly scoped and does not conflict with pycryptodome 4.x (Cryptodome vs Crypto namespaces).
  • CI / Lockfile Note (Non-blocking): GitHub Actions checks have not yet run on this PR, and uv.lock remains resolved to pycryptodome 3.23.0 (which keeps the diff minimal; CI will validate against 3.23.0 unless the lockfile is upgraded to 4.0.0 here or in a follow-up Dependabot PR).

@Lash-L Lash-L added /review run Code review skill (/review) has been run Passed /review Passed the /review skill check Small PR Small pull request (<200 lines) labels Nov 22, 2026

@Lash-L Lash-L left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TY

@Lash-L
Lash-L merged commit aaea795 into Python-roborock:main Nov 22, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Passed /review Passed the /review skill check /review run Code review skill (/review) has been run Small PR Small pull request (<200 lines)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants