-
Notifications
You must be signed in to change notification settings - Fork 178
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
fix(api): ignore missing aionotify more properly #8154
fix(api): ignore missing aionotify more properly #8154
Conversation
Thanks so much for contributing this fix! This looks basically right to us. We're taking a closer look because we're not sure what the original |
Thanks for the prompt reply, @SyntaxColoring! Please take your time to review and check it. On my side, a patch based on my suggestions here in this PR worked for packaging on OSX/Windows. To give a bit of background, the package is used at the NSLS-II LiX beamline (see https://github.com/NSLS-II-LIX/lixtools/blob/main/lixtools/ot2.py). We at NSLS-II heavily rely on the conda packages for our deployments. I am working on packaging the I noticed that the |
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.
Requesting one small change, and then this looks good to me. Oops looks like you've already committed it. Thanks! Just waiting for our CI to pass, and then I'll merge. ✅
Notes on why this PR makes sense:
If you install aionotify
on a non-Linux platform, import aionotfy
will raise an OSError
. We appear to unconditionally install aionotify
even on platforms where it won't work, so that's why the original except OSError
was good enough for our dev environments and installations of our official PyPI package.
As @mrakitin explained, the package for aionotify
in Conda takes a different approach: a package that doesn't work on a platform should just not be installable on that platform in the first place. (This seems sensible to me, and I wonder if we could do something similar for our official PyPI package.) So, an additional except ModuleNotFoundError
is needed.
Also—and this is a matter for a separate pull request—I think it would be nice if we refactored this so we don't have to care about this platform dependence at so many import sites. We could either have a helper module like opentrons.aionotify
that encapsulates the check, or we could add a property like .notifications_supported
to something in opentrons.hardware_controller
.
Codecov Report
@@ Coverage Diff @@
## edge #8154 +/- ##
==========================================
+ Coverage 86.92% 87.06% +0.14%
==========================================
Files 413 414 +1
Lines 22106 22209 +103
==========================================
+ Hits 19216 19337 +121
+ Misses 2890 2872 -18
Continue to review full report at Codecov.
|
Man, that's cool.
Thanks for the offer! My hunch is that we'll want to focus on maintaining our official PyPI package, but I'll ask internally to see if we can help out with Conda, too.
Hm, that's interesting. It looks like that was uploaded before my time at Opentrons. I'll ask internally if anyone knows what the deal is. Otherwise, I don't think we can be very helpful, since we're generally uninvolved in and unfamiliar with the Conda ecosystem today—sorry. 🙁 [Update] Yeah, we're not sure what that Conda package is. It's very old—possibly, it's the OT-One API. |
@SyntaxColoring, thanks for the quick review and additional details on why
That should be possible. https://stackoverflow.com/a/29222444 and the answers below suggest solutions for different platforms.
I like this idea a lot!
Not a problem. I will be maintaining the conda-forge feedstock, so in case anyone is willing to join, they are welcome. Regarding PyPI: do you plan to also distribute the sdist (.tar.gz) files? I noticed only .whl packages are there now. I tried to generate the sdist for |
No current plans, but I think we'd be open to it if there's some need that |
Overview
The
aionotify
is supposed to work only under Linux (that's why the corresponding conda-forge package exists for Linux only). The failure with the other platforms was observed during the work on conda-forge/staged-recipes#15705 (failed build log for OSX can be found here).Changelog
Added an additional
ModuleNotFoundError
exception to catch the missing package for OSX and Windows platforms properly. Thanks to https://stackoverflow.com/a/6470452 for the hints.Review requests
Please review and accept the addition as it fixes the missing import.
Risk assessment
The risk is minimal in my opinion.