-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathpython-tools.mdc
More file actions
53 lines (38 loc) · 1.35 KB
/
python-tools.mdc
File metadata and controls
53 lines (38 loc) · 1.35 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
---
globs: "*.py"
---
# Python Tooling Rules
Python scripts in this project are **build/flash/monitor tools**, not the main application.
## Style
- Use **single quotes** for strings
- 120 character line length
- Use `argparse` for CLI arguments
- Use `subprocess.run()` for shell commands
- Use `pathlib.Path` for file operations
## Key Scripts
| Script | Purpose |
| ---------------- | ----------------------------------------------- |
| `build.py` | Build for ESP32/ESP32-S3 (wraps `idf.py build`) |
| `flash.py` | Flash firmware to device |
| `monitor.py` | Serial monitor |
| `espresso.py` | Deployment tool |
| `configure.py` | Project configuration |
| `core_dumper.py` | Analyze core dumps |
## Pattern
```python
#!/usr/bin/env python3
import argparse
import subprocess
import sys
from pathlib import Path
def main() -> int:
parser = argparse.ArgumentParser(description='Tool description')
# args...
args = parser.parse_args()
# Implementation
return 0
if __name__ == '__main__':
sys.exit(main())
```
## ESP-IDF Integration
These scripts wrap ESP-IDF tools. Ensure `IDF_PATH` is set and ESP-IDF is activated before running.