Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
    hohh
    @hohh:matrix.org
    [m]
    use rustpython_vm::compile::Mode;
    use rustpython_vm::Interpreter;
    use rustpython_vm::import::import_file;
    use rustpython_vm::compile;
    
    fn main() {
        Interpreter::default().enter(|vm| {
            let imp = import_file(vm, "mylib", "mylib".to_owned(), MAIN.to_owned()).unwrap();
            //let import = vm.compile(MAIN, compile::Mode::Exec, "<main>".to_owned())
            //    .map_err(|err| vm.new_syntax_error(&err)).unwrap();
    
            let scope = vm.new_scope_with_builtins();
            let code_obj = vm
                .compile(
                    r#"import * from mylib
    def initt():
        print("fef")
    init()"#,
                    Mode::Exec,
                    "<embedded>".to_owned(),
                )
                .map_err(|err| vm.new_syntax_error(&err))
                .unwrap();
            //vm.run_code_obj(import, scope).unwrap();
            vm.run_code_obj(code_obj, scope).unwrap();
        });
        println!("Hello, rust!");
    }
    
    const MAIN: &str = r#"print("PYTHON MODULE INIT")
    def init():
        print("Python says init")
    
    def run(command, ext_state, state):
        print("Python says run")
    "#;
    This is a small reproduction of what I'm trying to do, notice how I don't know how to make the code_obj run in a scope that includes imp
    nadavkluger
    @nadavkluger
    image.png
    Can someone help me? Just cloned the repo and tried to run it on windows, I did set with git bash RUST_BACKTRACE=1 and the result was the same
    Noa
    @coolreader18
    Could you post the output with RUST_BACKTRACE=1 ?
    nadavkluger
    @nadavkluger
    image.png
    Noa
    @coolreader18
    Hm, that's not actually setting the environment variable, it should give a different output
    That's msys? You can replace set with export or just do RUST_BACKTRACE=1 cargo [..]
    nadavkluger
    @nadavkluger
    Thanks!
    Jeong YunWon
    @youknowone
    what’s happened to CI?
    match_class tests looks just ok but failing in CI
    fanninpm
    @fanninpm
    An LTO bug happened to CI.
    tyoc213 (David L)
    @tyoc213
    how to generate not_impl.py as on a fresh clone running whats_left.sh throws Failed reading file 'extra_tests/not_impl.py'
    Jeong YunWon
    @youknowone
    it must be generated by the script. which directory did you run the script? the script might be (wrongly) depending on path
    4 replies
    Bubblie01
    @Bubblie01
    Do any of you know how much RustPython is in size?
    1 reply
    Noa
    @coolreader18
    @Bubblie01 binary's about 20MB iirc
    Dominic Elm
    @d3lm
    Hey ya all!
    Quick question, how would I go about implementing missing modules such as os when RustPython is compiled to WASM? @coolreader18
    Noa
    @coolreader18
    There are a couple different options - one would be to implement a custom posix/nt module in Rust, which would be a bit of effort given the large API surface area
    Another option is implement a custom os.py
    Oh, but if you're asking about contributing those modules - that's not really in scope of RustPython I don't think. There's a lot of different ways to go about polyfilling os apis, and I think it's more productive to focus on one standardized API like wasi (which we do support)
    Dominic Elm
    @d3lm
    Oh I see
    And where would I locate those? Can you give a super minimal example?
    I mean so you can just say import os
    Can I also provide this via Rust? Cause I have already existing JS functions for some of the OS stuff
    BTW, really great work on all of this! This stuff is so freakin exciting
    I am a huge fan of WASM and work with it on a daily basis / production apps and I love seeing more people adopting it
    Being able to run other languages such as Python via WASM is a huge deal
    Yep, I totally get that, that those modules are out of scope
    Hm yes, but I think using wasm-bindgen it still doesn't support WASI AFAIK
    Dominic Elm
    @d3lm
    @coolreader18 Any thoughts on the above?
    random-access-exomemory
    @random-access-exomemory:matrix.org
    [m]
    Anyone know of any precompiled binaries for arm64? (For RustPython)
    2 replies
    random-access-exomemory
    @random-access-exomemory:matrix.org
    [m]
    Rip fair
    Michael Verhulst
    @verhulstm
    hello
    i made an issue if that is ok
    i am seeing some issue on ubuntu 20.04
    Michael Verhulst
    @verhulstm
    rustpython --install-pip
    is giving me this
    ModuleNotFoundError: No module named 'mmap'
    sonicrules1234
    @sonicrules1234:sonicrules.fun
    [m]
    I'm pretty sure there was already an issue for that
    Jeong YunWon
    @youknowone
    This maybe one of the future we want to have https://twitter.com/mariatta/status/1520432987359399936
    1 reply
    Jeong YunWon
    @youknowone
    Why does your message look like ghost. Without user marker and name
    Jason Qin
    @hyperswine
    EOI is basically eof right?
    Supreet
    @supreetsingh10
    Hello everyone, do you guys use rust-gdb to debug code for this project. I have cloned the project and I have gone through the development guide and the Readme. I would like to see the flow of the code function wise, are you guys using RUST-GDB for that?
    Jeong YunWon
    @youknowone
    I use lldb. If you use vscode, the repository is including debugger setup for vscode
    Supreet
    @supreetsingh10
    Thank you, I use Vim
    Zero Cool
    @ZeroCoolHacker
    Hello, I am a python developer and trying to learn rust. Love this project <3
    Steve Shi
    @qingshi163
    There is nothing special for rustpython than other rust project for vim. You can use adapter to use same lldb debugger as vscde.
    Jeong YunWon
    @youknowone
    @ZeroCoolHacker welcome, thats a good motivation to start this project