Closed kopp closed 4 years ago
Thanks for taking the time to investigate and supplying the pull request. I have no objections in accepting a pull request, but using Python 3.8 on Windows with Pycharm 2019.3.1 Professional Edition, I do not get any exceptions. Could you please provide some additional detail as to how I can recreate the exceptions you are seeing? Thanks.
All I did was trying to do an import
of the code in a running instance of python. In case your editor/tool of choice actually wants to execute a python script importing microbit
you'll see this error as well.
Again I appreciate your efforts, but I think you are trying to use this package in a way it was not intended to be used. When it was released there were no editors specifically available for the micro:bit and so I developed this package for folks to be able to use the Pycharm IDE to provide type checking and type hints while editing code. It also adds tools to PyCharm to allow for minimizing the size of the source code and for uploading the code to the micro:bit
The micro:bit uses a flavor of MicroPython that supports micro:bit specific hardware and MicroPython that itself is not python 3.8 compatible. This package has also been incorporated into the Pycharm plugin for general MircoPython support. The package still works with PyCharm in conjunction with Python 3.8 without any exceptions, so it still works as "advertised".
I am not questioning the worth or use of your proposed changes, but they would radically alter things in a way that would have this package depart from its original intent. What I would suggest is that you create a package of your own. If you are unfamiliar with creating a Python package, or the mechanics of GitHub, I would be glad to help you to achieve your goal, but I am going to deny merging your changes. I hope you understand my reasoning. If you have any comments or questions they are always welcome and you may enter them here and I will see them even though I am closing the pull request.
I totally understand your reasoning and I would like to thank you for the polite way of replying!
Out of curiosity: Would the pseudo-microbit
package be a candidate for a microbit-stubs
package as defined in PEP 561 (with file names changed .py
-> .pyi
)?
I am not terribly experienced with the PEP, but it looks like the PyCharm extension for micro: bit, which is based upon my code, uses this scheme. The extension is actually written in Kotlin, but uses the Python code and may be able to give you some hints on how to organize things. Looking at some of my older releases of pseudo-microbit, I also had some .pyi files but apparently I abandoned them for straight .py files at some point. I don't remember why I did that. Perhaps for consistency or because the .pyi files caused some issues. Sorry that I could not be of more help on this subject. Again, if you have any questions, I would be happy to answer if I can.
I am currently struggeling with .pyi
files myself. For future reference, one of the issues I encountered is the lack in tooling support by e.g. pylint
as in this issue.
I am not sure if you have seen this article or if it may be useful, but I am passing it on, just in case it can help.
There is also some information about additional types in Python 3.8 in this article.
Problem description
When trying to import
microbit
with python3.8 I get import errors. This pull requestError Logs