Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[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

Open
brenordv wants to merge5 commits intomicropython:master
base:master
Choose a base branch
Loading
frombrenordv:improving-importing-for-sx-1262

Conversation

@brenordv
Copy link

@brenordvbrenordv commentedSep 30, 2025
edited
Loading

Problem

When installinglora-sx126x orlora-sx127x packages 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 inlora/__init__.py whereImportError would be raised incorrectly when the error message containedlib.lora instead of justlora.

I noticed both problems after installing thelora-sx1262 package viaThonny package manager.

Solution

Addedrequire("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:

importmipmip.install("lora-sx126x")fromloraimportSX1262,AsyncSX1262# Should work now

brenordvand others added5 commitsSeptember 30, 2025 19:04
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>
@projectgus
Copy link
Contributor

Hi@brenordv,

Thanks for digging into this and submitting this PR. Not depending on eitherlora-sync orlora-async is an intentional design choice to save flash size - both these packages are biggish and no one is likely to need both.

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'
Copy link
Contributor

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.

@projectgusprojectgus self-assigned thisOct 7, 2025
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@projectgusprojectgusprojectgus left review comments

Assignees

@projectgusprojectgus

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

2 participants

@brenordv@projectgus

[8]ページ先頭

©2009-2025 Movatter.jp