Repository navigation
Breaks actuator config file into separate files to avoid circular imports - #3994
Conversation
Greptile OverviewGreptile SummaryThis PR successfully refactors the actuator configuration structure by splitting the monolithic Key Changes
Issues FoundThe deprecation shim in Confidence Score: 4/5
Important Files ChangedFile Analysis
Sequence DiagramsequenceDiagram
participant User as User Code
participant OldCfg as actuator_cfg.py<br/>(deprecated)
participant NewBase as actuator_base_cfg.py
participant NewPD as actuator_pd_cfg.py
participant NewNet as actuator_net_cfg.py
participant Init as __init__.py
participant Base as actuator_base.py
Note over User,Base: New Import Path (Recommended)
User->>Init: from isaaclab.actuators import ImplicitActuatorCfg
Init->>NewPD: import from actuator_pd_cfg
NewPD->>Base: import actuator_pd module
Init-->>User: Return config class
Note over User,Base: Legacy Import Path (Deprecated)
User->>OldCfg: from actuator_cfg import ImplicitActuatorCfg
OldCfg->>OldCfg: __getattr__("ImplicitActuatorCfg")
OldCfg->>NewPD: Check if name in dir(actuator_pd_cfg)
OldCfg->>User: warnings.warn(DeprecationWarning)
OldCfg->>NewPD: getattr(actuator_pd_cfg, name)
NewPD-->>OldCfg: Return config class
OldCfg-->>User: Return config class
Note over User,Base: Circular Import Resolution
Base->>NewBase: TYPE_CHECKING import ActuatorBaseCfg
Note over Base: No circular dependency:<br/>actuator_base.py → actuator_base_cfg.py<br/>(previously: actuator_base.py → actuator_cfg.py → actuator_base.py)
|
738c478 to
0dfbf47
Compare
There was a problem hiding this comment.
Additional Comments (1)
-
source/isaaclab/isaaclab/actuators/actuator_cfg.py, line 1-291 (link)logic: Old
actuator_cfg.pyfile still exists but should be deletedThis file was supposed to be deleted as part of the refactoring to split configs into separate modules. Having both the old monolithic file and the new split files creates:
- Duplicate class definitions (all configs exist in two places)
- Potential for import confusion
- The circular import issue this PR aims to fix could persist through this file
Delete this file since all classes are now properly exported through:
actuator_base_cfg.pyactuator_pd_cfg.pyactuator_net_cfg.py__init__.py
18 files reviewed, 1 comment
Mayankm96
left a comment
There was a problem hiding this comment.
Could you also make sure the api docs are building correctly?
14f5347 to
d6004fd
Compare
I may not be clear on what the ask is here. The build docs check is completing successfully. I believe the deploy step is skipped until we merge. I don't know if, for example, autoclass directives are correctly displayed in the git rest api preview. |
815a22d to
23e95ab
Compare
57155d0 to
1c5ab00
Compare
1c5ab00 to
c32db68
Compare
c6af236 to
5014ea8
Compare
a332a31 to
dbc2f2d
Compare
dbc2f2d to
44deabe
Compare
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com> Signed-off-by: Brian McCann <[email protected]>
Signed-off-by: Brian McCann <[email protected]>
Signed-off-by: Kelly Guo <[email protected]>
Signed-off-by: Kelly Guo <[email protected]>
Signed-off-by: Kelly Guo <[email protected]>
Signed-off-by: Kelly Guo <[email protected]>
Signed-off-by: Kelly Guo <[email protected]>
Signed-off-by: Kelly Guo <[email protected]>
Signed-off-by: Kelly Guo <[email protected]>
…orts (isaac-sim#3994) # Description This PR breaks the actuator config into separate files in order to avoid a circular import which arises once the configuration is imported into the actuator base class for more than type hinting. ## Type of change - Possible breaking change! The actuator configs have moved `.py` files and thus modules. They can still be imported directly from the `isaaclab.actuators` package. External references to these classes through the `actuator_cfg` module will not longer work. Instead, import directly from the `isaaclab.actuators` package. ## Checklist - [x] I have read and understood the [contribution guidelines](https://isaac-sim.github.io/IsaacLab/main/source/refs/contributing.html) - [x] I have run the [`pre-commit` checks](https://pre-commit.com/) with `./isaaclab.sh --format` - [x] I have made corresponding changes to the documentation - [x] My changes generate no new warnings - [x] I have added tests that prove my fix is effective or that my feature works - [x] I have updated the changelog and the corresponding version in the extension's `config/extension.toml` file - [x] I have added my name to the `CONTRIBUTORS.md` or my name already exists there --------- Signed-off-by: Brian McCann <[email protected]> Signed-off-by: Kelly Guo <[email protected]> Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com> Co-authored-by: Kelly Guo <[email protected]>
…orts (isaac-sim#3994) # Description This PR breaks the actuator config into separate files in order to avoid a circular import which arises once the configuration is imported into the actuator base class for more than type hinting. ## Type of change - Possible breaking change! The actuator configs have moved `.py` files and thus modules. They can still be imported directly from the `isaaclab.actuators` package. External references to these classes through the `actuator_cfg` module will not longer work. Instead, import directly from the `isaaclab.actuators` package. ## Checklist - [x] I have read and understood the [contribution guidelines](https://isaac-sim.github.io/IsaacLab/main/source/refs/contributing.html) - [x] I have run the [`pre-commit` checks](https://pre-commit.com/) with `./isaaclab.sh --format` - [x] I have made corresponding changes to the documentation - [x] My changes generate no new warnings - [x] I have added tests that prove my fix is effective or that my feature works - [x] I have updated the changelog and the corresponding version in the extension's `config/extension.toml` file - [x] I have added my name to the `CONTRIBUTORS.md` or my name already exists there --------- Signed-off-by: Brian McCann <[email protected]> Signed-off-by: Kelly Guo <[email protected]> Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com> Co-authored-by: Kelly Guo <[email protected]>
…orts (isaac-sim#3994) # Description This PR breaks the actuator config into separate files in order to avoid a circular import which arises once the configuration is imported into the actuator base class for more than type hinting. ## Type of change - Possible breaking change! The actuator configs have moved `.py` files and thus modules. They can still be imported directly from the `isaaclab.actuators` package. External references to these classes through the `actuator_cfg` module will not longer work. Instead, import directly from the `isaaclab.actuators` package. ## Checklist - [x] I have read and understood the [contribution guidelines](https://isaac-sim.github.io/IsaacLab/main/source/refs/contributing.html) - [x] I have run the [`pre-commit` checks](https://pre-commit.com/) with `./isaaclab.sh --format` - [x] I have made corresponding changes to the documentation - [x] My changes generate no new warnings - [x] I have added tests that prove my fix is effective or that my feature works - [x] I have updated the changelog and the corresponding version in the extension's `config/extension.toml` file - [x] I have added my name to the `CONTRIBUTORS.md` or my name already exists there --------- Signed-off-by: Brian McCann <[email protected]> Signed-off-by: Kelly Guo <[email protected]> Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com> Co-authored-by: Kelly Guo <[email protected]>
Description
This PR breaks the actuator config into separate files in order to avoid a circular import which arises once the configuration is imported into the actuator base class for more than type hinting.
Type of change
.pyfiles and thus modules. They can still be imported directly from theisaaclab.actuatorspackage. External references to these classes through theactuator_cfgmodule will not longer work. Instead, import directly from theisaaclab.actuatorspackage.Checklist
pre-commitchecks with./isaaclab.sh --formatconfig/extension.tomlfileCONTRIBUTORS.mdor my name already exists there