Skip to content

Commit b22176f

Browse files
committed
upgrade-pylib command
1 parent c7c874f commit b22176f

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

.claude/commands/upgrade-pylib.md

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# Upgrade Python Library from CPython
2+
3+
Upgrade a Python standard library module from CPython to RustPython.
4+
5+
## Arguments
6+
- `$ARGUMENTS`: Library name to upgrade (e.g., `inspect`, `asyncio`, `json`)
7+
8+
## Steps
9+
10+
1. **Delete existing library in Lib/**
11+
- If `Lib/$ARGUMENTS.py` exists, delete it
12+
- If `Lib/$ARGUMENTS/` directory exists, delete it
13+
14+
2. **Copy from cpython/Lib/**
15+
- If `cpython/Lib/$ARGUMENTS.py` exists, copy it to `Lib/$ARGUMENTS.py`
16+
- If `cpython/Lib/$ARGUMENTS/` directory exists, copy it to `Lib/$ARGUMENTS/`
17+
18+
3. **Upgrade tests**
19+
- Run: `python lib_updater.py --quick-upgrade cpython/Lib/test/test_$ARGUMENTS`
20+
- This will update the test files with appropriate RustPython markers
21+
22+
## Example Usage
23+
```
24+
/upgrade-pylib inspect
25+
/upgrade-pylib json
26+
/upgrade-pylib asyncio
27+
```
28+
29+
## Notes
30+
- The cpython/ directory should contain the CPython source that we're syncing from
31+
- lib_updater.py handles adding `# TODO: RUSTPYTHON` markers and `@unittest.expectedFailure` decorators
32+
- After upgrading, you may need to run tests to verify: `cargo run --release -- -m test test_$ARGUMENTS`

0 commit comments

Comments
 (0)