Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test alternative Python implementations #81

Open
2 of 9 tasks
jayvdb opened this issue Sep 8, 2019 · 16 comments
Open
2 of 9 tasks

Test alternative Python implementations #81

jayvdb opened this issue Sep 8, 2019 · 16 comments
Milestone

Comments

@jayvdb
Copy link
Contributor

jayvdb commented Sep 8, 2019

Needed for #78

More at https://wiki.python.org/moin/PythonImplementations#Working_Implementations

  • MicroPython
  • PyPy
  • Jython (Py2 only)
  • IronPython (Py3 not @ production)
  • Nuitka?
  • QPython3?
  • Android CrystaX NDK
  • cygwin
  • msys
  • MinGW, which has ~100 patches!
  • conda, on Windows at least (if different)
@bskinn
Copy link
Owner

bskinn commented Sep 8, 2019

Azure has at least Jython and PyPy -- virtualenv runs them. Not sure about IronPython.

@jayvdb
Copy link
Contributor Author

jayvdb commented Sep 8, 2019

I'll focus on IronPython then.

@bskinn
Copy link
Owner

bskinn commented Sep 8, 2019

Looks like Jython is still Py2-only?

@jayvdb
Copy link
Contributor Author

jayvdb commented Sep 9, 2019

Re #82 (comment)

By default, I expect Windows is different for any Python, because it is different on CPython. Any Python implementation attempting to be like CPython will likely need to replicate some of the same differences, though they may choose to not adopt all of them due to incompleteness/small-devbase or unawareness/small-userbase.

I only have limited exposure to platform issues on PyPy via pyflakes dev/CI maintenance. It does have limited stdio tests and I am pretty sure there were Windows specific problems which caused other maintainers to give up and kill the Windows CI of PyPy, mostly pre PyPy 5.0, but I recall getting stuck on one PyPy 5+ Windows specific problem. Most of these problems however were in the backtraces, both the layout (irrelevant for us) and the context of the error messages (which would mean our tests might fail, only due to different expected error strings)

Looks like Jython is still Py2-only?

Ugh, surprisingly yes.

Effort ongoing at https://github.com/jython/jython3 instead of in https://github.com/jythontools , and no py3 effort appearing at https://hg.python.org/ or in commit messages of https://hg.python.org/jython/

jython/jython3#36 and https://stackoverflow.com/questions/2351008/when-will-jython-support-python-3 are the trackers it seems.

More at wiki.python.org/moin/PythonImplementations#Working_Implementations

I ran into jython/jython3#33 about https://github.com/securesystemslab/zippy, which is missing from the above page. py34? Maybe GraalVM only, or JVM with special flag enabled?

https://beeware.org/project/projects/bridges/voc/ looks nice , and https://github.com/beeware/ has a bunch of cool stuff I've been meaning to play with.

The PythonImplementations wiki page should be annotated with py2 vs py3 info

@bskinn
Copy link
Owner

bskinn commented Sep 9, 2019

MicroPython/CircuitPython?

Brython?

@jayvdb
Copy link
Contributor Author

jayvdb commented Sep 9, 2019

MicroPython is probably worthwhile.

Python console/IO on JS runtimes is unlikely to be a reasonable use-case IMO.

Nuitka spits out native binaries, and is under very active maintenance - I've been bugging them a bit lately and seeing regular bugfixes. I havent looked closely enough to see if it injects a real python exe; if it doesnt, the C stub for bootstrapping could have slightly different IO initialisation.

bskinn added a commit that referenced this issue Sep 10, 2019
@bskinn
Copy link
Owner

bskinn commented Sep 11, 2019

MicroPython may take a lot of work. Just getting pytest installed is non-trivial, and it may not even run after that.

We may have to come up with a way to automatically rewrite the test suite to meet the MP limitations. Or, curate a separate MP test suite (bleh, DRY!).

Though, we may be looking at a significantly curtailed feature set for MicroPython...maybe even just the 1.0 functionality, which wouldn't be that awful, maintenance-wise.

@bskinn
Copy link
Owner

bskinn commented Sep 13, 2019

@jayvdb
Copy link
Contributor Author

jayvdb commented Sep 14, 2019

@bskinn
Copy link
Owner

bskinn commented Sep 15, 2019

Are there enough mobile apps with enough console I/O to make the platform a meaningful target?

@jayvdb
Copy link
Contributor Author

jayvdb commented Sep 15, 2019

My only use of QPython(2,3) was teaching Python to kids with a mobile phone and no computer. 100% 'console', albeit wrapped in the QPython IDE. It was reasonably good. But not a high priority.

@bskinn
Copy link
Owner

bskinn commented Sep 15, 2019

Ahhhh, I never even thought about that angle. Though, I should have, because I sometimes use Python through Termux on my phone...it definitely has some quirks.

How would we emulate those? I know there's a service or few where it looks like a VM but you're actually renting time on real mobile devices...might also be some that are pure VMs?...no idea if any of them have free tiers for FOSS, though.

@bskinn
Copy link
Owner

bskinn commented Sep 15, 2019

Hunh. MicroPython types apparently don't implement .mro():

MicroPython v1.11-303-gc8c37ca40 on 2019-09-10; linux version
Use Ctrl-D to exit, Ctrl-E for paste mode
>>> import sys
>>> sys.stdin
<io.TextIOWrapper 0>
>>> sys.stdout
<io.TextIOWrapper 1>
>>> sys.stderr
<io.TextIOWrapper 2>
>>> sys.stderr.__class__.mro()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: type object 'TextIOWrapper' has no attribute 'mro'
>>> sys.stderr.mro()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: 'TextIOWrapper' object has no attribute 'mro'

@bskinn bskinn added this to the v2.0 milestone Sep 16, 2019
@bskinn bskinn mentioned this issue Sep 16, 2019
16 tasks
@jayvdb
Copy link
Contributor Author

jayvdb commented Sep 16, 2019

MicroPython types apparently don't implement .mro():

That probably means they are old-style py2-ish, based on 'type', not subclassing 'object'.

I have a backport of .mro() at jazzband/contextlib2#21

@bskinn
Copy link
Owner

bskinn commented Sep 16, 2019

Ennnh, I don't think so:

>>> str.__bases__
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: type object 'str' has no attribute '__bases__'
>>> import io
>>> io.StringIO.__bases__
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: type object 'StringIO' has no attribute '__bases__'
>>> io.StringIO.__mro__
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: type object 'StringIO' has no attribute '__mro__'
>>> dir(io.StringIO)
['__class__', '__enter__', '__exit__', '__name__', 'close', 'read', 'readinto', 'readline', 'write', 'flush', 'getvalue', 'seek']

I'm currently at a loss for how even to introspect anything about the inheritance hierarchy in MP.

Also: Yikes, the MRO itself is not CPython-compliant.

@jayvdb jayvdb changed the title PyPy, IronPython and Jython CI Test alternative Python implementations Sep 29, 2019
@jayvdb
Copy link
Contributor Author

jayvdb commented Sep 29, 2019

I've added cygwin, msys and MinGW.

I've been doing a lot of Nuitka the last week for a work project - it is very nice. While attempting to cross-compile Python on Linux, using MinGW, I found they have a wildly patch python, and the patches definitely fiddle with these io streams.

The result of this is I'll be able to add Nuitka "standalone" to the CI here soon. I have >200 core packages working, with notable failures at Nuitka/Nuitka#522

I havent investigated yet, but I think conda might also be using a mingw based Python on Windows instead of the MSVC builds.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants