Treat pyhive as a synchronous package and add a regression test - #151
Treat pyhive as a synchronous package and add a regression test#151hedgert wants to merge 1 commit into
Conversation
Treat both `pyhive` and `pyhiveapi` as synchronous packages. Previously `import pyhive` exposed the asynchronous API because `src/__init__.py` only checked for `__name__ == "pyhiveapi"`. Add a regression test to verify that `pyhive` exposes the synchronous `HiveAuth` and `HiveApi` classes. The test fails without this change and passes with it.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## dev #151 +/- ##
=======================================
Coverage 99.96% 99.96%
=======================================
Files 30 30
Lines 2508 2508
Branches 292 292
=======================================
Hits 2507 2507
Partials 1 1
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
|
@hedgert do you use the sync version of this library just out of curiosity? Ive contemplated removing the sync version and just having it purely as an async package. |
|
Yes I do - please don't remove it! I've spent weeks identifying a couple of bug fixes in sync and extending unasync (I'm discussing a pull request with them at the moment) so that it can completely convert pyhive's unasync code to sync. And I have it running beautifully. I'm happy to maintain the sync conversion going forward. |
|
No worries we can keep it in. When you say your looking at the unasync code. Do you mean finding a way to go have unasync manage the whole conversion instead of managing 2 versions of Auth and APi code? |
|
Not so far - no. It hasn't occurred to me to do that. My focus has been coming up with a way of making the sync code work out of the box - as the current code doesn't work with what unasync does. The challenge is that unasync offers the capability to translate single tokens (change AAA into BBB) and some of the pyhive code needs conversion logic that detects XXX.YYY to decide what to convert async code into. And I've extended unasync so that it does that. And my version now fully translates your existing async code so it works out of the box as sync. |
import pyhive currently exposes the asynchronous API because src/init.py only checks for name == "pyhiveapi".
This change treats both pyhive and pyhiveapi as synchronous packages so that import pyhive exposes the synchronous HiveAuth and HiveApi classes.
Testing
Added a regression test verifying that pyhive exposes the synchronous classes.
Confirmed the new test fails without this change.
Confirmed the test passes with this change.
Ran the existing test suite successfully.