-
-
Notifications
You must be signed in to change notification settings - Fork 200
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add optional kasa-crypt dependency for speedups #464
Conversation
Still need to fix the string conversion in the lib as I forgot the null termination for the conversion |
Codecov ReportPatch coverage:
❗ Your organization is not using the GitHub App Integration. As a result you may experience degraded service beginning May 15th. Please install the Github App Integration for your organization. Read more. Additional details and impacted files@@ Coverage Diff @@
## master #464 +/- ##
==========================================
+ Coverage 79.29% 79.50% +0.21%
==========================================
Files 26 26
Lines 1946 1952 +6
Branches 598 598
==========================================
+ Hits 1543 1552 +9
+ Misses 362 359 -3
Partials 41 41
☔ View full report in Codecov by Sentry. |
Had to be explicit about the length cython/cython#3189 |
How about making this an optional dependency similar to what's done with the orjson support? That would keep the lib still usable even when binary wheels nor compiler is available on some odd platform. |
The kasa-crypt lib will automatically fallback to pure-python if the cython version cannot be linked or is not loadable The CI jobs verify it works both ways https://github.com/bdraco/kasa-crypt/actions/runs/5292093943 (skip_cython, use_cython) |
Tbh, I would like to see the dependency being inversed as that will still keep working even if the kasa-crypt package installation fails (if that even is a possibility). |
It shouldn't be possible for the package to fail installation more than any other pypi package as if anything goes wrong it will install the pure python version and skip the cython version. Its the same logic used in It will only raise on failure to build the cython version if |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great, thanks! Would you mind adding a separate CI run for this? I suppose checking only against the newest python release would suffice.
my |
That should do it. My github actions is a bit rusty so it took a few tries |
that was way too much to get an conditional -> actions/runner#409 (comment) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Uhh, hah, I had thought it'd be much simpler and cleaner, so thanks for going the extra mile to make it work!
@bdraco I rewrote the description to make it clearer what was changed, and I'll prepare a release soon-ish. Do you happen to have some numbers to mention in the description and the release notes about the improvements this change provides?
* Add optional kasa-crypt dependency for speedups (python-kasa#464) If installed, use the optimized protocol encryption procedures implemented as a C extension by kasa-crypt (https://pypi.org/project/kasa-crypt/ * Add fixture for KP405 Smart Dimmer Plug (python-kasa#470) * Add files via upload * Add to KP405 to dimmers, update README --------- Co-authored-by: Teemu Rytilahti <[email protected]> * Add benchmarks for speedups (python-kasa#473) * Add benchmarks for speedups * Update README.md * Update README.md Co-authored-by: Teemu R. <[email protected]> * relo * Update README.md * document benchmark * Update README.md --------- Co-authored-by: Teemu R. <[email protected]> * Release 0.5.2 (python-kasa#475) Besides some small improvements, this release: * Adds optional dependency for for `orjson` and `kasa-crypt` to speed-up protocol handling by an order of magnitude. * Drops Python 3.7 support as it is no longer maintained. [Full Changelog](python-kasa/python-kasa@0.5.1...0.5.2) * Merge --------- Co-authored-by: J. Nick Koston <[email protected]> Co-authored-by: xinud190 <[email protected]> Co-authored-by: Teemu Rytilahti <[email protected]>
* Initial commit * Update tests and some structure * Update tests and discovery single logic * Add more discovery tests * pre-commit poetry black formatting * Dev1 (#1) * Initial commit * Update tests and some structure * Update tests and discovery single logic * Add more discovery tests * pre-commit poetry black formatting * Latest changes from upstream * Update comments * Add changes from upstream2 (#5) * Add optional kasa-crypt dependency for speedups (python-kasa#464) If installed, use the optimized protocol encryption procedures implemented as a C extension by kasa-crypt (https://pypi.org/project/kasa-crypt/ * Add fixture for KP405 Smart Dimmer Plug (python-kasa#470) * Add files via upload * Add to KP405 to dimmers, update README --------- Co-authored-by: Teemu Rytilahti <[email protected]> * Add benchmarks for speedups (python-kasa#473) * Add benchmarks for speedups * Update README.md * Update README.md Co-authored-by: Teemu R. <[email protected]> * relo * Update README.md * document benchmark * Update README.md --------- Co-authored-by: Teemu R. <[email protected]> * Release 0.5.2 (python-kasa#475) Besides some small improvements, this release: * Adds optional dependency for for `orjson` and `kasa-crypt` to speed-up protocol handling by an order of magnitude. * Drops Python 3.7 support as it is no longer maintained. [Full Changelog](python-kasa/python-kasa@0.5.1...0.5.2) * Merge --------- Co-authored-by: J. Nick Koston <[email protected]> Co-authored-by: xinud190 <[email protected]> Co-authored-by: Teemu Rytilahti <[email protected]> * get changes from upstream * Move unauthenticated logic out of unauthenticated device --------- Co-authored-by: J. Nick Koston <[email protected]> Co-authored-by: xinud190 <[email protected]> Co-authored-by: Teemu Rytilahti <[email protected]>
If installed, use the optimized protocol encryption procedures implemented as a C extension by
kasa-crypt
(https://github.com/bdraco/kasa-crypt).