Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
    Windel Bouwman
    @windelbouwman_twitter
    Everyone already played around with this stuff: https://webassembly.sh/?run-command=wapm%20install%20rustpython
    ?
    It's real fun :D
    Mathieu Dupuy
    @deronnax

    hello. I just discovered rustpython and it looks awesome. There is something in the readme I do not understand :

    As of now the standard library is under construction.

    Why don't you just copy the standard lib of cpython, which is made mostly in python, and just reimplement the bit done in C ?

    Noah
    @coolreader18
    That line is a bit out of date, but also not all of the standard library Python modules work yet, and the built-in C modules that we need to reimplement in Rust (e.g. _select, winapi, _asyncio, etc.) take a fair amount of effort to do and do correctly. We do have a lot of the stdlib copied over, though.
    Mathieu Dupuy
    @deronnax
    OK thanks
    Yiqun Ling
    @Lynskylate

    @windelbouwman_twitter In RustPython/RustPython#1454, I found RustPython load local variable from free scope.

    match symbol.scope {
                SymbolScope::Global => bytecode::NameScope::Global,
                SymbolScope::Nonlocal => bytecode::NameScope::NonLocal,
                SymbolScope::Unknown => bytecode::NameScope::Free,
                SymbolScope::Local => bytecode::NameScope::Free,
            }

    What is the reason for using this?

    Windel Bouwman
    @windelbouwman_twitter
    Not sure, it might be a glitch
    What would you expect?
    The Local symbol scope might need to be mapped to local namescope in opcode as well
    The point is, that the Free scope in the bytecode works most of the time.
    I'm not sure if we already support locals in a local list per function.
    Yiqun Ling
    @Lynskylate

    @windelbouwman_twitter
    If we all use the free scope, we will not throw an exception when modifying the global variable.
    e.g:

    x = 10
    def foo():
        x += 1 # should throw unbound exception
        print(x) # 11
    foo()
    print(x) # 10

    Although it does not actually modify the global variable.
    Just at this point there will be some incompatibility with CPython

    Windel Bouwman
    @windelbouwman_twitter
    This probably is a bug in the symboltable builder code I guess
    Adolfo Gonzalez III
    @adolfogonzalez3
    Is input() supported yet?
    Noah
    @coolreader18
    I guess not, feel free to work on it if you're looking to contribute.
    It seems simple, but in CPython it uses readline along with all of its keybindings and stuff, so you'd probably have to move the shell stuff into the VM crate
    Bart Lanen
    @Blanen

    Hey, I'm mostly a Python programmer (well, also C#/JS) but want to learn more about how python works and such and Rust so I thought that maybe this was a relevant project to learn both.

    Would there be something relatively simple I could work on?

    Aviv Palivoda
    @palaviv
    Hi @Blanen, Welcome to RustPython. I think a great way to start would be to run the "whats_left.sh" script and pick something from there.
    Bart Lanen
    @Blanen
    Ah, sure thanks
    mmh
    @myrfy001
    Hi, everyone. I'm very excited to find this project. Since there is a example that compile RP into wasm, I want to know that is it possible to use RP as a library and embed it into other Applications? Because CPython has a lot of global variables and when embed CPython with other applications written in C, the Python interpreter must be the owner of that process. I hope that RP can be used as a shared library, and I can create and embed multi interpreter instance in a C application.
    Noah
    @coolreader18
    Yes, it definitely can be, and there are already a few projects where RustPython has been embedded (https://github.com/pickitup247/pyckitup). I believe we chose went with a VirtualMachine type passed around instead of CPython's model because Rust doesn't play as nicely with global variables as C does, but it comes with the added benefit of easier embedding!
    Dan Fritchman
    @dan-fritchman
    Hi everyone - what’s the recommended method for converting a Rust String (or string-slice) into a PyStringRef?
    Jeong YunWon
    @youknowone
    vm.new_str?
    mmh
    @myrfy001
    hi, the Readme file says that 'Our current build supports only a subset of Python syntax', is there a list that shows which syntax are (not) supported?
    Noah
    @coolreader18
    Right now the main thing I can think of is nonlocal declarations; we're not really matching CPython yet on how cell vars and closures work, so weird nonlocal declarations will fail to parse/compile at this point.
    @dan-fritchman I'd go with PyString::from(s).into_ref(vm)
    Dan Fritchman
    @dan-fritchman

    Thanks for your help - although it looks like I asked the wrong question.

    Looks like most std-lib functions that return Python str types have PyResult<String> return-types, not PyStringRef.
    For example:
    pub fn json_dumps(obj: PyObjectRef, vm: &VirtualMachine) -> PyResult<String> {
    fn os_getcwd(vm: &VirtualMachine) -> PyResult<String> {

    My mistake!

    Jeong YunWon
    @youknowone
    if CI doesn't break, i think we just can move the target to 3.8?
    i don't know how it is decided but targetting 3.6 maybe was a simple decision just because it was the latest version at that time
    i think targetting 3.6 or 3.8 doesn't affect developing cost of rustpython (unless it is undecided) at this stage so not bad either way
    Denis
    @redradist
    Hi guys, us there someone from Core team ? I would like to contribute to this project but before it I am curious if rustpython would be GIL free ... ?
    Noah
    @coolreader18
    We currently do not have a GIL, but that's moreso a side effect of not having any sort of concurrency yet than it is a design decision. There's an issue in the repository discussing this: RustPython/RustPython#362
    Denis
    @redradist
    @coolreader18 Thanks for answer !! I've previously read this topic, but I did not get if the core team decided to make rustpython thread safe or not ... Why I am asking ?! Because I love Python and if you decided to make if GIL free I will help in implementation of rustpython (not only GIL free Python, but also will help with core library), but if you decided to make it dependent on GIL ... :(((
    Alan Justino da Silva
    @alanjds
    Well, I think we all want a GIL-less python. However I would expect a 1st implementation to be very unpleasant in this aspect. Some weeks ago I implemented Threading as DummyThreading (sequential). Do I want full thread? Sure. Have the time to do it? Nope.
    What I am saying is: thanks for the help, is very welcome. Just not expect the 1st version of anything to be state of art. Maybe somebody decides to have a GIL someday until a contribution removing it cames out. And this would be Okay :)
    (in my opinion)
    Denis
    @redradist
    Okay, another question, do you have some kind of board to decide what task to take ? Also I could take some task that I like, but I could clash with somebody )), How you handle such cases ?
    @alanjds If you have some branch with initial threading implementation I will love to take a look ;)
    Noah
    @coolreader18
    There aren't too many people working on features at the same time; there are people working on little things from itertools and the output of whats_left.sh and otherwise I think there are people working on pickling, http, and wasm js interop.
    Was there anything specific that you were thinking of working on? I know that nobody's really looking into threading stuff yet, as that will likely require a big refactor of the majority of the codebase.
    Denis
    @redradist
    @coolreader18 I would like to work on threading gil-less, implementing python libraries, embedding rustpython in bare-metal platform, with very less memory footprint ... and so on
    Right now I will focus on investigating architecture of RustPython ...
    Windel Bouwman
    @windelbouwman_twitter
    Hi Denis! The idea of running rustpython is very cool! I had this idea as well, and tried it some time ago, but did not push true. It should be possible by disabling a lot of features, such as the python compiler and parser.
    Targetting a bare metal raspberry pi would be a sweet demo, where you only have a rPi and a rustpython console via serial port
    rustpython is featured here, via wasmer
    Alan Justino da Silva
    @alanjds

    @alanjds If you have some branch with initial threading implementation I will love to take a look ;)

    Hi. Sorry for the delay here. I just imported the dummy_threading implementation from CPython and filled some holes, so threading is importable and have minimal compatible behavior. But the implementation is fully sequential IIUC.

    Jeong YunWon
    @youknowone
    these days, i am failing to run unittest again