What Python 3 version for my Django project - python

I will try to port my Python 2.7 with Django to Python 3. But now my question is what version is the most stable one today? I've heard people use 3.2 and 3.4 and recommend it. But now I'm asking you guys.
What version is the most stable one today?

If you go to their downloads page, you will find the following statement (my emphasis):
We recommend using the latest version of Python 3 [...]
I've been using Python 3.4.3+ in a Django 1.8.2 project without issues and I don't see why you should run into problems here.
However, if you do run into issues, you should file a bug.
What version is the most stable one today?
Whatever version shows up as the recommended download in the python homepage should be considered stable. If that happens to be v3.5, then you should use that.

Python's version are quite stable, but you have to check is virtualenv on your OS is handled already by particular Python's version eg. 3.5.0 is not yet prepared for it. I recommend you 3.4.x, which I use on my own without any problems.

You may check for 'What Python version can I use with Django?' in official documentation here and here faq which lists which Python version is supported to which Django version

Related

Using older version of python with Py-Script

Would anybody know how to change the version I use in Py-Script? Currently my Py-Script is using python 3.10, but I would like to be able to use python 3.6.
I had python 3.10 and 3.6 installed, so i tried removing 3.10, but that didn't work, as I also expected, but other than that, I have no clue how to and have had no luck finding any information on the topic online.
I'm quite new to programming, so any help would be greatly appreciated!
You cannot easily change the Python version. Python is included with Pyodide which PyScript loads. Changing the version would require rebuilding Pyodide.
Note: I am not sure if it would be possible to use vanilla Python 3.6 with the current version of Pyodide.
Improve your code to work with Pyodide's bundled version of Python.

Why is Colab still running Python 3.7?

I saw on this tweet that Google Colab move to Python 3.7 on February 2021. As of today however (January 2022), Python 3.10 is out, but Colab still runs Python 3.7.
My (voluntarily) naive take is that this is quite a significant lag.
Why are they not at least on Python 3.8 or even 3.9?
Is it simply to make sure that some compatibility criteria are met?
The only reason is they want to have the most compatible version of Python worldwide. Based on the Python Readiness report (Python 3.7 Readiness), version 3.7 supports almost 80.6% of the most used packages so far. Still, this coverage is 78.3% for version 3.8, 70.6% for version 3.9 and 49.7% for version 3.10 (as of March 29, 2022).
Frankly, if Python 3.6 was not in its EOL, they still used this version today. Lucky us, python.org decide to rid of versions below 3.7. 😊
On the other hand, You can update the Python version in your Colab by running some Linux commands in the notebook. But the problem is that whenever you start a new notebook, google ignores the updates and will turn back to the original version.
The best action that google can take is to have options to select the python version. Because of this, I am not using Colab in most cases, especially when teaching Python to my students.
Update (January 12, 2023):
Now google Colaboratory supports Python 3.8.16. After a long time, we see some improvement. But it's still outdated because the current version is 3.11.1.
Python Readiness report says 80.8% of most used packages support Python 3.8, and 30.6% support 3.11. But we know it comes from info on PyPi. In practice, this support is far more than what the package maintainer says in the repository. Many packages support 3.11, but they still mention the lower version of Python. The reason is the maintainer didn't have a chance to check and update their production yet.
You can use Python 3.10 with this notebook.

python3.7 biopython, how to learn python3 and still use biopython

