Skip to content

Make torch an optional import - #37

Closed
Tuxliri wants to merge 1 commit into
spencerfolk:mainfrom
duckietown:feat/torch-optional-dep
Closed

Make torch an optional import#37
Tuxliri wants to merge 1 commit into
spencerfolk:mainfrom
duckietown:feat/torch-optional-dep

Conversation

@Tuxliri

@Tuxliri Tuxliri commented Mar 29, 2026

Copy link
Copy Markdown
Contributor

No description provided.

torch, torchdiffeq, roma, and opt-einsum are only required for the
batched simulator (BatchedMultirotor, simulate_batch, BatchedSE3Control,
etc.). Moving them to an optional extra avoids forcing all users to
install PyTorch (~2 GB) when they only need the standard single-drone
simulator.

- pyproject.toml: remove the four packages from core dependencies and
  add a new `batched` extra; also include them in `all`
- Wrap top-level torch/roma/torchdiffeq imports with try/except in
  every file that mixes batched and non-batched classes, so those
  modules remain importable without the extra installed

Install the batched simulator with: pip install rotorpy[batched]

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@Tuxliri
Tuxliri force-pushed the feat/torch-optional-dep branch from 94dd048 to 12b076d Compare March 29, 2026 23:43
@Tuxliri Tuxliri closed this Mar 29, 2026
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