Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
    Noa
    @coolreader18
    cargo build --release?
    or cargo run --release
    Zomatree
    @Zomatree
    cargo build
    Noa
    @coolreader18
    Yeah, make sure to build it optimized, non-release mode is definitely a lot slower
    Zomatree
    @Zomatree
    but an hour
    Noa
    @coolreader18
    Try release mode
    Zomatree
    @Zomatree
    im in release mode
    Noa
    @coolreader18
    ah
    what module are you importing?
    Zomatree
    @Zomatree
    aiohttp, attr, async_timeout, chardect, multidit, inda and yarl
    Zomatree
    @Zomatree
      PID USER      PRI  NI  VIRT   RES   SHR S CPU%β–½MEM%   TIME+  Command
    30922 zomatree   20   0 11.5G 11.3G 12340 R 98.4 44.5  1h10:27 ./rustpython test.py
    does rustpython cache imports after they are imported once?
    Noa
    @coolreader18
    Yes, both as pyc in the filesystem and in sys.modules
    I don't think it should be taking that long
    How did you build ./rustpython?
    cargo build builds in debug mode
    you have to do cargo build --release to build optimized
    Zomatree
    @Zomatree
    https://mystb.in/AgentsFavorEncouraging i did build it in release mode
    Noa
    @coolreader18
    huh
    that is really strange
    I can't even import aiohttp, it errors after less than a second on a thing related to the typingmodule
    Zomatree
    @Zomatree
    i am using your branch with the metaclass patches
    Noa
    @coolreader18
    what does test.py look like? just import aiohttp?
    Zomatree
    @Zomatree
    yeah
    Noa
    @coolreader18
    I mean this fails after only a couple seconds
    ❯ target/release/rustpython
    Welcome to the magnificent Rust Python 0.1.2 interpreter 😱 πŸ––
    >>>>> import sys; sys.path.insert(0, '/home/coolreader18/rspy-tests/asynchttp')
    >>>>> import aiohttp
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
      File "/home/coolreader18/rspy-tests/asynchttp/aiohttp/__init__.py", line 6, in <module>
        from .client import (
      File "/home/coolreader18/rspy-tests/asynchttp/aiohttp/client.py", line 35, in <module>
        from . import hdrs, http, payload
      File "/home/coolreader18/rspy-tests/asynchttp/aiohttp/http.py", line 7, in <module>
        from .http_parser import (
      File "/home/coolreader18/rspy-tests/asynchttp/aiohttp/http_parser.py", line 15, in <module>
        from .helpers import NO_EXTENSIONS, BaseTimerContext
      File "/home/coolreader18/rspy-tests/asynchttp/aiohttp/helpers.py", line 48, in <module>
        from typing_extensions import Protocol
      File "/home/coolreader18/rspy-tests/asynchttp/typing_extensions.py", line 364, in <module>
        class _FinalForm(typing._SpecialForm, _root=True):
    AttributeError: module 'typing' has no attribute '_SpecialForm'
    Noa
    @coolreader18
    Yeah, I tweaked a few things and I'm able to import it fine
    ❯ rustpython                                     
    Welcome to the magnificent Rust Python 0.1.2 interpreter 😱 πŸ––
    >>>>> import idna_ssl; import sys; sys.version_info = (3, 6, 0)
    >>>>> import aiohttp
    >>>>> aiohttp
    <module 'aiohttp' from '/home/coolreader18/rspy-tests/asynchttp/aiohttp/__init__.py'>
    Venu Vemula
    @venugopv_twitter
    Hi, I am newbie to RustPython. Spent some time in docs/examples/code.. but am not able to find a way to target python code to WASM. I am working on generic WASM Executor using which I can run WASM modules (i.e code complied to wasm from different languages like C, C++, Rust ). It would be great, if RustPython provides a way to target python for compiling to WASM.
    pca006132
    @pca006132
    I don't think RustPython is a compiler?
    Noa
    @coolreader18
    Yeah, you compile RustPython to wasm and then run the code using the interpreter
    pca006132
    @pca006132
    hi, is there documentation about how vm/src/slots.rs works? I'm a bit confused with the code, and not sure how to add more functions to it, like __add__ etc.
    Zomatree
    @Zomatree

    so going on with my importing issue from yesterday, it seems to be an issue with one of my other modules, it seems that rustpython is just hanging on some of my relative imports (from .a import B), none of the file that im trying to import gets executed.

    ive tried making a minimal but cant get any repro so im uploading the entire setup, https://github.com/Zomatree/discord.py/tree/rustpython-test and run rustpython -m discord it should print a bunch of stuff then hang at 16 that is trying to import discord/http.py from discord/client.py#61, does this hang for anyone else?

    Noa
    @coolreader18
    yeah it hangs for me after 16
    I was looking into trying to fix from . import x stuff, but it's so weird I don't know how it works in cpython
    Zomatree
    @Zomatree
    yeah like its working 99% of the time but just here its not
    Zomatree
    @Zomatree
    would be nice if rustpython errors or something instead of hanging and memory leaking
    this seems to be the cause of it eating 15GB+ of mem
    Noa
    @coolreader18
    oh i see. we implemented Instruction::ImportFrom wrong, lol. it should fallback to checking sys.modules if the attribute isn't there
    Noa
    @coolreader18
    I had been staring at importlib/_bootstrap.py for like an hour and it wasn't even an issue there
    Noa
    @coolreader18
    @Zomatree I pushed a branch misc-aiohttp for fixing some of the issues
    Noa
    @coolreader18
    Yeah, now rustpython -m discord exits without doing anything, which is the same thing I'm getting with the aiohttp hello world
    Zomatree
    @Zomatree
    does it not run the __main__.py file?
    Noa
    @coolreader18
    it does, it just doesn't start up the main loop or something like that
    like with this:
    import idna_ssl; import sys; sys.version_info = (3, 6, 0)
    import aiohttp
    import asyncio
    
    async def main():
        async with aiohttp.ClientSession() as session:
            print(session)
            async with session.get('http://python.org') as response:
                print(response)
                try:
                    print(await response.text())
                except:
                    import traceback;
                    traceback.print_exc()
    
    asyncio.run(main())
    it prints the session, but not the response, and not any error
    Zomatree
    @Zomatree
    ill have a dig around
    Noa
    @coolreader18
    oh also @Zomatree I have a bunch of fixes for coroutines in coolreader18/fix-vm-exc-stack, so you might want to get a second branch and merge both those in
    git checkout master && git checkout -b aiohttp-merge && git merge misc-aiohttp coolreader18/fix-vm-exc-stack
    Zomatree
    @Zomatree
    seems like the signal lib is missing a bunch of attrs
    Zomatree
    @Zomatree
    are you not publically showing NSIG inside the signal lib, you use inside the source code