Why doesn't pyGame or pyglet support python 3? - python-3.x

I have been looking into various game design modules for python such as pyglet and pyGame. I have noticed that both of these seem to only be compatible with python 2. Seeing as python 3 is the most current version, why is this? My experience with python has been with python 3, so are there good frameworks/modules out there for python 3 game development? Or would I be better off learning python 2 and using pyglet or pyGame?
edit: I would be using pyGame on a mac. The downloads page, http://www.pygame.org/download.shtml, only has links for py2.6, py2.5, and py2.4, which is what leads me to believe it is not python 3 compatible.

I don't even get your question, as PyGame is compatible with Python 3 since version 1.9:
http://www.pygame.org/wiki/python3porting?parent=todo
There are a few minor issues, but it is usable with Python 3.

I'm developing a pygame-based application on Mac OSX with python 3. It definitely works fine, and so far I haven't run into any compatibility problems, though there are certainly other mac-specific pygame bugs that I have found.
That said, I can definitely confirm that it works.

The fifth link from the top under "Windows" on the page you linked to clearly has py-3.1 in the name.

They don't support Python 3, because nobody has made them support Python 3 yet. It's a bizarre question. :-)
PyGame seems to mostly support Python 3. There are some issues: (from http://www.pygame.org/wiki/python3porting?parent=todo )
Complete unicode file name handling (fsencoding branch), then merge back into trunk (by mid Sept/10).
update documentation to explain Unicode in Pygame
work out final solution for open Python 3 IOBase objects: how to check abstract types from C. (Sept. 1, 2010) Probably the most practical solution is to just do duck typing.
_movie - deferred until module is ready for release
scrap (does some C string stuff that makes porting difficult)
camera - what is the status of this module?
Nowhere does it say that it doesn't work for Python 3 on mac, and it seems unlikely to that that this would be the case. So you can try, but you will have to compile it yourself.
Pyglet doens't mention Python 3, so it's probably not ported.

pyglet 1.2 (alpha as of July 2012) works with Python 3.

Related

Can I transpile python 3.7 code to a lower version?

In a python-based project, I would like to use features data classes and libraries such as the current RxPY version.
However, we are bound to an environment (a Yocto-system) that only has Python 3.5.5
From TypeScript/JavaScript I know that some languages allow code to be transpiled to a lower language version.
Can Python 3.7 code be transpiled to a lower version?
Many thanks
You can't just use a tool to convert Python code to earlier versions, because those versions would sometime lack the libraries that you need. Using Python 3.7's dataclass is a good example.
A workaround for you would be to just install a port of dataclasses back in your 3.5 environment. This would be tricky. If you had python 3.6 you could just install this through
pip install dataclasses
But you can see in this issue that they never ported it back for python 3.5. If you check out their GitHub, maybe there are manual changes you could do to the source code to make it work. Maybe.
The easier way would be to find an alternative to dataclasses

What is the real current status of Twisted on Python3?

Had used some twisted using Python 2.6 few years back, and since then stopped using Python. Recently starting picking up on Python 3, and was checking status of twisted support for Python 3 which was very thin back when I left.
Introduction section of the Latest document on the topic says this:
Twisted is currently being ported to work with Python 3.4+. This
document covers Twisted-specific issues in porting your code to Python
3.
Most, but not all, of Twisted has been ported, and therefore only a
subset of modules are installed under Python 3. You can see the
remaining modules that need to be ported at
twisted.python._setup.notPortedModules, if it is not listed there,
then most of all of that module will be ported.
And clicking on the twisted.python._setup.notPortedModules shows no module listed.
Does that mean that twisted is now fully supported on Python 3 ? Or just the list is incorrect ? If so, are the samples / examples converted for Python 3 ?
The most likely definitive resource on this topic is the continuous integration system.
According to https://travis-ci.org/twisted/twisted, a recent run had 9957 passing tests on Python 3.6 compared to 9933 passing tests on Python 2.7. There is some slop in these numbers because the test suite includes some tests which are only relevant to Python 2.x and others which are only relevant to Python 3.x (therefore we would not expect exactly the same number of tests to run on each runtime) however these numbers are so close that I would say that Twisted has basically been complete ported to Python 3.6. Problems that remain are probably more likely to be "regular bugs" rather than unported code.

Anyone hear when NLTK 3.0 will be out?

The website, http://www.nltk.org, says mid 2011 in a very vague manner. I would like to start using NLTK however I have done a fair amount of work with Python 3.x and I don't want to have to go backwards in Python version just to use it. Just doing an effort analysis, if the wait is long enough I might bite the bullet and revert my Python.
There's a Python 3 branch:
https://github.com/nltk/nltk/tree/nltk-py3k
It's a transformation of the trunk and gets updated every so often to keep up with changes. You can check it out directly from git (instead of using the NLTK installation) and give it a shot.
git clone git://github.com/nltk/nltk.git nltk --branch nltk-py3k
I haven't used it personally, but I assume it works.
There is a "2and3" branch in the main nltk repo - see https://github.com/nltk/nltk/tree/2and3
It appears to be getting updated regularly, although I haven't tried it myself.
Here's the alpha release: https://github.com/nltk/nltk3-alpha
Alternative NLP: TextBlob is fully Python 3. https://github.com/sloria/TextBlob
Tutorial: http://www.stevenloria.com/how-to-build-a-text-classification-system-with-python-and-textblob/
For those who got here wondering when will nltk support python3:
Good news, the NLTK 3.0 series (currently on alpha and in development since Jan 2013) now support Python 2.6, 2.7 and Python 3 (http://www.nltk.org/nltk3-alpha/), We'll probably see a stable release soon :)
And the book is also being updated for python3, available at: http://www.nltk.org/book3/
So, the official release was in September 2014, just to add closure to the question

How to Be Python 3 Ready?

What are the current rules for writing python code that will pass cleanly through 2to3 and what are the practices that seem to be best suited to writing code that will not become mired forever in version 2.
I have read from the SciPy/NumPy forums that "100% test coverage" (unit testing) is important for many people, and I am not sure if that would apply to everybody. Certainly having a reasonable set of unit tests to try your code out with after conversion, seems a sane step.
Are there other things? What are skilled Pythonistas doing if they are writing 2.x code that they hope to have come through "cleanly" in the 2to3 process.
I am looking for specific instances of "[don't] do this" as well as some more general "best-practices", but specific instances of "do's and don'ts" are helpful.
Let's assume that frameworks, libraries (Django, SciPy/NumPy), and every other C Extension we need gets ported to Python3 eventually, and I'm asking about how you write and maintain the pure python language code that you write yourself.
Update: It's possible that what I really want is the "style guide" and list of deprecated features that everybody was already staying away from. I cut my teeth on Python 1.5 and moved to 2.0, and then have not really followed much of the 2.5/2.6 era, used them but really my code is more 2.1 era.
I'd say:
Read the "What's new for Python 3.0". Very informative.
In particular, if you care about Unicode or text encodings at all, take the time to understand what has changed for 3.x. That's probably one of the trickier things to change for Python 3.x.
Get Python 2.6 or 2.7, and run your code with the -3 flag. It will tell you about things in your code that will need changing.
Before using 3rd-party packages, check to see if they have a Python 3.x version. If not, check the package web site, mailing lists, version control repositories etc to see how actively the package is being developed and whether there is a roadmap towards Python 3.x support.
Download Python 3.x and try it out! Admittedly, that might not be practical if you care about code that currently depends on packages that don't yet support Python 3.x (e.g. wxPython or Django).

Python 3 and PyQt 4 recommendations

Is the combination of Python 3 and PyQt 4 recommended? Are there any alternatives?
I don't see why not, there is a version available for Python 3 which works normally, and the only alternative if you really need Qt would be PySide, which is far from being compatible with Python 3.
Other GUI alternatives would be wxPython (not in Python 3 yet AFAIK) and the "native" Tkinter (which is something else...).
If PyQt4 is the only non-native module you need, there should be no problem.
Check if all modules you need are available for Py3k!
PyQt4 for Py3k is not yet integrated into all distributions.
I.e. on Debian PyQt4 only works with Python 2 currently.
Have a look at 3to2! A tool to convert Py3 to Py2 code.
That is just better than coding in Py2 and using 2to3.

Resources