Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions .claude/commands/upgrade-pylib.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Upgrade Python Library from CPython

Upgrade a Python standard library module from CPython to RustPython.

## Arguments
- `$ARGUMENTS`: Library name to upgrade (e.g., `inspect`, `asyncio`, `json`)

## Steps

1. **Delete existing library in Lib/**
- If `Lib/$ARGUMENTS.py` exists, delete it
- If `Lib/$ARGUMENTS/` directory exists, delete it

2. **Copy from cpython/Lib/**
- If `cpython/Lib/$ARGUMENTS.py` exists, copy it to `Lib/$ARGUMENTS.py`
- If `cpython/Lib/$ARGUMENTS/` directory exists, copy it to `Lib/$ARGUMENTS/`

3. **Upgrade tests**
- Run: `python lib_updater.py --quick-upgrade cpython/Lib/test/test_$ARGUMENTS`
- This will update the test files with appropriate RustPython markers

## Example Usage
```
/upgrade-pylib inspect
/upgrade-pylib json
/upgrade-pylib asyncio
```

## Notes
- The cpython/ directory should contain the CPython source that we're syncing from
- lib_updater.py handles adding `# TODO: RUSTPYTHON` markers and `@unittest.expectedFailure` decorators
- After upgrading, you may need to run tests to verify: `cargo run --release -- -m test test_$ARGUMENTS`
15 changes: 13 additions & 2 deletions .github/copilot-instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,18 +87,23 @@ rm -r target/debug/build/rustpython-* && find . | grep -E "\.pyc$" | xargs rm -r
# Run Rust unit tests
cargo test --workspace --exclude rustpython_wasm

# Run Python snippets tests
# Run Python snippets tests (debug mode recommended for faster compilation)
cargo run -- extra_tests/snippets/builtin_bytes.py

# Run all Python snippets tests with pytest
cd extra_tests
pytest -v

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

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

**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.

### Determining What to Implement

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

### Building venvlauncher (Windows)

See DEVELOPMENT.md "CPython Version Upgrade Checklist" section.

**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.

## Test Code Modification Rules

**CRITICAL: Test code modification restrictions**
Expand Down
Loading