Conversation
Move exception types, TOC cache classes, and subsystem types out of cflib2/__init__.py into dedicated submodules (cflib2.error, cflib2.toc_cache, cflib2.commander, cflib2.log, cflib2.param, cflib2.memory, cflib2.localization, cflib2.platform, cflib2.console, cflib2.high_level_commander). The top-level package now only exports Crazyflie and LinkContext. Relocate trajectory data types (Poly, Poly4D, CompressedStart, CompressedSegment) to memory.py. Update example imports accordingly.
There was a problem hiding this comment.
Pull request overview
This PR reorganizes the Python-facing API surface of cflib2 by moving most Rust-exposed types into dedicated subsystem modules (e.g., cflib2.error, cflib2.toc_cache, cflib2.memory) and keeping the package root focused on core entry points (Crazyflie, LinkContext). Examples and tests are updated to use the new import locations.
Changes:
- Reduce
cflib2top-level re-exports to justCrazyflieandLinkContext. - Add lightweight subsystem modules that re-export Rust types and define clear
__all__sets (error, log, param, memory, etc.). - Update examples/tests to import types from the new subsystem modules.
Reviewed changes
Copilot reviewed 15 out of 15 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| tests/test_exceptions.py | Switch exception hierarchy test to read exception types from cflib2.error instead of the root package. |
| examples/trajectory.py | Fix trajectory primitive imports by using cflib2.memory for Poly/Poly4D. |
| examples/toc_cache.py | Update cache class imports to come from cflib2.toc_cache. |
| examples/swarm.py | Update cache class imports to come from cflib2.toc_cache. |
| cflib2/init.py | Narrow root exports to Crazyflie and LinkContext only. |
| cflib2/error.py | New exception-focused module re-exporting Rust exception types. |
| cflib2/toc_cache.py | New module re-exporting TOC cache types from Rust. |
| cflib2/memory.py | New module re-exporting memory/trajectory-related data types from Rust. |
| cflib2/commander.py | Repurpose module to export the Commander subsystem wrapper (instead of trajectory primitives). |
| cflib2/high_level_commander.py | New module re-exporting the HighLevelCommander subsystem wrapper. |
| cflib2/console.py | New module re-exporting the Console subsystem wrapper. |
| cflib2/log.py | New module re-exporting log subsystem types. |
| cflib2/param.py | New module re-exporting parameter subsystem types. |
| cflib2/platform.py | New module re-exporting platform subsystem types. |
| cflib2/localization.py | New module re-exporting localization subsystem types. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Move exception types, TOC cache classes, and subsystem types out of cflib2/init.py into dedicated submodules (cflib2.error, cflib2.toc_cache, cflib2.commander, cflib2.log, cflib2.param, cflib2.memory, cflib2.localization, cflib2.platform, cflib2.console, cflib2.high_level_commander). The top-level package now only exports Crazyflie and LinkContext. Relocate trajectory data types (Poly, Poly4D, CompressedStart, CompressedSegment) to memory.py. Update example imports accordingly.