Repository navigation
Introduce /upgrade-pylib-next
#6827
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
6b3e342
70e7a6d
37bdfd6
35ceed8
79babbc
cd1389b
b2c93ca
2712f2b
01c614d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
- Loading branch information
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| --- | ||
| allowed-tools: Bash(git add:*), Bash(git commit:*), Bash(python3 scripts/update_lib quick:*), Skill(upgrade-pylib) | ||
| --- | ||
|
|
||
| # Upgrade Next Python Library | ||
|
|
||
| Find the next Python library module ready for upgrade and run `/upgrade-pylib` for it. | ||
|
|
||
| ## Current TODO Status | ||
|
|
||
| !`cargo run --release -- scripts/update_lib todo 2>/dev/null` | ||
|
|
||
| ## Instructions | ||
|
|
||
| From the TODO list above, find modules matching these patterns (in priority order): | ||
|
|
||
| 1. `[ ] [no deps]` - Modules with no dependencies (can be upgraded immediately) | ||
| 2. `[ ] [n/n]` - Modules where all dependencies are already upgraded (e.g., `[3/3]`, `[5/5]`) | ||
|
|
||
| These patterns indicate modules that are ready to upgrade without blocking dependencies. | ||
|
|
||
| **After identifying a suitable module**, run: | ||
| ``` | ||
| /upgrade-pylib <module_name> | ||
| ``` | ||
|
|
||
| If no modules match these criteria, inform the user that all eligible modules have dependencies that need to be upgraded first. | ||
| Original file line number | Diff line number | Diff line change | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -1,3 +1,7 @@ | ||||||||||||||
| --- | ||||||||||||||
| allowed-tools: Bash(python3 scripts/update_lib auto-mark:*) | ||||||||||||||
| --- | ||||||||||||||
|
Comment on lines
+1
to
+3
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Add missing The workflow in step 3 (line 54) uses 🔧 Proposed fix ---
-allowed-tools: Bash(git add:*), Bash(git commit:*), Bash(python3 scripts/update_lib quick:*), Bash(python3 scripts/update_lib auto-mark:*)
+allowed-tools: Bash(git add:*), Bash(git commit:*), Bash(python3 scripts/update_lib quick:*), Bash(python3 scripts/update_lib auto-mark:*), Bash(cargo run:*)
---Note: This allows 📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||
|
|
||||||||||||||
| # Upgrade Python Library from CPython | ||||||||||||||
|
|
||||||||||||||
| Upgrade a Python standard library module from CPython to RustPython. | ||||||||||||||
|
|
@@ -44,13 +48,25 @@ This helps improve the tooling for future upgrades. | |||||||||||||
| - **Do NOT restore other diff changes** - these are likely upstream CPython changes, not RustPython-specific modifications | ||||||||||||||
| - When restoring, preserve the original context and formatting | ||||||||||||||
|
|
||||||||||||||
| 3. **Verify tests** | ||||||||||||||
| - Run: `cargo run --release -- -m test test_$ARGUMENTS -v` | ||||||||||||||
| - The `-v` flag shows detailed output to identify which tests fail and why | ||||||||||||||
| - For each new failure, add appropriate markers based on the failure type: | ||||||||||||||
| - **Test assertion failure** → `@unittest.expectedFailure` with `# TODO: RUSTPYTHON` comment | ||||||||||||||
| - **Panic/crash** → `@unittest.skip("TODO: RUSTPYTHON; <panic message>")` | ||||||||||||||
| - **Class-specific markers**: If a test fails only in the C implementation (TestCFoo) but passes in the Python implementation (TestPyFoo), or vice versa, add the marker to the specific subclass, not the base class: | ||||||||||||||
| 3. **Mark remaining test failures with auto-mark** | ||||||||||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm dogfooding this command, and as your suggestion, it fixes a failed test automatically! (Other tests (snippets) seem to fail but anyway 😅)
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Great, it is good as long as it doesn't blindly mark everything expectedFailure |
||||||||||||||
| - Run: `python3 scripts/update_lib auto-mark Lib/test/test_$ARGUMENTS.py --mark-failure` | ||||||||||||||
| - Or for directory: `python3 scripts/update_lib auto-mark Lib/test/test_$ARGUMENTS/ --mark-failure` | ||||||||||||||
| - This will: | ||||||||||||||
| - Run tests and mark ALL failing tests with `@unittest.expectedFailure` | ||||||||||||||
| - Remove `@unittest.expectedFailure` from tests that now pass | ||||||||||||||
| - **Note**: The `--mark-failure` flag marks all failures including regressions. Review the changes before committing. | ||||||||||||||
|
|
||||||||||||||
| 4. **Handle panics manually** | ||||||||||||||
| - If any tests cause panics/crashes (not just assertion failures), they need `@unittest.skip` instead: | ||||||||||||||
| ```python | ||||||||||||||
| @unittest.skip("TODO: RUSTPYTHON; panics with 'index out of bounds'") | ||||||||||||||
| def test_crashes(self): | ||||||||||||||
| ... | ||||||||||||||
| ``` | ||||||||||||||
| - auto-mark cannot detect panics automatically - check the test output for crash messages | ||||||||||||||
|
|
||||||||||||||
| 5. **Handle class-specific failures** | ||||||||||||||
| - If a test fails only in the C implementation (TestCFoo) but passes in the Python implementation (TestPyFoo), or vice versa, move the marker to the specific subclass: | ||||||||||||||
| ```python | ||||||||||||||
| # Base class - no marker here | ||||||||||||||
| class TestFoo: | ||||||||||||||
|
|
@@ -65,19 +81,6 @@ This helps improve the tooling for future upgrades. | |||||||||||||
| def test_something(self): | ||||||||||||||
| return super().test_something() | ||||||||||||||
| ``` | ||||||||||||||
| - **New tests from CPython**: The upgrade may bring in entirely new tests that didn't exist before. These won't have any RUSTPYTHON markers in the diff - they just need to be tested and marked if they fail. | ||||||||||||||
| - Example markers: | ||||||||||||||
| ```python | ||||||||||||||
| # TODO: RUSTPYTHON | ||||||||||||||
| @unittest.expectedFailure | ||||||||||||||
| def test_something(self): | ||||||||||||||
| ... | ||||||||||||||
|
|
||||||||||||||
| # TODO: RUSTPYTHON | ||||||||||||||
| @unittest.skip("TODO: RUSTPYTHON; panics with 'index out of bounds'") | ||||||||||||||
| def test_crashes(self): | ||||||||||||||
| ... | ||||||||||||||
| ``` | ||||||||||||||
|
|
||||||||||||||
| ## Example Usage | ||||||||||||||
| ``` | ||||||||||||||
|
|
||||||||||||||
Uh oh!
There was an error while loading. Please reload this page.