I'm very new to python and biopython, currently using a mac. I have python v2.7 and v3.7, and I would like to be learning with python3. Biopython only works on v2.7. Is it worth installing python V3.4 as well as these other 2 versions so I can learn python3 and use biopython? Or remove python3.7 and add 3.4? Even if I install python3.4 will biopython work if it was installed prior? Very confused biologist here.
Firstly, check out this page: https://biopython.org/wiki/Download
You don't have to worry about biopython being bound to a specific version of python - you can use it with either v2.7 or v3.4/v3.5/v3.6. You can also have multiple version installed on your system but I recommend you to focus on digging deeper into one of them. Personally, I work now for several years with python3.x (at the moment 3.6) but I know a lot of people sticking to v2.7.
Having also a bioinformatics background, one thing that I can highly recommend you at the beginning of your journey is taking a course such as:
https://www.coursera.org/specializations/python
There is also a bunch of free tutorials on youtube - you will easily find one that fits your needs by searching for "python tutorial" or "python getting started".
Get yourself comfortable with the language, check out the basics such as data structures, databases, and data visualization. Check also some "python cheat sheets" - they can help you pick up the basic concepts of the language.
All the best and keep on coding!
From the biopython installation document:
Biopython is designed to work with Python 2.5 to 2.7 inclusive. Python 2.7 is the final 2.x series release, and this would be our recommended version (assuming all other Python libraries you plan to use support it).
Upgrading bug-fix releases (for example. 2.6.1 to 2.6.2) is incredibly easy and won’t require any re-installation of libraries.
Upgrading between versions (e.g. 2.6 to 2.7) is more time consuming since you need to re-install all libraries you have added to python.
As of Biopython 1.62 we officially support Python 3, specifically Python 3.3. Python 3.0, 3.1 and 3.2 will not be supported.
Also from the Biopython website:
Python 2.7, 3.4, 3.5, or 3.6 or PyPy, including the Python development header files like python.h
So biopython is inconsistent with their documentation.
I think your best option is to download either the latest version of Python 2 or 3 and see if it works.

Which Python version to use for using BeautifulSoup and urllib?

I'm working on web crawling using Python. I had issues while using Python version 3. So I wanted to know which version of Python is suitable for web crawling.
I think there is definitely a counter-argument to making the move to Python 2.7. There is no reason that I can think of, particularly for web crawling, that you would need to revert to Python 2.7.
BeautifulSoup 4 and lxml are both fully ported to Python 3.5.
urllib is fully functional in Python 3.5. You should be aware that there are differences in the implementation of urllib in Python 2.7 and Python 3.5.
However, I would suggest you use the Requests package instead of urllib. Here is a post highlighting some of their differences.
If you need to load pages that require javascript, Selenium also works in Python 3.5. Selenium can also support headless browsing (e.g., PhantomJS).
Also, here is an official post from Python that can help guide you to your decision.
If you do opt to install one of the standard Python distributions,
make sure you have Python 2.7.3 or later, but do not use Python 3.0 or
later; these versions are, of course, the cutting edge versions, but
many of the packages we will be using do not yet have Python 3.X
support, and until they do, 3.X is not that appealing. For a good
discussion of what is and is not available in Python 3.X, see Choosing
Python versions.
Got this of a website which introduces and discusses web-cralling for Python. I would suggest you take their advice. I have also experienced that Python 2.7.* is the best for application at the moment for using additional packages.

Matching Mercurial/Python/PyWin32 Component Versions

I'm looking at two different guides for Windows HgWeb installation on IIS. The first from mercurial developers says:
On Windows, your Python version must
match the version used to compile
Mercurial. Otherwise, you'll get
"Invalid Magic Number" errors when
trying to run the CGI.
The second guide says:
Don’t waste time monkeying around with
the installers. You need a version of
Mercurial matching your Python install
so get the source code!
This is all great, except nobody wants to tell you how to match versions of Python and Mercurial. I see no guide that gives a map correlating version numbers. That is my primary need. For example, I'm using Mercurial 1.9. I have no idea what version of Python goes with that. The second guide says my version of PyWin32 must match as well. Great.
If the version-match info is not available online, is there a command I can issue to Hg that will dump all this info on me?
In the mean time, I've found that I can't build the Mercurial source code (is this because I don't have a properly matching version of Python?).
HgWeb
For HgWeb, this Mercurial download page recommends using the version that installs Mercurial as python modules, requiring Python 2.6.
From that, you would select a build of PyWin32 and choose the download for Python 2.6, as they build it for several versions.
Both decisions also have 32bit and 64bit versions.
Building
The main Mercurial download page hints that Python 2.4 through 2.7 are supported, so you might try building with 2.6 or 2.7 if you still wish to build it yourself. The wiki page for building on Windows is dated, mentioning Mercurial 1.3, but also mentions Python 2.6.

Categories