Skip to content

Use rustix for uname; drop uname crate#7799

Merged
youknowone merged 1 commit into
RustPython:mainfrom
joshuamegnauth54:use-rustix-for-uname
May 9, 2026
Merged

Use rustix for uname; drop uname crate#7799
youknowone merged 1 commit into
RustPython:mainfrom
joshuamegnauth54:use-rustix-for-uname

Conversation

@joshuamegnauth54
Copy link
Copy Markdown
Contributor

@joshuamegnauth54 joshuamegnauth54 commented May 7, 2026


Nothing fancy here. uname is a small crate that hasn't been touched in ten years. It doesn't do anything spectacular. Here is its source. rustix, which is already being used by RustPython, provides a uname() wrapper that we can use instead.

I also dropped the oldtime feature from chrono. According to the chrono docs, that feature doesn't do anything anymore.

Summary by CodeRabbit

  • Chores
    • Updated time library configuration for improved compatibility
    • Refactored system information retrieval with streamlined dependency management
    • Internal code organization improvements with no functional changes to user-facing features

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 7, 2026

Review Change Stack

📝 Walkthrough

Walkthrough

Workspace dependency features for chrono and rustix are adjusted and the uname workspace dependency is removed from the vm crate; posix.rs's uname is rewritten to call rustix::system::uname() and return _os::UnameResultData directly (no VM parameter or PyResult).

Changes

uname implementation migration from uname crate to rustix

Layer / File(s) Summary
Dependency changes
Cargo.toml, crates/vm/Cargo.toml
chrono workspace features: removed oldtime (now ["clock","std"]); rustix workspace features: added "system" (now ["event","system"]); removed uname = { workspace = true } from crates/vm Unix target dependencies.
POSIX uname function rewrite
crates/vm/src/stdlib/posix.rs
fn uname(vm: &VirtualMachine) -> PyResult<_os::UnameResultData>fn uname() -> _os::UnameResultData; implementation now calls rustix::system::uname() and converts fields with to_string_lossy().into() (no PyResult error wrapping).

Sequence Diagram(s)

sequenceDiagram
  participant Client as POSIX module
  participant Old as uname crate
  participant New as rustix::system
  participant Data as _os::UnameResultData

  Client->>Old: uname(vm) via uname::uname()
  Old-->>Client: PyResult<Uname>
  Client->>New: uname() via rustix::system::uname()
  New-->>Client: Uname (OsString fields)
  Client->>Data: to_string_lossy() -> _os::UnameResultData
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

  • RustPython/RustPython#7789: Modifies how the uname dependency is declared and used in the vm crate; directly related to the removal/migration of the uname crate.

Suggested reviewers

  • ShaharNaveh
  • youknowone

Poem

🐰 A rabbit nudged the manifest light,
She swapped the crate for rustix's might.
Fields whisper lossily, then sing,
No PyResult — simple spring.
Hops of code, tidy and bright. 🥕

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely summarizes the main change: replacing the uname crate with rustix for the uname functionality.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Tip

💬 Introducing Slack Agent: The best way for teams to turn conversations into code.

Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.

  • Generate code and open pull requests
  • Plan features and break down work
  • Investigate incidents and troubleshoot customer tickets together
  • Automate recurring tasks and respond to alerts with triggers
  • Summarize progress and report instantly

Built for teams:

  • Shared memory across your entire org—no repeating context
  • Per-thread sandboxes to safely plan and execute work
  • Governance built-in—scoped access, auditability, and budget controls

One agent for your entire SDLC. Right inside Slack.

👉 Get started


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.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
Cargo.toml (1)

264-264: ⚠️ Potential issue | 🔴 Critical | ⚡ Quick win

Enable the "system" feature for rustix in crates/vm/Cargo.toml.

The code at crates/vm/src/stdlib/posix.rs calls rustix::system::uname(), which requires the "system" feature to be enabled. The rustix crate documents that rustix::system is "Available on crate feature system only."

Currently, crates/vm/Cargo.toml declares rustix = { workspace = true }, which inherits the workspace-level config that only includes features = ["event"]. Add the "system" feature to the workspace rustix declaration or override it in crates/vm/Cargo.toml to unblock compilation.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@Cargo.toml` at line 264, The workspace-level rustix dependency only enables
the "event" feature, but crates/vm/src/stdlib/posix.rs calls
rustix::system::uname() which requires the "system" feature; update the rustix
dependency so the "system" feature is enabled for the VM crate by either adding
"system" to the workspace rustix features or overriding in crates/vm/Cargo.toml
(replace or extend rustix = { workspace = true } with a declaration that
includes features = ["event", "system"] or rustix = { version = "...", features
= ["event","system"] } so rustix::system::uname() builds).
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Outside diff comments:
In `@Cargo.toml`:
- Line 264: The workspace-level rustix dependency only enables the "event"
feature, but crates/vm/src/stdlib/posix.rs calls rustix::system::uname() which
requires the "system" feature; update the rustix dependency so the "system"
feature is enabled for the VM crate by either adding "system" to the workspace
rustix features or overriding in crates/vm/Cargo.toml (replace or extend rustix
= { workspace = true } with a declaration that includes features = ["event",
"system"] or rustix = { version = "...", features = ["event","system"] } so
rustix::system::uname() builds).

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yml

Review profile: CHILL

Plan: Pro

Run ID: 6fbb84b5-0173-4157-8261-026ea0711671

📥 Commits

Reviewing files that changed from the base of the PR and between e10a27b and 47f2f90.

⛔ Files ignored due to path filters (1)
  • Cargo.lock is excluded by !**/*.lock
📒 Files selected for processing (3)
  • Cargo.toml
  • crates/vm/Cargo.toml
  • crates/vm/src/stdlib/posix.rs
💤 Files with no reviewable changes (1)
  • crates/vm/Cargo.toml

Copy link
Copy Markdown
Contributor

@ShaharNaveh ShaharNaveh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ty:)

@youknowone youknowone merged commit 4aa73dd into RustPython:main May 9, 2026
25 checks passed
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.

3 participants