Skip to content

Commit 7a516c4

Browse files
authored
Update AI docs (#6728)
* update copilot instructions * upgrade-pylib command
1 parent 3d4aaaa commit 7a516c4

File tree

2 files changed

+45
-2
lines changed

2 files changed

+45
-2
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`

.github/copilot-instructions.md

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,18 +87,23 @@ rm -r target/debug/build/rustpython-* && find . | grep -E "\.pyc$" | xargs rm -r
8787
# Run Rust unit tests
8888
cargo test --workspace --exclude rustpython_wasm
8989

90-
# Run Python snippets tests
90+
# Run Python snippets tests (debug mode recommended for faster compilation)
91+
cargo run -- extra_tests/snippets/builtin_bytes.py
92+
93+
# Run all Python snippets tests with pytest
9194
cd extra_tests
9295
pytest -v
9396

94-
# Run the Python test module
97+
# Run the Python test module (release mode recommended for better performance)
9598
cargo run --release -- -m test ${TEST_MODULE}
9699
cargo run --release -- -m test test_unicode # to test test_unicode.py
97100

98101
# Run the Python test module with specific function
99102
cargo run --release -- -m test test_unicode -k test_unicode_escape
100103
```
101104

105+
**Note**: For `extra_tests/snippets` tests, use debug mode (`cargo run`) as compilation is faster. For `unittest` (`-m test`), use release mode (`cargo run --release`) for better runtime performance.
106+
102107
### Determining What to Implement
103108

104109
Run `./whats_left.py` to get a list of unimplemented methods, which is helpful when looking for contribution opportunities.
@@ -184,6 +189,12 @@ cargo build --target wasm32-wasip1 --no-default-features --features freeze-stdli
184189
cargo run --features jit
185190
```
186191

192+
### Building venvlauncher (Windows)
193+
194+
See DEVELOPMENT.md "CPython Version Upgrade Checklist" section.
195+
196+
**IMPORTANT**: All 4 venvlauncher binaries use the same source code. Do NOT add multiple `[[bin]]` entries to Cargo.toml. Build once and copy with different names.
197+
187198
## Test Code Modification Rules
188199

189200
**CRITICAL: Test code modification restrictions**

0 commit comments

Comments
 (0)