- Notifications
You must be signed in to change notification settings - Fork1.1k
[lora-sx126x,lora-sx127x]: Add dependencies for sync/async modems.#1047
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
base:master
Are you sure you want to change the base?
Uh oh!
There was an error while loading.Please reload this page.
Conversation
The lora-sx126x and lora-sx127x packages create SyncModem and AsyncModem classes by importing from lora.sync_modem and lora.async_modem modules, which are provided by the lora-sync and lora-async extension packages respectively.However, the manifest.py files for these hardware driver packages did not require lora-sync or lora-async as dependencies. This meant that when users installed lora-sx126x or lora-sx127x, they would get the hardware driver but not the modem wrapper classes needed to actually use it.This commit adds the missing dependencies and increments the patch versions (0.1.5→0.1.6 for sx126x, 0.1.2→0.1.3 for sx127x), so users will receive the fixed packages.Also fixed error handling in lora/__init__.py where ImportError would be raised incorrectly when the second hardware driver import failed, even if the first one had succeeded.Signed-off-by: Breno RdV <breno.rdv@gmail.com>
…cond hardware driver import failed, because the error message would contain "lib.lora" instead of just "lora.".Signed-off-by: Breno RdV <breno.rdv@gmail.com>
…sync modems.micropython/lora/lora-sx127x/manifest.py: Add dependencies for sync/async modems.The lora-sx126x and lora-sx127x packages create SyncModem and AsyncModem classes by importing from lora.sync_modem and lora.async_modem modules, which are provided bythe lora-sync and lora-async extension packages respectively.However, the manifest.py files for these hardware driver packages did not require lora-sync or lora-async as dependencies. This meant that when users installedlora-sx126x or lora-sx127x, they would get the hardware driver but not the modem wrapper classes needed to actually use it.This commit adds the missing dependencies and increments the patch versions (0.1.5→0.1.6 for sx126x, 0.1.2→0.1.3 for sx127x), so users will receive the fixed packages.Also fixed error handling in lora/__init__.py where ImportError would be raised incorrectly when the second hardware driver import failed, even if the first one hadsucceeded.Signed-off-by: Breno RdV <breno.rdv@gmail.com>
…ncorrectly when the second hardware driver import failed,because the error message would contain "lib.lora" instead of just "lora.".Signed-off-by: Breno RdV <breno.rdv@gmail.com>Signed-off-by: Breno RdV <brenordv@users.noreply.github.com>
…brenordv/micropython-lib into improving-importing-for-sx-1262
Hi@brenordv, Thanks for digging into this and submitting this PR. Not depending on either We tried to smooth over the usability of this in theinstallation instructions and by producing a helpful error message if neither package was installed. It seems like your PR also fixes a case where that message wasn't being generated, thanks! |
| delok | ||
| __version__='0.2.1' |
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.
This line is automatically added bymip when the package is installed.
Uh oh!
There was an error while loading.Please reload this page.
Problem
When installing
lora-sx126xorlora-sx127xpackages via mip, users only get the hardware drivers but not the SyncModem/AsyncModem wrapper classes, making the packages unusable.Also found a problem in the import handling in
lora/__init__.pywhereImportErrorwould be raised incorrectly when the error message containedlib.lorainstead of justlora.I noticed both problems after installing the
lora-sx1262package viaThonnypackage manager.Solution
Added
require("lora-sync")andrequire("lora-async")to the manifest files so these dependencies are automatically installed.To fix the import problem, I added an extra check to prevent this from happening by checking if the error message contains both "no module named", and "lora". Since the check was the same for all imports, I centralized the check in a function.
Testing
Install the package and verify the modem classes are available: