Skip to content

Commit 13fcf52

Browse files
diegoferigo-raiexploy-bot
authored andcommitted
Fix pre-commit checks and update VSCode configuration
### What change is being made - Fix pre-commit checks - Enable pre-commit in CI - Fix VSCode configuration such that C++ and Python should work OOTB ### Why this change is being made Enhance development experience (and align with changes of #102). ### Tested Waited CI to pass and tested locally in VSCode (a confirmation that it works also on reviewers setup would be great, since typically this is quite delicate). GitOrigin-RevId: 5e92331692bb6a6d74c1dd9528a4e47ba8d5a8de
1 parent 559484e commit 13fcf52

14 files changed

Lines changed: 613 additions & 224 deletions

.github/workflows/test.yml

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ on:
77
push:
88
branches:
99
- main
10+
workflow_dispatch:
1011

1112
permissions:
1213
contents: read
@@ -38,12 +39,6 @@ jobs:
3839
- name: Run Tests
3940
run: pixi run test-python-core --capture=no
4041

41-
- name: Run Python Linting
42-
run: pixi run lint-python
43-
44-
- name: Check Python Formatting
45-
run: pixi run format-python-check
46-
4742
test-controller:
4843
name: Test Controller Environment
4944
runs-on: ubuntu-22.04
@@ -65,5 +60,20 @@ jobs:
6560
- name: Run Controller Tests
6661
run: pixi run test-cpp
6762

68-
- name: Check Formatting
69-
run: pixi run format-cpp-check
63+
pre-commit:
64+
name: Pre-commit Hooks
65+
runs-on: ubuntu-22.04
66+
timeout-minutes: 20
67+
steps:
68+
- name: Checkout
69+
uses: actions/checkout@v6
70+
71+
- name: Setup pixi
72+
uses: prefix-dev/setup-pixi@v0.9.4
73+
with:
74+
pixi-version: latest
75+
frozen: true
76+
cache: false
77+
78+
- name: Run pre-commit Hooks
79+
run: pixi run pre-commit-ci

.pre-commit-config.yaml

Lines changed: 37 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ repos:
1212
hooks:
1313
# check for files > 1Mb on commit (ignores git-lfs tracked files)
1414
- id: check-added-large-files
15-
args: ['--enforce-all', '--maxkb', '1024']
15+
args: ["--enforce-all", "--maxkb", "1024"]
1616
# detect any unresolved merge conflicts remaining in files
1717
- id: check-merge-conflict
1818
# check that executable files have shebangs
@@ -23,7 +23,7 @@ repos:
2323
- id: check-toml
2424
# attempt to parse/load yaml files to verify they don't have obvious issues
2525
- id: check-yaml
26-
args: ['--allow-multiple-documents']
26+
args: ["--allow-multiple-documents"]
2727
# fix end of file inconsistencies caused by different editors
2828
- id: end-of-file-fixer
2929
# fix trailing whitespace in files of all types
@@ -35,33 +35,59 @@ repos:
3535
hooks:
3636
- id: insert-license
3737
files: (\.cpp|\.cc|\.c|\.hpp|\.h)$
38-
args: [--comment-style, //, --license-filepath, .copyright.txt, --allow-past-years, --use-current-year, --no-extra-eol]
38+
args:
39+
[
40+
--comment-style,
41+
//,
42+
--license-filepath,
43+
.copyright.txt,
44+
--allow-past-years,
45+
--use-current-year,
46+
--no-extra-eol,
47+
]
3948
- id: insert-license
4049
files: (\.sh|\.bash|\.py|CMakeLists\.txt|\.cmake|\.cmake\.in|\.yaml|\.yml|\.toml)$
41-
args: [--license-filepath, .copyright.txt, --allow-past-years, --use-current-year, --no-extra-eol]
42-
50+
args:
51+
[
52+
--license-filepath,
53+
.copyright.txt,
54+
--allow-past-years,
55+
--use-current-year,
56+
--no-extra-eol,
57+
]
4358

4459
- repo: https://github.com/igorshubovych/markdownlint-cli
4560
rev: v0.41.0
4661
hooks:
4762
- id: markdownlint
48-
args: [--fix] # apply simple fixes (and report as failure)
63+
args: [--fix] # apply simple fixes (and report as failure)
4964

50-
# custom hook to run python linter/formatter
5165
- repo: local
5266
hooks:
5367
- id: lint-python-fix
54-
name: Run Python linter
55-
entry: pixi run -e python lint-python-fix
68+
name: run python linter
69+
entry: pixi
70+
args: [run, -e, ci, lint-python-fix]
5671
language: system
5772
types: [python]
5873
pass_filenames: false
5974

6075
- repo: local
6176
hooks:
6277
- id: format-python
63-
name: Run Python formatter
64-
entry: pixi run -e python format-python
78+
name: run python formatter
79+
entry: pixi
80+
args: [run, -e, ci, format-python]
6581
language: system
6682
types: [python]
6783
pass_filenames: false
84+
85+
- repo: local
86+
hooks:
87+
- id: format-cpp
88+
name: run C++ formatter
89+
entry: pixi
90+
args: [run, -e, ci, format-cpp]
91+
language: system
92+
types: [c++]
93+
pass_filenames: false

.vscode/c_cpp_properties.json

Lines changed: 13 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,15 @@
1+
// IntelliSense configuration.
12
{
2-
"configurations": [
3-
{
4-
"name": "Linux",
5-
"includePath": [
6-
"${workspaceFolder}/**",
7-
"${env:CONDA_PREFIX}/include/**",
8-
"${env:CONDA_PREFIX}/include/c++/**",
9-
"${workspaceFolder}/control",
10-
"${workspaceFolder}/build"
11-
],
12-
"defines": [],
13-
"compilerPath": "${env:CONDA_PREFIX}/bin/g++",
14-
"cStandard": "c17",
15-
"cppStandard": "c++20",
16-
"intelliSenseMode": "linux-gcc-x64",
17-
"compileCommands": "${workspaceFolder}/build/compile_commands.json"
18-
}
19-
],
20-
"version": 4
3+
"configurations": [
4+
{
5+
"name": "Linux",
6+
"compilerPath": "${workspaceFolder}/.pixi/envs/cpp/bin/g++",
7+
"intelliSenseMode": "linux-gcc-x64",
8+
"compileCommands": [
9+
"${workspaceFolder}/build/control/compile_commands.json",
10+
"${workspaceFolder}/build/examples/controller/compile_commands.json"
11+
]
12+
}
13+
],
14+
"version": 4
2115
}

.vscode/extensions.json

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
{
2-
"recommendations": [
3-
"ms-vscode.cpptools",
4-
"ms-vscode.cpptools-extension-pack",
5-
"ms-vscode.cmake-tools",
6-
"twxs.cmake",
7-
"ms-python.python",
8-
"charliermarsh.ruff",
9-
"lijian-onnx-viewer.onnxviewer",
10-
]
2+
"recommendations": [
3+
"charliermarsh.ruff",
4+
"lijian-onnx-viewer.onnxviewer",
5+
"ms-python.python",
6+
"ms-vscode.cpptools",
7+
"ms-vscode.cpptools-extension-pack",
8+
"ms-vscode.cmake-tools",
9+
"renan-r-santos.pixi-code",
10+
"twxs.cmake",
11+
]
1112
}

.vscode/launch.json

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,32 @@
11
{
2-
// Use IntelliSense to learn about possible attributes.
3-
// Hover to view descriptions of existing attributes.
4-
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
5-
"version": "0.2.0",
6-
"configurations": [
7-
{
8-
"name": "[Examples] Export IsaacLab task.",
9-
"type": "debugpy",
10-
"request": "launch",
11-
"program": "${workspaceFolder}/examples/exporter_scripts/export_isaaclab.py",
12-
"console": "integratedTerminal",
13-
"python": "${workspaceFolder}/.pixi/envs/isaaclab/bin/python",
14-
"justMyCode": false
15-
},
16-
{
17-
"name": "[Core] Tests.",
18-
"type": "debugpy",
19-
"request": "launch",
20-
"module": "pytest",
21-
"args": [
22-
"exploy/exporter/core/tests/test_export_environment.py"
23-
],
24-
"console": "integratedTerminal",
25-
"python": "${workspaceFolder}/.pixi/envs/core/bin/python",
26-
"justMyCode": false,
27-
"env": {
28-
"PYTHONPATH": "${workspaceFolder}"
29-
}
30-
},
31-
]
2+
// Use IntelliSense to learn about possible attributes.
3+
// Hover to view descriptions of existing attributes.
4+
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
5+
"version": "0.2.0",
6+
"configurations": [
7+
{
8+
"name": "[Examples] Export IsaacLab task.",
9+
"type": "debugpy",
10+
"request": "launch",
11+
"program": "${workspaceFolder}/examples/exporter_scripts/isaaclab/export_isaaclab.py",
12+
"console": "integratedTerminal",
13+
"python": "${workspaceFolder}/.pixi/envs/isaaclab/bin/python",
14+
"justMyCode": false
15+
},
16+
{
17+
"name": "[Core] Tests.",
18+
"type": "debugpy",
19+
"request": "launch",
20+
"module": "pytest",
21+
"args": [
22+
"${workspaceFolder}/python/exploy/exporter/core/tests/test_export_environment.py"
23+
],
24+
"console": "integratedTerminal",
25+
"python": "${workspaceFolder}/.pixi/envs/python/bin/python",
26+
"justMyCode": false,
27+
"env": {
28+
"PYTHONPATH": "${workspaceFolder}"
29+
}
30+
},
31+
]
3232
}

.vscode/settings.json

Lines changed: 58 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,60 @@
11
{
2-
"C_Cpp.default.includePath": [
3-
"${workspaceFolder}/**",
4-
"${env:CONDA_PREFIX}/include/**",
5-
"${env:CONDA_PREFIX}/include/c++/**"
6-
],
7-
"C_Cpp.default.compilerPath": "${env:CONDA_PREFIX}/bin/g++",
8-
"C_Cpp.default.cppStandard": "c++17",
9-
"C_Cpp.default.intelliSenseMode": "linux-gcc-x64",
10-
"C_Cpp.default.compileCommands": "${workspaceFolder}/build/compile_commands.json",
11-
"files.associations": {
12-
"*.hpp": "cpp",
13-
"*.cpp": "cpp"
14-
},
15-
"cmake.sourceDirectory": "${workspaceFolder}",
16-
"cmake.buildDirectory": "${workspaceFolder}/build",
17-
"cmake.configureOnOpen": false,
18-
"python.defaultInterpreterPath": "${env:CONDA_PREFIX}/bin/python",
19-
// Format on save settings
20-
"editor.formatOnSave": true,
21-
"editor.formatOnPaste": true,
22-
"editor.formatOnType": false,
23-
// Language-specific formatters
24-
"[cpp]": {
25-
"editor.defaultFormatter": "ms-vscode.cpptools",
26-
"editor.formatOnSave": true
27-
},
28-
"[c]": {
29-
"editor.defaultFormatter": "ms-vscode.cpptools",
30-
"editor.formatOnSave": true
31-
},
32-
"[python]": {
33-
"editor.defaultFormatter": "charliermarsh.ruff",
34-
"editor.formatOnSave": true
35-
},
36-
// Editor consistency settings to match project standards
37-
"editor.rulers": [
38-
100
39-
],
40-
"editor.wordWrap": "off",
41-
"files.insertFinalNewline": true,
42-
"files.trimTrailingWhitespace": true,
43-
"files.trimFinalNewlines": true
2+
"files.associations": {
3+
"*.hpp": "cpp",
4+
"*.cpp": "cpp"
5+
},
6+
"files.exclude": {
7+
".ruff_cache/**": true,
8+
".pytest_cache/": true,
9+
},
10+
// "C_Cpp.loggingLevel": "Debug",
11+
"C_Cpp.intelliSenseEngine": "default",
12+
"cmake.sourceDirectory": "${workspaceFolder}",
13+
"cmake.buildDirectory": "${workspaceFolder}/build",
14+
"cmake.configureOnOpen": false,
15+
"python.defaultInterpreterPath": "${workspaceFolder}/.pixi/envs/python/bin/python",
16+
// Format on save settings
17+
"editor.formatOnSave": true,
18+
"editor.formatOnPaste": true,
19+
"editor.formatOnType": false,
20+
// Language-specific formatters
21+
"[cpp]": {
22+
"editor.defaultFormatter": "ms-vscode.cpptools",
23+
"editor.formatOnSave": true
24+
},
25+
"[c]": {
26+
"editor.defaultFormatter": "ms-vscode.cpptools",
27+
"editor.formatOnSave": true
28+
},
29+
"[python]": {
30+
"editor.defaultFormatter": "charliermarsh.ruff",
31+
"editor.formatOnSave": true
32+
},
33+
// Editor consistency settings to match project standards
34+
"editor.rulers": [
35+
100
36+
],
37+
"editor.wordWrap": "off",
38+
"files.insertFinalNewline": true,
39+
"files.trimTrailingWhitespace": true,
40+
"files.trimFinalNewlines": true,
41+
"python.languageServer": "Pylance",
42+
"python.analysis.languageServerMode": "full",
43+
"python.analysis.generateWithTypeAnnotation": true,
44+
"python.analysis.inlayHints.pytestParameters": true,
45+
"python.analysis.inlayHints.functionReturnTypes": true,
46+
"python-envs.pythonProjects": [
47+
{
48+
"path": ".",
49+
"envManager": "renan-r-santos.pixi-code:pixi",
50+
"packageManager": "renan-r-santos.pixi-code:pixi"
51+
}
52+
],
53+
"python.analysis.extraPaths": [
54+
"${workspaceFolder}/.pixi/envs/isaaclab/lib/python3.11/site-packages/isaaclab/source/isaaclab",
55+
"${workspaceFolder}/.pixi/envs/isaaclab/lib/python3.11/site-packages/isaaclab/source/isaaclab_rl",
56+
"${workspaceFolder}/.pixi/envs/isaaclab/lib/python3.11/site-packages/isaaclab/source/isaaclab_tasks",
57+
"${workspaceFolder}/.pixi/envs/isaaclab/lib/python3.11/site-packages/isaacsim/exts/isaacsim.core.utils",
58+
"${workspaceFolder}/.pixi/envs/isaaclab/lib/python3.11/site-packages",
59+
]
4460
}

docs/tutorial/controller/controller_tutorial.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -441,7 +441,7 @@ Suppose your model has an input tensor named `custom.planner.output` of shape
441441
The built-in matchers ignore tensors with the `custom.*` prefix, so you need a
442442
custom matcher.
443443
444-
**Step 1 — define an interface for your data source**
444+
#### Step 1 — define an interface for your data source
445445
446446
```cpp
447447
// Your own header — no dependency on exploy.
@@ -456,7 +456,7 @@ class PlannerInterface {
456456
};
457457
```
458458

459-
**Step 2 — implement `Input`**
459+
#### Step 2 — implement `Input`
460460

461461
```cpp
462462
#include "exploy/components.hpp" // Input, OnnxRuntime
@@ -499,7 +499,7 @@ class PlannerInput : public exploy::control::Input {
499499
};
500500
```
501501
502-
**Step 3 — implement `Matcher`**
502+
#### Step 3 — implement `Matcher`
503503
504504
The matcher uses the `custom.<type>.<name>` pattern. The regex captures the
505505
type segment (group 1) and the name segment (group 2). Here the matcher
@@ -546,7 +546,7 @@ class PlannerMatcher : public exploy::control::Matcher {
546546
};
547547
```
548548

549-
**Step 4 — register the matcher before `controller.create()`**
549+
#### Step 4 — register the matcher before `controller.create()`
550550

551551
```cpp
552552
MyMotionPlanner planner; // implements PlannerInterface

0 commit comments

Comments
 (0)