GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Rename stdlib files to match Python module names by youknowone · Pull Request #7397 · RustPython/RustPython

Conversation

@youknowone

@youknowone youknowone commented Mar 10, 2026 •
edited by coderabbitai Bot
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member

Add _ prefix to source files whose Python module names start with _: ast→_ast, codecs→_codecs, collections→_collections, ctypes→_ctypes, functools→_functools, imp→_imp, io→_io, operator→_operator, signal→_signal, sre→_sre, stat→_stat, string→_string, symtable→_symtable, sysconfig→_sysconfig, sysconfigdata→_sysconfigdata, thread→_thread, typing→_typing, warnings→_warnings, weakref→_weakref.

Update mod.rs and all cross-crate references accordingly.

Summary by CodeRabbit

  • Refactor
    • Internal reorganization of standard library module structure with no user-facing impact on functionality or APIs.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@coderabbitai

coderabbitai Bot commented Mar 10, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yml

Review profile: CHILL

Plan: Pro

Run ID: 5a4dff2d-803e-4fcd-8168-e88ff6a92591

📥 Commits

Reviewing files that changed from the base of the PR and between 0355885 and 50c19ba.

📒 Files selected for processing (72)
  • crates/stdlib/src/array.rs
  • crates/stdlib/src/faulthandler.rs
  • crates/stdlib/src/fcntl.rs
  • crates/stdlib/src/select.rs
  • crates/stdlib/src/ssl.rs
  • crates/vm/src/builtins/complex.rs
  • crates/vm/src/builtins/genericalias.rs
  • crates/vm/src/builtins/tuple.rs
  • crates/vm/src/builtins/union.rs
  • crates/vm/src/frame.rs
  • crates/vm/src/ospath.rs
  • crates/vm/src/protocol/number.rs
  • crates/vm/src/signal.rs
  • crates/vm/src/stdlib/_ast.rs
  • crates/vm/src/stdlib/_ast/argument.rs
  • crates/vm/src/stdlib/_ast/basic.rs
  • crates/vm/src/stdlib/_ast/constant.rs
  • crates/vm/src/stdlib/_ast/elif_else_clause.rs
  • crates/vm/src/stdlib/_ast/exception.rs
  • crates/vm/src/stdlib/_ast/expression.rs
  • crates/vm/src/stdlib/_ast/module.rs
  • crates/vm/src/stdlib/_ast/node.rs
  • crates/vm/src/stdlib/_ast/operator.rs
  • crates/vm/src/stdlib/_ast/other.rs
  • crates/vm/src/stdlib/_ast/parameter.rs
  • crates/vm/src/stdlib/_ast/pattern.rs
  • crates/vm/src/stdlib/_ast/pyast.rs
  • crates/vm/src/stdlib/_ast/python.rs
  • crates/vm/src/stdlib/_ast/repr.rs
  • crates/vm/src/stdlib/_ast/statement.rs
  • crates/vm/src/stdlib/_ast/string.rs
  • crates/vm/src/stdlib/_ast/type_ignore.rs
  • crates/vm/src/stdlib/_ast/type_parameters.rs
  • crates/vm/src/stdlib/_ast/validate.rs
  • crates/vm/src/stdlib/_codecs.rs
  • crates/vm/src/stdlib/_collections.rs
  • crates/vm/src/stdlib/_ctypes.rs
  • crates/vm/src/stdlib/_ctypes/array.rs
  • crates/vm/src/stdlib/_ctypes/base.rs
  • crates/vm/src/stdlib/_ctypes/function.rs
  • crates/vm/src/stdlib/_ctypes/library.rs
  • crates/vm/src/stdlib/_ctypes/pointer.rs
  • crates/vm/src/stdlib/_ctypes/simple.rs
  • crates/vm/src/stdlib/_ctypes/structure.rs
  • crates/vm/src/stdlib/_ctypes/union.rs
  • crates/vm/src/stdlib/_functools.rs
  • crates/vm/src/stdlib/_imp.rs
  • crates/vm/src/stdlib/_io.rs
  • crates/vm/src/stdlib/_operator.rs
  • crates/vm/src/stdlib/_signal.rs
  • crates/vm/src/stdlib/_sre.rs
  • crates/vm/src/stdlib/_stat.rs
  • crates/vm/src/stdlib/_string.rs
  • crates/vm/src/stdlib/_symtable.rs
  • crates/vm/src/stdlib/_sysconfig.rs
  • crates/vm/src/stdlib/_sysconfigdata.rs
  • crates/vm/src/stdlib/_thread.rs
  • crates/vm/src/stdlib/_typing.rs
  • crates/vm/src/stdlib/_warnings.rs
  • crates/vm/src/stdlib/_weakref.rs
  • crates/vm/src/stdlib/_winapi.rs
  • crates/vm/src/stdlib/builtins.rs
  • crates/vm/src/stdlib/mod.rs
  • crates/vm/src/stdlib/os.rs
  • crates/vm/src/stdlib/posix.rs
  • crates/vm/src/stdlib/sys.rs
  • crates/vm/src/stdlib/typevar.rs
  • crates/vm/src/types/zoo.rs
  • crates/vm/src/vm/context.rs
  • crates/vm/src/vm/mod.rs
  • crates/vm/src/vm/thread.rs
  • crates/vm/src/vm/vm_ops.rs

📝 Walkthrough

Walkthrough

This pull request systematically renames internal stdlib modules by adding underscore prefixes (e.g., ast → _ast, typing → _typing, warnings → _warnings). All corresponding import paths and call sites throughout the codebase are updated consistently to reference the new underscore-prefixed module paths.

Changes

Cohort / File(s) Summary
Module Declaration Reorganization
crates/vm/src/stdlib/mod.rs
Renamed and re-exported stdlib modules with underscore prefixes (ast→_ast, io→_io, typing→_typing, warnings→_warnings, thread→_thread, signal→_signal, ctypes→_ctypes, and 10+ others). Updated builtin_module_defs registrations to reference underscore-prefixed module definitions.
Warnings Module Refactoring
crates/stdlib/src/array.rs, crates/stdlib/src/ssl.rs, crates/vm/src/builtins/complex.rs, crates/vm/src/stdlib/_ctypes/structure.rs, crates/vm/src/stdlib/_ctypes/union.rs, crates/vm/src/stdlib/_io.rs, crates/vm/src/stdlib/os.rs, crates/vm/src/stdlib/posix.rs, crates/vm/src/stdlib/sys.rs, crates/vm/src/vm/vm_ops.rs
Replaced stdlib::warnings with stdlib::_warnings in import paths and updated warn() call sites to use the new internal warnings path.
Thread Module Migration
crates/stdlib/src/faulthandler.rs, crates/vm/src/_imp.rs, crates/vm/src/_winapi.rs, crates/vm/src/stdlib/mod.rs, crates/vm/src/stdlib/posix.rs, crates/vm/src/stdlib/sys.rs, crates/vm/src/vm/mod.rs, crates/vm/src/vm/thread.rs
Updated all thread-related imports and function calls from stdlib::thread to stdlib::_thread (e.g., get_ident(), get_all_current_frames(), CurrentFrameSlot, HandleEntry).
IO Module Path Updates
crates/stdlib/src/fcntl.rs, crates/stdlib/src/select.rs, crates/vm/src/stdlib/mod.rs, crates/vm/src/stdlib/posix.rs, crates/vm/src/vm/mod.rs
Replaced references to stdlib::io with stdlib::_io including type usages (Fildes, OpenArgs) and function calls (open()).
Typing Module Migration
crates/vm/src/builtins/genericalias.rs, crates/vm/src/builtins/union.rs, crates/vm/src/frame.rs, crates/vm/src/stdlib/typevar.rs, crates/vm/src/types/zoo.rs, crates/vm/src/vm/context.rs
Updated all typing-related imports and constructors from stdlib::typing to stdlib::_typing, including TypeVar, ParamSpec, TypeVarTuple, TypeAliasType, and NoDefault references.
AST Module Relocation
crates/vm/src/builtins/genericalias.rs, crates/vm/src/stdlib/_ast.rs, crates/vm/src/stdlib/_ast/expression.rs, crates/vm/src/stdlib/_ast/module.rs, crates/vm/src/stdlib/_ast/python.rs, crates/vm/src/stdlib/_ast/repr.rs, crates/vm/src/stdlib/_ast/statement.rs, crates/vm/src/stdlib/builtins.rs
Systematically updated AST module imports from stdlib::ast to stdlib::_ast across all AST-related code, including NodeAst, mode types, and validation functions.
Signal Module Path Update
crates/vm/src/signal.rs, crates/vm/src/stdlib/posix.rs
Updated internal signal module path from stdlib::signal::_signal to stdlib::_signal::_signal and related references.
Minor Formatting
crates/vm/src/builtins/tuple.rs
Reflowed multi-line field access in freelist_len calculation without behavioral changes.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

  • Refactor warn.rs and _warnings module #7023: Refactors the warnings API with updated signature that returns PyResult and accepts vm parameter, which this PR adapts to throughout the codebase.
  • initial sandbox  #7035: Modifies stdlib module declarations and module_def wiring, intersecting with the module reorganization and feature-gating changes in mod.rs.
  • Refactor _ast module for clarity #7031: Refactors AST module internals and APIs, directly related to the systematic ast → _ast migration across the codebase.

Suggested reviewers

  • ShaharNaveh
  • fanninpm
  • coolreader18

Poem

🐰 A rabbit's ode to module names

With underscores bold, the modules now hide,
From public sight, yet steady provide,
Internal pathways, cleaner and clean,
The finest refactor this rabbit has seen! ✨

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'Rename stdlib files to match Python module names' clearly and accurately describes the main change: renaming Rust stdlib source files with leading underscores to correspond to their Python module names.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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
  • X
  • Mastodon
  • Reddit
  • LinkedIn

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

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

moreal
moreal approved these changes Mar 10, 2026
View reviewed changes
@youknowone
Rename stdlib files to match Python module names
50c19ba
Add _ prefix to source files whose Python module names
start with _: ast→_ast, codecs→_codecs, collections→_collections,
ctypes→_ctypes, functools→_functools, imp→_imp, io→_io,
operator→_operator, signal→_signal, sre→_sre, stat→_stat,
string→_string, symtable→_symtable, sysconfig→_sysconfig,
sysconfigdata→_sysconfigdata, thread→_thread, typing→_typing,
warnings→_warnings, weakref→_weakref.

Update mod.rs and all cross-crate references accordingly.
@youknowone
youknowone force-pushed the rename-stdlib branch from ee6116b to 50c19ba Compare March 10, 2026 03:59
@youknowone
youknowone marked this pull request as ready for review March 10, 2026 03:59
@youknowone
youknowone merged commit a854ef2 into RustPython:main Mar 10, 2026
13 checks passed

Uh oh!

There was an error while loading. Please reload this page.

@youknowone
youknowone deleted the rename-stdlib branch March 10, 2026 06:29
youknowone added a commit to youknowone/RustPython that referenced this pull request Mar 19, 2026
@youknowone
Rename stdlib files to match Python module names (RustPython#7397)
dcccbaa
youknowone added a commit to youknowone/RustPython that referenced this pull request Mar 22, 2026
@youknowone
Rename stdlib files to match Python module names (RustPython#7397)
9ad9264
youknowone added a commit that referenced this pull request Sep 16, 2026
@youknowone
Rename stdlib files to match Python module names (#7397)
630cd8d
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@moreal moreal moreal approved these changes

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

2 participants

@youknowone @moreal
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.