Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
    davfsa
    @davfsa
    Hey! I was recently looking to speedup a python library that Im maintaining and bumped into mypyc. I immediately tried it out as it looked more promising than alternatives like Cython (we were already using mypy strict, so writing more type files wasnt ideal :) ). I keep hitting roadblocks with both type checking issues (mypyc/mypyc#883) and after a silly fix to the issue I just described, I keep getting AssertionErrors as well as a random KeyError. I have tried my best to look into it, but no luck. Could anybody point me in the right direction to fix the issue mentioned above (and then I will work my way down the rabit hole :P )
    And thanks for building and maintaining this amazing tool, it is something that a lot of python programmers are in need of to get that little extra boost
    davfsa
    @davfsa

    Installing mypyc from the mypy repo seems to actually fix the empty assertion errors, I get tracebacks now!

    This is one of them:

    Traceback (most recent call last):
      File "build/setup.py", line 5, in <module>
        ext_modules=mypycify(['hikari'], opt_level="3"),
      File "/home/davfsa/coding/mypy/mypyc/build.py", line 485, in mypycify
        groups, group_cfilenames = mypyc_build(
      File "/home/davfsa/coding/mypy/mypyc/build.py", line 398, in mypyc_build
        group_cfiles, ops_text = generate_c(all_sources, options, groups, fscache,
      File "/home/davfsa/coding/mypy/mypyc/build.py", line 200, in generate_c
        modules, ctext = emitmodule.compile_modules_to_c(
      File "/home/davfsa/coding/mypy/mypyc/codegen/emitmodule.py", line 414, in compile_modules_to_c
        modules = compile_modules_to_ir(result, mapper, compiler_options, errors)
      File "/home/davfsa/coding/mypy/mypyc/codegen/emitmodule.py", line 258, in compile_modules_to_ir
        scc_ir = compile_scc_to_ir(trees, result, mapper, compiler_options, errors)
      File "/home/davfsa/coding/mypy/mypyc/codegen/emitmodule.py", line 209, in compile_scc_to_ir
        modules = build_ir(
      File "/usr/lib/python3.8/contextlib.py", line 75, in inner
        return func(*args, **kwds)
      File "/home/davfsa/coding/mypy/mypyc/irbuild/main.py", line 82, in build_ir
        transform_mypy_file(builder, module)
      File "/home/davfsa/coding/mypy/mypyc/irbuild/main.py", line 125, in transform_mypy_file
        builder.accept(node)
      File "/home/davfsa/coding/mypy/mypyc/irbuild/builder.py", line 175, in accept
        node.accept(self.visitor)
      File "/home/davfsa/coding/mypy/mypy/nodes.py", line 959, in accept
        return visitor.visit_class_def(self)
      File "/home/davfsa/coding/mypy/mypyc/irbuild/visitor.py", line 104, in visit_class_def
        transform_class_def(self.builder, cdef)
      File "/home/davfsa/coding/mypy/mypyc/irbuild/classdef.py", line 97, in transform_class_def
        transform_method(builder, cdef, non_ext, get_func_def(stmt))
      File "/home/davfsa/coding/mypy/mypyc/irbuild/function.py", line 121, in transform_method
        handle_non_ext_method(builder, non_ext, cdef, fdef)
      File "/home/davfsa/coding/mypy/mypyc/irbuild/function.py", line 440, in handle_non_ext_method
        func_ir, func_reg = gen_func_item(builder, fdef, name, builder.mapper.fdef_to_sig(fdef), cdef)
      File "/home/davfsa/coding/mypy/mypyc/irbuild/function.py", line 286, in gen_func_item
        builder.add_var_to_env_class(var, rtype, env_for_func, reassign=False)
      File "/home/davfsa/coding/mypy/mypyc/irbuild/builder.py", line 1099, in add_var_to_env_class
        attr_target = AssignmentTargetAttr(base.curr_env_reg, var.name)
      File "/home/davfsa/coding/mypy/mypyc/irbuild/context.py", line 129, in curr_env_reg
        assert self._curr_env_reg is not None
    hikari/messages.py:334: AssertionError:

    The interesting thing is that _curr_env_reg never gets set to anything else but None. Is there something I'm missing?

    pranavrajpal
    @pranavrajpal
    There's a setter for a curr_env_reg property on the same class that modifies _curr_env_reg and does get set to something other than None
    davfsa
    @davfsa
    That setter is in the ImplicitClass class not in the FuncInfo class. FuncInfo has the property with the is not None assertion check but doesnt have a setter to set it to anything but None
    Ronny
    @ronnypfannschmidt:matrix.org
    [m]

    hi, on pytest-dev/pluggy#326
    i obbserve

    Traceback (most recent call last):
      File "mypyc/irbuild/builder.py", line 169, in accept
      File "mypy/nodes.py", line 1245, in accept
      File "mypyc/irbuild/visitor.py", line 160, in visit_try_stmt
      File "mypyc/irbuild/statement.py", line 542, in transform_try_stmt
      File "mypyc/irbuild/statement.py", line 522, in transform_try_finally_stmt
      File "mypyc/irbuild/statement.py", line 466, in try_finally_resolve_control
      File "mypyc/irbuild/builder.py", line 177, in add
      File "mypyc/irbuild/ll_builder.py", line 101, in add
    /home/ronny/Projects/RonnyPfannschmidt/pluggy/src/pluggy/_callers.py:59: AssertionError: Can't add to finished block

    whats the suggested way to proceed

    1 reply
    Ronny
    @ronnypfannschmidt:matrix.org
    [m]
    it seems mypyc won't like relative imports in __init__.py
    Ronny
    @ronnypfannschmidt:matrix.org
    [m]
    whats going on with
    (Pdb) dist
    <pluggy._entrypoints.DistFacade object at 0x7f95925220d0>
    (Pdb) dist.__getattr__
    <built-in method __getattr__ of DistFacade object at 0x7f95925220d0>
    (Pdb) dist.__getattr__("version")
    '3.4.1'
    (Pdb) getattr(dist, "version")
    *** AttributeError: 'DistFacade' object has no attribute 'version'
    1 reply
    Arsh Anand
    @ArshAnand7_twitter
    Hey people i am new in here and just going to start my first year in college and i know python somewhere between beginner to intermediate level i really wanna learn new things and don't really know where to start from ....can anyone here guide me for the same and help me in contributing any of the project you are currently working on
    Mohsin Mehmood
    @mohsinmahmood12
    Hi everyone! I am looking for open-source contributions but I am a newbie Familiar with C++ and Python, The aim is to learn and contribute in open source, Looking forward to getting some guidance from experienced professionals.
    Harshit4bitsp
    @Harshit4bitsp
    Hello, I will be joining college this year. I have learned the basics of Python in my high school and doing a bit of C++ right now. I am just getting started and am clue less, I was going through all the organizations and mypy interests me. Likewise, I am looking for guidance and how to proceed further, granted I want to contribute here.
    Salman Adnan
    @grmculmfuer:matrix.org
    [m]

    Hi, I just joined this platform, I am a beginner, and I want someone to guide me through process, I have read getting started but I am not getting to the link of how to register for this company.

    Also, I wanna know that is it for those who are intermediate or for those who are beginners too.

    Shivansh Srivastava
    @shiv0112
    Hello everyone, I am Shivansh Srivastava, a third-year student of B. Tech. in Artificial Intelligence at Gautam Buddha University, I am looking forward to learning and grow. I am skilled in DevOps, Kubernetes, Docker, Openshift, and Jenkins. I am good in DSA, python, and Javascript and am looking forward to contributing to this organization. Can anyone please help me get started?
    Richard Si
    @ichard26
    I know Python 3.10 isn't officially supported by mypyc but I wanted to ask if y'all are aware windows C compiler doesn't like lib-rt for some reason: https://github.com/ichard26/black-mypyc-wheels/runs/4060845577?check_suite_focus=true#step:5:3297
    pranavrajpal
    @pranavrajpal
    That appears to have been fixed by python/mypy#11316
    Swagat S. Bhuyan
    @SwagatSBhuyan
    Hi I.m Swagat from India. Would really appreciate guidance in these initial stages of contributing to mypy, so if anyone could link me to the repository, some basic issues, documentation and setup, that would be great, thanks
    Gareth Andrew Lloyd
    @Ignition
    Anyone able to give me any insight to what maybe the issue. Bug in mypyc? or unsupported feature in my python?
    Traceback (most recent call last):
      File "mypyc/irbuild/classdef.py", line 99, in transform_class_def
      File "mypyc/irbuild/function.py", line 110, in transform_method
      File "mypyc/irbuild/function.py", line 412, in handle_non_ext_method
      File "mypyc/irbuild/function.py", line 267, in gen_func_item
      File "mypyc/irbuild/builder.py", line 1067, in add_var_to_env_class
      File "mypyc/irbuild/context.py", line 125, in curr_env_reg
    bla.py:49 AssertionError:
    Gareth Andrew Lloyd
    @Ignition

    Reproduce the problem

    import attr
    
    @attr.s(auto_attribs=True)
    class TestType:
        thing: str
    
        def foo(self) -> None:
            lambda x: self.thing # problem with mypyc

    Yet the following works

    from dataclasses import dataclass
    
    @dataclass
    class TestType:
        thing: str
    
        def foo(self) -> None:
            lambda x: self.thing
    Swagat S. Bhuyan
    @SwagatSBhuyan
    Hey, I gave my first contribution to mypy. It hasn't been merged yet, are there any more changes required or the codes are merged at certain time intervals. If you want to check, my PR is #11453
    Ansh-Srivastava-17
    @Ansh-Srivastava-17
    hello everyone I am Ansh from India. i am a begginer with python i have many projects also in python now i want to contribute to MyPy as i have interest in open source contribution so plz if someone can guide me how to start or contribute ..thank you
    97littleleaf11
    @97littleleaf11
    Everyone is welcome to contribute to mypy and mypyc. You could just scroll up this page and can easily find useful guidance in chatting history.
    Abhiuday Gupta
    @cp-Coder
    I am new to open source. I was just setting up the environment and there was an error. Can you help me understand what 'hash -r' is?? It is written in setup section of contributing guide...
    Jukka Lehtosalo
    @JukkaL
    the hash -r part is not always required. we should update the docs to explain when to use it (and what to do when it's not available, if anything). it's a built-in command in bash and maybe other shells.
    Abhiuday Gupta
    @cp-Coder
    Okay so if we don't use 'hash -r', we can still run the test right??
    Jukka Lehtosalo
    @JukkaL
    yeah, it should usually be fine. if something doesn't work, you can start a fresh shell session and things should be fine.
    Abhiuday Gupta
    @cp-Coder
    If so, there was another error. I didn't use hash -r but still it was showing another error.
    image.png
    How should I tackle this error??
    Jukka Lehtosalo
    @JukkaL
    @cp-Coder hmm i haven't seen that one before. what's your platform, python version and the mypy commit you are using?
    pranavrajpal
    @pranavrajpal
    I can reproduce that on Windows with python 3.9 with 9cbd2103abbc2afb518bbfe727b7c3e7bcd55f3a (a few weeks old master), although I'm guessing this is Windows-related
    Abhiuday Gupta
    @cp-Coder
    @JukkaL I have used python3.9 in windows 10 and I have freshly cloned the repo and made no changes.
    harvisbora
    @harvisbora
    Hello everyone, I am Hardik Bora, a IT undergrad, I have recently entered my second year at BVCOE Delhi. I am new to open source contribution but I am well aware of Python and C. I would love to contribute to your organization but could you please tell me on how to get started .
    rakeshchow202
    @rakeshchow202:matrix.org
    [m]
    Hi everyone. I'm Rakesh Chowdhury. I'm fairly new to Open-source and I'm interested in mypyc.
    I would like to contribute to mypyc and improve my skills while doing it.
    Please guide me to get started :)
    Max
    @MaxShvets

    Hi, I'm Max Shvets. I'm investigating this issue: mypyc/mypyc#899

    I have trouble creating a test case for usages of AnyStr. I added the following to mypyc/test-data/run-misc.test:

    [case testAnyStr]
    from typing import AnyStr
    
    def f(x: AnyStr, y: AnyStr) -> AnyStr:
        return x + y
    
    [file driver.py]
    from native import f
    
    print(f("3", "4"))
    
    [out]
    34

    However, when I try to run this test I get

    run-misc.test:1160: error: Module "typing" has no attribute "AnyStr"

    Does anyone know what might be the issue here?

    Max
    @MaxShvets
    After some investigation, the issue was that the default typing stub used for tests doesn't define AnyStr. In fact, none of the extended stubs in fixtures define it either. I want to fix this by defining AnyStr in mypyc/test-data/fixtures/typing-full.pyi and using [typing fixtures/typing-full.pyi] in the test. However, I noticed that adding [typing fixtures/typing-full.pyi] to the test results in mypyc not seeing the definitions in the test. I'll continue to investigate this and would appreciate any support
    Max
    @MaxShvets

    However, I noticed that adding [typing fixtures/typing-full.pyi] to the test results in mypyc not seeing the definitions in the test

    The reason was that I added [typing ...] right after the [case ...], so the input field of DataDrivenTestCase was empty and nothing was written to native.py

    Monalisa Khanda
    @monalisa_262000_twitter
    I've a doubt regarding the technologies are using in the organization... Do we have to know every technologies or any 1-2 out of those?
    Santhoshrao Ainleni
    @santhoshrao:matrix.org
    [m]
    Hello everyone. This is Santhosh, a AI undergrad looking to get started with open-source. And I'm seeking some guidance from mentors here.
    where could i select the projects
    Santhoshrao Ainleni
    @santhoshrao:matrix.org
    [m]
    @Soumokanti123: @Soumokanti123
    i really want to start with open source contribution i am new to all this world of opensource can please someone guide me to start with this thing
    Purna Chandra Mansingh
    @purna135
    Hi Team, I am Purna Chandra Mansingh, I am new to open source and want to be part of GSoC 22.
    I have a little knowledge of Data Science and Machine learning using python and I am good in Data Structure & Algorithms.
    Could you please guide me on which project is suitable for me to start with?
    Monalisa Khanda
    @monalisa_262000_twitter
    Hello team, I'm Monalisa Khansa, I've new to GSoC and I've contributed in hackathons n internships and wanna be part of this GSoC 2022.
    I've a great knowledge of python. I've contributed to software engineering projects in internships. Can anybody suggest me the issues which can be solved and suitable for me?
    Aakanksha31102
    @Aakanksha31102
    hello everyone I am second year IT student from india... i am really excited to start my open-source journey with mypy and i want to contribute to this organisation...I'm i'm new to coding but i've knowlegde of html css and python ....i want to contribute to cdli for GSOC'22 .... i would really appreciate some guidance and mentorship as it's a beginer at open source ..
    parthaxntn
    @parthaxntn
    hello everyone! I'm Partha Pratim Deka, a pythonist and web-developer. I am very excited to learn while contributing to mypy code.
    shaolo1
    @shaolo1
    Does mypyc have a “Compiled” switch like cython? (for runtime checking if code is compiled) https://cython.readthedocs.io/en/latest/src/tutorial/pure.html
    Salman Adnan
    @grmculmfuer:matrix.org
    [m]

    How much python is required for gsoc?

    Also, how much python machine learning is required for gsoc?

    How can I contribute to gsoc like how can I find projects for contribution?