Replace deprecated chrono with jiff - #8436
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yml Review profile: CHILL Plan: Pro Plus Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (6)
🚧 Files skipped from review as they are similar to previous changes (6)
📝 WalkthroughWalkthroughThe PR replaces ChangesJiff time migration
Estimated code review effort: 3 (Moderate) | ~20 minutes Suggested labels: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
9e4ff33 to
55e14ab
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 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.
Inline comments:
In `@crates/vm/src/stdlib/time.rs`:
- Around line 429-432: Complete the Jiff migration in
OptionalArg::naive_or_local and the related non-Unix/non-Windows time
constructors: return Zoned instead of NaiveDateTime, pass tm.datetime() to
StructTimeData::new_inner, and update new_local to use the assigned tm value
rather than the undefined tz reference.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yml
Review profile: CHILL
Plan: Pro Plus
Run ID: 4709810b-04e7-4b17-a427-d7509f6b2732
⛔ Files ignored due to path filters (1)
Cargo.lockis excluded by!**/*.lock
📒 Files selected for processing (6)
Cargo.tomlcrates/stdlib/Cargo.tomlcrates/stdlib/src/ssl/cert.rscrates/vm/Cargo.tomlcrates/vm/build.rscrates/vm/src/stdlib/time.rs
| fn naive_or_local(self, vm: &VirtualMachine) -> PyResult<NaiveDateTime> { | ||
| Ok(match self { | ||
| Self::Present(t) => t.to_date_time(vm)?, | ||
| Self::Missing => chrono::offset::Local::now().naive_local(), | ||
| Self::Missing => Zoned::now().datetime(), |
There was a problem hiding this comment.
🎯 Functional Correctness | 🔴 Critical | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
set -euo pipefail
cargo fmt --check
cargo clippy --workspace --all-targets -- -D warnings
cargo check --manifest-path crates/vm/Cargo.toml --target wasm32-unknown-unknownRepository: RustPython/RustPython
Length of output: 151
🏁 Script executed:
#!/bin/bash
set -euo pipefail
printf 'Files matching time.rs:\n'
fd -a 'time\.rs$' . | sed 's#^\./##'
printf '\nRelevant lines 400-445 and 760-795:\n'
sed -n '400,445p;760,795p' crates/vm/src/stdlib/time.rs | nl -ba -v400
printf '\nImports in time.rs:\n'
sed -n '1,80p' crates/vm/src/stdlib/time.rsRepository: RustPython/RustPython
Length of output: 405
🏁 Script executed:
#!/bin/bash
set -euo pipefail
printf 'Relevant lines 400-445 and 760-795:\n'
sed -n '400,445p;760,795p' crates/vm/src/stdlib/time.rs > /tmp/time_section.txt
line=400
while IFS= read -r text || [ -n "$text" ]; do
printf '%s:%s\n' "$line" "$text"
line=$((line+1))
[ "$line" -eq 446 ] && line=760
done < /tmp/time_section.txt
printf '\nImports in time.rs:\n'
sed -n '1,80p' crates/vm/src/stdlib/time.rs
printf '\nSearch for NaiveDateTime/jiff-related items in target file:\n'
rg 'NaiveDateTime|jiff|DateTime|Zoned|to_zoned|strftime|TimeZone|tz\.' crates/vm/src/stdlib/time.rsRepository: RustPython/RustPython
Length of output: 8239
🏁 Script executed:
#!/bin/bash
set -euo pipefail
printf 'Find chrono/NaiveDateTime definitions/usages in workspace:\n'
rg -n 'chrono|NaiveDateTime|chrono::' Cargo.toml Cargo.lock crates/vm/Cargo.toml crates/vm/src/stdlib/time.rs crates/vm/src/stdlib/ -g '*.rs' || true
printf '\nTarget cfg context around struct constructors:\n'
sed -n '`@680`,720p;740,790p' crates/vm/src/stdlib/time.rs | awk '{printf "%s:%s\n", NR+679, $0}'Repository: RustPython/RustPython
Length of output: 1309
🏁 Script executed:
#!/bin/bash
set -euo pipefail
printf 'Lines 620-680:\n'
sed -n '620,680p' crates/vm/src/stdlib/time.rs | awk '{printf "%s:%s\n", NR+619, $0}'
printf '\nLines 730-790:\n'
sed -n '730,790p' crates/vm/src/stdlib/time.rs | awk '{printf "%s:%s\n", NR+729, $0}'
printf '\nDependency declarations for chrono:\n'
sed -n '1,220p' crates/vm/Cargo.toml
rg -n 'chrono|jiff|dep:jiff|windows-local-time|xwin' Cargo.toml crates/vm/Cargo.toml Cargo.lock || trueRepository: RustPython/RustPython
Length of output: 8771
Complete the Jiff type migration for non-Unix/non-Windows time paths.
NaiveDateTime is no longer available after replacing chrono. Keep the non-Unix/non-Windows OptionalArg::naive_or_local() return type as Zoned, pass tm.datetime() into StructTimeData::new_inner, and fix new_local to use the assigned tm value instead of referencing undefined tz.
🤖 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 `@crates/vm/src/stdlib/time.rs` around lines 429 - 432, Complete the Jiff
migration in OptionalArg::naive_or_local and the related non-Unix/non-Windows
time constructors: return Zoned instead of NaiveDateTime, pass tm.datetime() to
StructTimeData::new_inner, and update new_local to use the assigned tm value
rather than the undefined tz reference.
Source: Coding guidelines
55e14ab to
92a0412
Compare
See: chronotope/chrono#1768
Summary
Summary by CodeRabbit