Questions tagged [mypyc]

Mypyc compiles Python modules to C extensions.

It uses standard Python type hints to generate fast code. Mypyc uses mypy to perform type checking and type inference.

More information on the Github repository.

8 questions
2
votes
2 answers

mypyc, KeyError: '__file__'

I successfully use mypyc in my project and it has performed well until just a couple days ago. I now get the following error: File "mypyc/__main__.py", line 18, in KeyError: '__file__' Line 18 above, i.e., the line that is failing, is…
Joe
  • 965
  • 11
  • 16
1
vote
0 answers

mypyc not compiling file

I have a project which does not give any checking errors with mypy (Command used: mypy --strict --check-untyped-defs). I have run the file using python3 and it seems to work fine. The project is typed in most parts. When I run mypyc I end up with a…
Jarus
  • 52
  • 8
1
vote
1 answer

Getting ModuleNotFoundError when trying to import third party modules in setup.py

I am currently writing a module and I want to use mypyc for it. I was following the documentation for using it inside setup.py but I am getting a ModuleNotFoundError everytime I try to import it there and run pip install .. When running python…
moinierer3000
  • 1,927
  • 2
  • 9
  • 24
1
vote
0 answers

How to run mypyc generated code without the Python interpreter?

I want to write code in Python but still have real-time capable code. This means I cannot use the Python interpreter. Mypyc looks promising for this very specific purpose, even though it is not a goal of the tool, as it is only meant to accelerate…
Hidde
  • 11
  • 1
1
vote
0 answers

mypyc: Implementing a proxy object

Is there a way to implement a proxy object with mypyc? For example, consider the following code which works fine with Python but not mypyc: import typing class Thing: def __getattr__(self, name: str) -> typing.Any: return 5 t =…
Sohail
  • 3,020
  • 1
  • 25
  • 23
1
vote
1 answer

Is there a way for mypyc to compile a proxy object?

Consider the code below. This fails to run properly with mypyc because Proxy does not have a __dict__ attribute at runtime. So the questions are: Is there any documentation regarding the subset of the language that mypyc supports? I can't seem to…
Sohail
  • 3,020
  • 1
  • 25
  • 23
0
votes
1 answer

How to run mypyc in Spyder?

How does one install/run mypyc on Anaconda/Spyder? The documentation (https://mypyc.readthedocs.io/en/latest/index.html#) does not address this.
Lazarus
  • 21
  • 4
0
votes
1 answer

Importing python modules and extension modules with the same name

Let's say I built a package with a Python module and an extension module in it, but with the identical name mypackage | +-- __init__.py | +-- mymodule.py | +-- mymodule.cpython-39-x86_64-linux-gnu.so I have found that when I do from mypackage…