Forums

Requests for SQLAlchemy and Python 3.3

I have two requests:

1) Would you like to include SQLAlchemy for Python 3.3? I need databases to organize as much data as possible on my website.

2) Would you like to make Python 3.3 the standard version on PythonAnywhere? I don't feel like using an old version of Python, when there is a new one available.

Hi Ronan,

  1. It appears that you have to build a special variant of SQLAlchemy Python 3. Based on this it appears that the C extensions for SQLAlchemy are only optional, and aren't supported for Python 3 yet anyway. So, you should be able to build your own version and install it within a virtualenv on PA. I'm sure the devs would consider installing a Python 3 version, but it would require a lot of care not to upset existing users of SQLAlchemy with Python 2.

  2. This is a decision for the PA devs. However, it doesn't, in my opinion, seem sensible to make Python 3 the default yet - it's still not supported by many libraries and it's still not generally used in production environments. The transition from 2 to 3 is going to be a very slow process. Even every Python coder wrote Python 3 compliant code (which is far from the truth), a general-purpose hosting environment like PA can't make that sort of assumption about its users. Hence, it aims to present as many options as possible and allow its users to make up their own minds.

Python 3.3 is available on PA - you just have to execute it as python3.3 instead of just python. You can easily change the shebang line on your scripts to do this. Alternatively you can use virtualenv with the -p flag to select an alternate Python version to be the default in that virtualenv.

Thanks for your informative reply. I haven't realized Python 3.3 is actually useless if you're not a Python developer.
I can handle learning just one version of a programming language, but I can't handle using many different versions at the same time, while I also have to keep track of all the changes.
Version control makes it extremely difficult for programmers to create a streamlined experience for the users, however statistically, it seems like the best option for me is to stick with Python 2.7. But still, I have to make sure I don't use libraries that won't support Python 3.3 in the future. I think that I have to use a lot of improvisation skills now if I want my website to say "Hello World" correctly.

I certainly wouldn't say Python 3 is useless, and if you want to use it for your own website then go ahead - it's a mature, stable piece of software. Eventually, more or less everyone will migrate over to Python 3, but it's just a slow process. Also remember that the differences with Python 2 aren't actually all that extensive.

My point was simply that shared hosting like PA has to cater for the common case, and that's still Python 2 at present. There are an awful lot of Python programmers out there who're used to using Python 2, and they're still in the process of moving across. As they do so, increasing numbers of Python libraries and applications are being updated to work on Python 3, and this further accelerates the transition.

I would say if you're learning Python as an employable skill, Python 2 is still your best bet, but understanding what's changed in Python 3 would also be an asset. If you're learning purely for personal purposes, overall you'll save yourself some effort just learning Python 3 first, but you should try to pay attention to what was different in Python 2 so you can understand other people's code.

Finally, I should point out that the Python project maintains a tool called 2to3 which is capable of converting most well-behaved Python 2 code into valid Python 3 code, which you might find useful to convert your own or third party projects across at some point.

What Cartroo said. All I can add is, I did do a little test of the toolset we need to support Python 3 the other day, and it all works, so hopefully we'll be able to build in support for Python 3 web apps some time in the next few months...