RustPython / RustPython/RustPython

Allow time implementation for wasm32-unknown-unknown

Open
#4,302 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

O-wasm
Dominant language
Rust
Stars
22.4k
Forks
1.5k
Avg merge
16h 33m
Merged PRs (30d)
165

Description

We are operating in a strict wasm32-unknown-unknown environment, but we do have a system API that provides the current nanoseconds. We would like to somehow hook up our time API into RustPython so that modules like time and datetime work properly.

In our own fork of RustPython, I've modified https://github.com/RustPython/RustPython/blob/main/vm/src/stdlib/time.rs in various places to remove any dependence on system time as an attempt to provide a blanket source of time for all time functionality.

You can see some of our changes here: https://github.com/demergent-labs/RustPython/commit/7439d7bc8de3f755c6f0629543a08322185d4c6f and here: https://github.com/demergent-labs/RustPython/commit/eea609fa590c8ccaade72d8948be0aabba858af8

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with vm/src/stdlib/time.rs and compare the two referenced commits in the dem urgent-labs fork to understand the existing wasm32-unknown-unknown changes. Determine how the system nanoseconds API should be supplied to RustPython and shared by the time and datetime modules. Done means those modules provide working time functionality in the strict wasm environment without relying on unavailable system time.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust, wasm
Domain
operating-systems
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.