Skip to content

Commit 76a6e3c

Browse files
authored
Moves flake8 settings to pyproject (#4335)
# Description Another small step towards switching over to ruff. ## Type of change - Bug fix (non-breaking change which fixes an issue) ## 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` - [ ] I have made corresponding changes to the documentation - [x] 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 - [x] I have added my name to the `CONTRIBUTORS.md` or my name already exists there
1 parent 025443e commit 76a6e3c

File tree

11 files changed

+235
-91
lines changed

11 files changed

+235
-91
lines changed

.flake8

Lines changed: 0 additions & 23 deletions
This file was deleted.

.pre-commit-config.yaml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,14 @@ repos:
88
rev: 24.3.0
99
hooks:
1010
- id: black
11-
args: ["--unstable"]
1211
- repo: https://github.com/pycqa/flake8
13-
rev: 7.0.0
12+
rev: 7.1.0
1413
hooks:
1514
- id: flake8
16-
additional_dependencies: [flake8-simplify, flake8-return]
15+
additional_dependencies:
16+
- flake8-simplify
17+
- flake8-return
18+
- Flake8-pyproject
1719
- repo: https://github.com/pre-commit/pre-commit-hooks
1820
rev: v5.0.0
1921
hooks:

.vscode/tools/settings.template.json

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -62,14 +62,10 @@
6262
// This enables python language server. Seems to work slightly better than jedi:
6363
"python.languageServer": "Pylance",
6464
// We use "black" as a formatter:
65-
"python.formatting.provider": "black",
66-
"python.formatting.blackArgs": ["--line-length", "120"],
65+
"black-formatter.args": ["--line-length", "120", "--unstable"],
6766
// Use flake8 for linting
68-
"python.linting.pylintEnabled": false,
69-
"python.linting.flake8Enabled": true,
70-
"python.linting.flake8Args": [
71-
"--max-line-length=120"
72-
],
67+
"flake8.enabled": true,
68+
"flake8.args": ["--config", "${workspaceFolder}/pyproject.toml"],
7369
// Use docstring generator
7470
"autoDocstring.docstringFormat": "google",
7571
"autoDocstring.guessTypes": true,

docs/conf.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,14 @@
2020

2121
sys.path.insert(0, os.path.abspath("../source/isaaclab"))
2222
sys.path.insert(0, os.path.abspath("../source/isaaclab/isaaclab"))
23+
sys.path.insert(0, os.path.abspath("../source/isaaclab_assets"))
24+
sys.path.insert(0, os.path.abspath("../source/isaaclab_assets/isaaclab_assets"))
2325
sys.path.insert(0, os.path.abspath("../source/isaaclab_tasks"))
2426
sys.path.insert(0, os.path.abspath("../source/isaaclab_tasks/isaaclab_tasks"))
2527
sys.path.insert(0, os.path.abspath("../source/isaaclab_rl"))
2628
sys.path.insert(0, os.path.abspath("../source/isaaclab_rl/isaaclab_rl"))
2729
sys.path.insert(0, os.path.abspath("../source/isaaclab_mimic"))
2830
sys.path.insert(0, os.path.abspath("../source/isaaclab_mimic/isaaclab_mimic"))
29-
sys.path.insert(0, os.path.abspath("../source/isaaclab_assets"))
30-
sys.path.insert(0, os.path.abspath("../source/isaaclab_assets/isaaclab_assets"))
3131

3232
# -- Project information -----------------------------------------------------
3333

@@ -124,11 +124,11 @@
124124
"python": ("https://docs.python.org/3", None),
125125
"numpy": ("https://numpy.org/doc/stable/", None),
126126
"trimesh": ("https://trimesh.org/", None),
127-
"torch": ("https://pytorch.org/docs/stable/", None),
127+
"torch": ("https://docs.pytorch.org/docs/stable/", None),
128128
"isaacsim": ("https://docs.isaacsim.omniverse.nvidia.com/5.1.0/py/", None),
129129
"gymnasium": ("https://gymnasium.farama.org/", None),
130130
"warp": ("https://nvidia.github.io/warp/", None),
131-
"dev-guide": ("https://docs.omniverse.nvidia.com/dev-guide/latest", None),
131+
"omniverse": ("https://docs.omniverse.nvidia.com/dev-guide/latest", None),
132132
}
133133

134134
# Add any paths that contain templates here, relative to this directory.

docs/source/api/lab_mimic/isaaclab_mimic.envs.rst

Lines changed: 124 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,20 +7,138 @@
77

88
.. autosummary::
99

10-
FrankaCubeStackIKRelMimicEnv
11-
FrankaCubeStackIKRelMimicEnvCfg
10+
isaaclab_mimic.envs.franka_stack_ik_rel_mimic_env.FrankaCubeStackIKRelMimicEnv
11+
isaaclab_mimic.envs.franka_stack_ik_rel_mimic_env_cfg.FrankaCubeStackIKRelMimicEnvCfg
12+
isaaclab_mimic.envs.franka_stack_ik_abs_mimic_env.FrankaCubeStackIKAbsMimicEnv
13+
isaaclab_mimic.envs.franka_stack_ik_abs_mimic_env_cfg.FrankaCubeStackIKAbsMimicEnvCfg
14+
isaaclab_mimic.envs.galbot_stack_rmp_rel_mimic_env.RmpFlowGalbotCubeStackRelMimicEnv
15+
isaaclab_mimic.envs.galbot_stack_rmp_rel_mimic_env_cfg.RmpFlowGalbotLeftArmGripperCubeStackRelMimicEnvCfg
16+
isaaclab_mimic.envs.galbot_stack_rmp_rel_mimic_env_cfg.RmpFlowGalbotRightArmSuctionCubeStackRelMimicEnvCfg
17+
isaaclab_mimic.envs.galbot_stack_rmp_abs_mimic_env.RmpFlowGalbotCubeStackAbsMimicEnv
18+
isaaclab_mimic.envs.galbot_stack_rmp_abs_mimic_env_cfg.RmpFlowGalbotLeftArmGripperCubeStackAbsMimicEnvCfg
19+
isaaclab_mimic.envs.galbot_stack_rmp_abs_mimic_env_cfg.RmpFlowGalbotRightArmSuctionCubeStackAbsMimicEnvCfg
20+
isaaclab_mimic.envs.pick_place_mimic_env.PickPlaceRelMimicEnv
21+
isaaclab_mimic.envs.pick_place_mimic_env.PickPlaceAbsMimicEnv
22+
isaaclab_mimic.envs.agibot_place_upright_mug_mimic_env_cfg.RmpFlowAgibotPlaceUprightMugMimicEnvCfg
23+
isaaclab_mimic.envs.agibot_place_toy2box_mimic_env_cfg.RmpFlowAgibotPlaceToy2BoxMimicEnvCfg
24+
25+
Franka Environments
26+
-------------------
1227

1328
Franka Cube Stack IK Rel Mimic Env
14-
----------------------------------
29+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1530

16-
.. autoclass:: FrankaCubeStackIKRelMimicEnv
31+
.. autoclass:: isaaclab_mimic.envs.franka_stack_ik_rel_mimic_env.FrankaCubeStackIKRelMimicEnv
1732
:members:
1833
:inherited-members:
34+
:show-inheritance:
1935

2036
Franka Cube Stack IK Rel Mimic Env Cfg
21-
--------------------------------------
37+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
38+
39+
.. autoclass:: isaaclab_mimic.envs.franka_stack_ik_rel_mimic_env_cfg.FrankaCubeStackIKRelMimicEnvCfg
40+
:members:
41+
:inherited-members:
42+
:show-inheritance:
43+
44+
Franka Cube Stack IK Abs Mimic Env
45+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
46+
47+
.. autoclass:: isaaclab_mimic.envs.franka_stack_ik_abs_mimic_env.FrankaCubeStackIKAbsMimicEnv
48+
:members:
49+
:inherited-members:
50+
:show-inheritance:
51+
52+
Franka Cube Stack IK Abs Mimic Env Cfg
53+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
54+
55+
.. autoclass:: isaaclab_mimic.envs.franka_stack_ik_abs_mimic_env_cfg.FrankaCubeStackIKAbsMimicEnvCfg
56+
:members:
57+
:inherited-members:
58+
:show-inheritance:
59+
60+
Galbot Environments
61+
-------------------
62+
63+
Galbot Cube Stack Rel Mimic Env (RmpFlow)
64+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
65+
66+
.. autoclass:: isaaclab_mimic.envs.galbot_stack_rmp_rel_mimic_env.RmpFlowGalbotCubeStackRelMimicEnv
67+
:members:
68+
:inherited-members:
69+
:show-inheritance:
70+
71+
Galbot Left Arm Gripper Cube Stack Rel Mimic Env Cfg
72+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
73+
74+
.. autoclass:: isaaclab_mimic.envs.galbot_stack_rmp_rel_mimic_env_cfg.RmpFlowGalbotLeftArmGripperCubeStackRelMimicEnvCfg
75+
:members:
76+
:inherited-members:
77+
:show-inheritance:
78+
79+
Galbot Right Arm Suction Cube Stack Rel Mimic Env Cfg
80+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
81+
82+
.. autoclass:: isaaclab_mimic.envs.galbot_stack_rmp_rel_mimic_env_cfg.RmpFlowGalbotRightArmSuctionCubeStackRelMimicEnvCfg
83+
:members:
84+
:inherited-members:
85+
:show-inheritance:
86+
87+
Galbot Cube Stack Abs Mimic Env (RmpFlow)
88+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
89+
90+
.. autoclass:: isaaclab_mimic.envs.galbot_stack_rmp_abs_mimic_env.RmpFlowGalbotCubeStackAbsMimicEnv
91+
:members:
92+
:inherited-members:
93+
:show-inheritance:
94+
95+
Galbot Left Arm Gripper Cube Stack Abs Mimic Env Cfg
96+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
97+
98+
.. autoclass:: isaaclab_mimic.envs.galbot_stack_rmp_abs_mimic_env_cfg.RmpFlowGalbotLeftArmGripperCubeStackAbsMimicEnvCfg
99+
:members:
100+
:inherited-members:
101+
:show-inheritance:
102+
103+
Galbot Right Arm Suction Cube Stack Abs Mimic Env Cfg
104+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
105+
106+
.. autoclass:: isaaclab_mimic.envs.galbot_stack_rmp_abs_mimic_env_cfg.RmpFlowGalbotRightArmSuctionCubeStackAbsMimicEnvCfg
107+
:members:
108+
:inherited-members:
109+
:show-inheritance:
110+
111+
Agibot Environments
112+
-------------------
113+
114+
Pick Place Rel Mimic Env
115+
~~~~~~~~~~~~~~~~~~~~~~~~~
116+
117+
.. autoclass:: isaaclab_mimic.envs.pick_place_mimic_env.PickPlaceRelMimicEnv
118+
:members:
119+
:inherited-members:
120+
:show-inheritance:
121+
122+
Pick Place Abs Mimic Env
123+
~~~~~~~~~~~~~~~~~~~~~~~~~
124+
125+
.. autoclass:: isaaclab_mimic.envs.pick_place_mimic_env.PickPlaceAbsMimicEnv
126+
:members:
127+
:inherited-members:
128+
:show-inheritance:
129+
130+
Agibot Place Upright Mug Mimic Env Cfg
131+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
132+
133+
.. autoclass:: isaaclab_mimic.envs.agibot_place_upright_mug_mimic_env_cfg.RmpFlowAgibotPlaceUprightMugMimicEnvCfg
134+
:members:
135+
:inherited-members:
136+
:show-inheritance:
137+
138+
Agibot Place Toy2Box Mimic Env Cfg
139+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
22140

23-
.. autoclass:: FrankaCubeStackIKRelMimicEnvCfg
141+
.. autoclass:: isaaclab_mimic.envs.agibot_place_toy2box_mimic_env_cfg.RmpFlowAgibotPlaceToy2BoxMimicEnvCfg
24142
:members:
25143
:inherited-members:
26144
:show-inheritance:

docs/source/overview/developer-guide/vs_code.rst

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,3 +75,20 @@ and selecting ``Python: Select Interpreter``.
7575

7676
For more information on how to set python interpreter for VSCode, please
7777
refer to the `VSCode documentation <https://code.visualstudio.com/docs/python/environments#_working-with-python-interpreters>`_.
78+
79+
80+
Setting up formatting and linting
81+
---------------------------------
82+
83+
We use `black <https://black.readthedocs.io/en/stable/>`_ as a formatter and `flake8 <https://flake8.pycqa.org/en/latest/>`_ as a linter. These are configured in the ``.vscode/settings.json`` file:
84+
85+
.. code-block:: json
86+
87+
{
88+
"black-formatter.args": ["--line-length", "120", "--unstable"],
89+
"flake8.enabled": true,
90+
"flake8.args": ["--config", "${workspaceFolder}/pyproject.toml"],
91+
}
92+
93+
The black formatter will automatically format your code to match the project's style guide (120 character line length).
94+
The flake8 linter will show warnings and errors in your code to help you follow Python best practices and the project's coding standards.

pyproject.toml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,46 @@
77
line-length = 120
88
target-version = ["py311"]
99
preview = true
10+
unstable = true
11+
12+
[tool.flake8]
13+
show-source = true
14+
statistics = true
15+
16+
per-file-ignores = [
17+
"*/__init__.py:F401",
18+
]
19+
20+
ignore = [
21+
"E402", # Module level import not at top of file
22+
"E501", # Line too long
23+
"F403", # Unable to detect undefined names
24+
"W503", # Line break before binary operator
25+
"E203", # Whitespace before ':' (Black conflict)
26+
"D401", # First line should be in imperative mood
27+
"R504", # Unnecessary variable assignment before return
28+
"R505", # Unnecessary elif after return statement
29+
"SIM102", # Use a single if-statement instead of nested if-statements
30+
"SIM117", # Merge with statements for context managers that have same scope.
31+
"SIM118", # Checks for key-existence checks against dict.keys() calls.
32+
]
33+
34+
max-line-length = 120
35+
max-complexity = 30
36+
37+
exclude = [
38+
"_**",
39+
".vscode",
40+
".git",
41+
"docs/**",
42+
]
43+
44+
# docstrings
45+
docstring-convention = "google"
46+
47+
# annotations
48+
suppress-none-returning = true
49+
allow-star-arg-any = true
1050

1151
[tool.isort]
1252

source/isaaclab/isaaclab/controllers/config/rmp_flow.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,18 @@
1010
from isaaclab.controllers.rmp_flow import RmpFlowControllerCfg
1111
from isaaclab.utils.assets import ISAACLAB_NUCLEUS_DIR
1212

13+
# Directory on Nucleus Server for RMP-Flow assets (URDFs, collision models, etc.)
1314
ISAACLAB_NUCLEUS_RMPFLOW_DIR = os.path.join(ISAACLAB_NUCLEUS_DIR, "Controllers", "RmpFlowAssets")
1415

1516
# Note: RMP-Flow config files for supported robots are stored in the motion_generation extension
16-
_RMP_CONFIG_DIR = os.path.join(
17-
get_extension_path_from_name("isaacsim.robot_motion.motion_generation"), "motion_policy_configs"
18-
)
17+
# We need to move it here for doc building purposes.
18+
try:
19+
_RMP_CONFIG_DIR = os.path.join(
20+
get_extension_path_from_name("isaacsim.robot_motion.motion_generation"),
21+
"motion_policy_configs",
22+
)
23+
except Exception:
24+
_RMP_CONFIG_DIR = ""
1925

2026
# Path to current directory
2127
_CUR_DIR = os.path.dirname(os.path.realpath(__file__))

0 commit comments

Comments
 (0)