Skip to content

Conversation

@youknowone
Copy link
Member

@youknowone youknowone commented Dec 31, 2025

replace #6566

Summary by CodeRabbit

  • New Features

    • Added interpreter() method to InterpreterConfig for building Interpreter instances directly from configuration.
  • API Updates

    • Updated add_native_module method signature for native module registration.
  • Documentation

    • Enhanced documentation and examples for native module integration patterns.
  • Refactor

    • Streamlined stdlib initialization logic.

✏️ Tip: You can customize this high-level summary in your review settings.

77AXEL and others added 4 commits December 31, 2025 21:02
Improve InterpreterConfig with convenience methods (with_debug, add_path, add_paths), better documentation with working examples, refactored stdlib setup into focused functions, and comprehensive unit tests while maintaining 100% backward compatibility.
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Dec 31, 2025

Caution

Review failed

The pull request is closed.

📝 Walkthrough

Walkthrough

The src/interpreter.rs file received updates to its public API and stdlib initialization logic. The add_native_module method signature changed to accept function pointers instead of closures, a new interpreter() builder method was added to InterpreterConfig, and stdlib initialization was refactored into separate helper functions for cleaner organization.

Changes

Cohort / File(s) Summary
Public API Updates
src/interpreter.rs
Added interpreter(self) -> Interpreter method to InterpreterConfig for direct interpreter building; modified add_native_module signature to accept fn(&VirtualMachine) -> PyRef<PyModule> function pointer instead of closure, with internal boxing applied.
Stdlib Initialization Refactoring
src/interpreter.rs
Introduced helper functions setup_frozen_stdlib(vm), setup_dynamic_stdlib(vm), and collect_stdlib_paths() to replace inline initialization logic; init_stdlib() now delegates to appropriate helpers based on feature flags.
Documentation & Examples
src/interpreter.rs
Updated documentation and examples to reflect new add_native_module usage patterns and correct pymodule integration with #[pymodule] attribute.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes


🐰 A config now builds interpreters whole,
Function pointers replace the old closure call,
Stdlib paths dance in helper functions free,
Cleaner init flows, as organized can be!

✨ Finishing touches
  • 📝 Generate docstrings

📜 Recent review details

Configuration used: Path: .coderabbit.yml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between a8cfa36 and 0c93ee2.

📒 Files selected for processing (1)
  • src/interpreter.rs

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@youknowone youknowone marked this pull request as ready for review December 31, 2025 13:14
@youknowone youknowone merged commit 1e706d9 into RustPython:main Dec 31, 2025
12 of 13 checks passed
@youknowone youknowone deleted the interpreter branch December 31, 2025 13:14
@coderabbitai coderabbitai bot mentioned this pull request Jan 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants