Skip to content

Conversation

diegoferigo-rai
Copy link

Description

This PR updates the pyproject.toml configuration to improve compatibility with tooling such as black and pyright. The changes affect both standalone usage of these tools and their integration when invoked from IDEs like VSCode.

This allows users who are not interested in autogenerating the settings.json file to have their IDEs configured out of the box.

This approach could be also extended to other tools like flake, pylint, etc.

Note

This PR targets feature/newton, which is the branch I'm currently interested. It can be backported to main if needed.

Type of change

  • New feature (non-breaking change which adds functionality)

Checklist

  • I have read and understood the contribution guidelines
  • I have run the pre-commit checks with ./isaaclab.sh --format
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • I have updated the changelog and the corresponding version in the extension's config/extension.toml file
  • I have added my name to the CONTRIBUTORS.md or my name already exists there

@Mayankm96
Copy link
Contributor

@ClemensSchwarke Following up here with our discussion to switch to ruff entirely :)

@diegoferigo-rai
Copy link
Author

@ClemensSchwarke Following up here with our discussion to switch to ruff entirely :)

I'd be super happy about a ruff migration. Let me know what works best for you. I can update this PR to introduce a ruff configuration compatible with black and isort, or close this and wait for your upcoming PRs.

@ClemensSchwarke
Copy link
Collaborator

ClemensSchwarke commented Oct 10, 2025

Hey @diegoferigo-rai, I think it would be super nice if you could add the ruff configuration for the parts you are interested in. I can take care of the remaining integration.

@diegoferigo-rai
Copy link
Author

The transition blackruff formatting seems straightforward, only a few minor formatting changes are needed.

However, the isortruff migration is more complex. IsaacLab defines a long list of custom import-sorting rules and sections. Are all of these custom rules actually required?

It would be helpful if someone could provide context on why the default isort or ruff’s built-in linter isn't sufficient for this project.

From my perspective, many of these custom rules seem like a workaround for other underlying issues rather than something inherently required.

IsaacLab/pyproject.toml

Lines 10 to 64 in f52aa98

# Order of imports
sections = [
"FUTURE",
"STDLIB",
"THIRDPARTY",
"ASSETS_FIRSTPARTY",
"FIRSTPARTY",
"EXTRA_FIRSTPARTY",
"TASK_FIRSTPARTY",
"LOCALFOLDER",
]
# Extra standard libraries considered as part of python (permissive licenses
extra_standard_library = [
"numpy",
"h5py",
"open3d",
"torch",
"tensordict",
"bpy",
"matplotlib",
"gymnasium",
"gym",
"scipy",
"hid",
"yaml",
"prettytable",
"toml",
"trimesh",
"tqdm",
"torchvision",
"transformers",
"einops" # Needed for transformers, doesn't always auto-install
]
# Imports from Isaac Sim and Omniverse
known_third_party = [
"isaacsim.core.api",
"isaacsim.replicator.common",
"omni.replicator.core",
"pxr",
"omni.kit.*",
"warp",
"carb",
"Semantics",
]
# Imports from this repository
known_first_party = "isaaclab"
known_assets_firstparty = "isaaclab_assets"
known_extra_firstparty = [
"isaaclab_rl",
"isaaclab_mimic",
]
known_task_firstparty = "isaaclab_tasks"
# Imports from the local folder
known_local_folder = "config"

@ClemensSchwarke
Copy link
Collaborator

I am not sure of the reasons for this isort setup (maybe @Mayankm96 can help), but I think it should be fairly easy to have a similar configuration for ruff.

@Mayankm96
Copy link
Contributor

I think back then isort was sorting them out alphabetically (don't remember a 100%). I wanted to group the imports based on their types (as expressed in the list) to make it easier to read through the imports.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: Ready

Development

Successfully merging this pull request may close these issues.

3 participants