Skip to content

py: merge the asyncio wrapper into the mavsdk package - #3007

Draft
julianoes wants to merge 2 commits into
mainfrom
pr-python-merge-asyncio
Draft

py: merge the asyncio wrapper into the mavsdk package#3007
julianoes wants to merge 2 commits into
mainfrom
pr-python-merge-asyncio

Conversation

@julianoes

Copy link
Copy Markdown
Collaborator

Makes aiomavsdk a submodule of mavsdk rather than a second distribution:

Before After
pip install mavsdk4import mavsdk import mavsdk
pip install aiomavsdkimport aiomavsdk import mavsdk.asyncio

One package, two interfaces. This is what projects owning both interfaces normally do — redis.asyncio, sqlalchemy.ext.asyncio, pymongo.asynchronous — and it means users choose an interface at import time instead of choosing a package before they understand the difference. The aio* prefix convention exists mostly for wrappers around someone else's sync library, which is not the case here.

Neither distribution has ever been published to PyPI, so nothing external breaks.

Notes for review

No changes were needed inside the package. Everything already imported either relatively or absolutely from mavsdk.*, and both keep resolving once the package sits underneath mavsdk. The diff is 101 files but almost entirely renames — only the codegen script, the READMEs and two stale docstrings have real content changes.

import asyncio inside mavsdk/asyncio/ still gets the standard library, since Python 3 imports are absolute. Verified rather than assumed.

mavsdk/__init__.py deliberately does not import the submodule, so import mavsdk does not drag in the asyncio machinery, and there is no import cycle.

Code generation is now one script for both flavours, with templates split into templates/sync and templates/asyncio. The two scripts previously differed only in an output path and a ruff path — an easy way to add a plugin to one and forget the other.

Verified

  • import mavsdk and import mavsdk.asyncio both work; mavsdk.asyncio.Mavsdk and mavsdk.asyncio.System resolve.
  • Sync and asyncio plugin trees have identical sets (36 plugins each), before and after.
  • A wheel builds containing both trees under a single mavsdk top-level.
  • Everything under mavsdk/ compiles.

One caveat: I could not exercise the generated plugins at runtime here, because the prebuilt libcmavsdk.so in my tree predates Action::set_home and rebuilding it needs a full libmavsdk rebuild. Both mavsdk.plugins.action and mavsdk.asyncio.plugins.action fail identically on that missing symbol, which shows the move is neutral, but CI building against a current library is the real check.

@julianoes
julianoes marked this pull request as draft July 22, 2026 10:18
@julianoes
julianoes force-pushed the pr-python-merge-asyncio branch 2 times, most recently from fba91c7 to 870f3cc Compare July 23, 2026 01:10
`aiomavsdk` becomes `mavsdk.asyncio`, shipped in the same distribution as the
synchronous API rather than as a second one. This is the layout the ecosystem
expects when a project owns both interfaces -- redis-py's `redis.asyncio`,
`sqlalchemy.ext.asyncio` -- and it means users pick an interface at import time
instead of having to pick a package before they understand the difference.

The move needed no changes inside the package: everything already imported
either relatively or absolutely from `mavsdk.*`, and both keep resolving once
the package sits underneath `mavsdk`. `import asyncio` inside `mavsdk/asyncio/`
still resolves to the standard library, since Python 3 imports are absolute.

Code generation is now one script emitting both flavours, with the templates
split into `templates/sync` and `templates/asyncio`. Keeping two scripts that
differed only in an output path was an invitation to add a plugin to one and
forget the other. The top-level generator loses its separate asyncio pass
accordingly.

Note that `mavsdk/__init__.py` deliberately does not import the submodule, so
`import mavsdk` does not drag in the asyncio machinery.
The asyncio API now ships inside the mavsdk wheel, so there is no second
distribution to build.
@julianoes
julianoes force-pushed the pr-python-merge-asyncio branch from 870f3cc to 8e266e1 Compare July 23, 2026 01:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant