Skip to content

I hope there could be an official tool used to transfer python code to rust code automatically? #3126

@dbsxdbsx

Description

@dbsxdbsx

(I am not pretty sure if the below suggestion could be treated as a RFC, but I think it is useful for rust development.)

We know Rust aims to be a stable and productive programming language. But at present, its ecosystem lacks a lot of wheels. Meanwhile, Python is on the very opposite position. Therefore, I think it would make Rust more productive if Rust could absorb Python's ecosystem(many mature wheels) as soon as possible.

I know there are many people trying to make wheels to enrich Rust ecosystem, some for python users. But there are still some problems for people to transfer Python code to Rust. Let's take the popular Python module numpy as an example:

  1. indeed, there are some crates try to simulate numpy module. BUT, people would not be confident enough to use them as they are not official supported by numpy team.
  2. The time: it would take quite a long time to make them mature enough as they are in Python, even the corresponding Rust crates are supported officially by original python module team?
  3. No ganrantee on support for teams those built many popular Python modules to make corresponding crates in Rust.

So, I am asking if it is possible to build a tool like Rustfmt OFFICIALLY by Rust team, with witch could be used to automatically tranpile any Python script code(including module used in script) into corresponding Rust code, like pyrs does?

With such a tool:

  1. it is possible to program in Python for checking logic first, then transpile it automatically to Rust to make the whole programming routine efficient enough--- this routine, at least I think is the best way to do programming constructively and productively.
  2. people would be confident enough to use it as it is officialy supported.
  3. This saves people a lot of time, instead of spending time on building crates that will be unstable for quite a long time.

Someone would ask why I stick to only Python?

  1. Python is the most popular used language with the best ecosystem, the ecosystem feature is exactly Rust lacks MOST.
  2. For those compiled languge, like C++, there is always a way to use wheels from their field through FFI, let alone some crates to do it , like cxx. But Python is an interpreted language with an official interpreter contains GIL,even with some crates, like pyo3, it still makes Rust program not efficient enough due to GIL.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions