News for hackers. Stuff that matters.
Re:Python Versions Used in Commercial Projects, 2016 Edition by noir_lord on Friday November 11, 2016 @08:28AM (#12930357)
http://i.imgur.com/EJM1viF.png

That's why Python 2.7 will be around and maintain dominance for a while.

When the latest stable releases of the primary environments are defaulting to something you have to have very good reasons why not to use the default (even when it's easy to change the default).

Administrators (in the old school not the new "everything in containers") don't like using non-defaults.

Re:Python Versions Used in Commercial Projects, 2016 Edition by qznc on Friday November 11, 2016 @08:39AM (#12930473)
The default for Debian [0] and Ubuntu [1] is Python3. The `/usr/bin/python` symlink will be Python2 forever, since Python itself advises it. PEP 394[2]:

> for the time being, all distributions should ensure that python refers to the same target as python2.

[0] https://www.debian.org/doc/packaging-manuals/python-policy/c... [1] https://blueprints.launchpad.net/ubuntu/+spec/core-1311-pyth... [2] https://www.python.org/dev/peps/pep-0394/

Re:Python Versions Used in Commercial Projects, 2016 Edition by oneweekwonder on Friday November 11, 2016 @08:59AM (#12930634)
Am I incorrect in recalling that ArchLinux decided against this?

edit: seems to be the case[0]

[0]: https://wiki.archlinux.org/index.php/python#Python_2

Re:Python Versions Used in Commercial Projects, 2016 Edition by qznc on Friday November 11, 2016 @10:36AM (#12931528)
Read the next line in PEP 394 ;)

> however, end users should be aware that python refers to python3 on at least Arch Linux (that change is what prompted the creation of this PEP), so python should be used in the shebang line only for scripts that are source compatible with both Python 2 and 3.

Re:Python Versions Used in Commercial Projects, 2016 Edition by majewsky on Friday November 11, 2016 @09:41AM (#12930972)
Yes, which is why it is a staple of PKGBUILDs for Python software to do

  sed -i s/python/python3/ /all/the/things
Re:Python Versions Used in Commercial Projects, 2016 Edition by gsnedders on Friday November 11, 2016 @09:35AM (#12930921)
Before upstream CPython had any defined policy on the python symlink.
Re:Python Versions Used in Commercial Projects, 2016 Edition by eeZi on Friday November 11, 2016 @08:40AM (#12930480)
All major distributions have completed their switch to Python 3 or ship it already.

This is Canonical's stance:

> All Ubuntu/Canonical driven development should be targeting Python 3 right now, and all new code should be Python 3-only.

Regardless, nowadays many people deploy Python applications as stand-alone bundles. We're happily running Python 3.5 on CentOS 6 and it took like ten minutes to deploy (pyenv!). This lets us use a rock-solid base system with an up-to-date application stack, which makes our old school admins happy.

Re:Python Versions Used in Commercial Projects, 2016 Edition by teekert on Friday November 11, 2016 @08:36AM (#12930446)
Hmm, ok so you suggest all of a sudden switching to explicitly calling Python 2 with python2, like it is now for Python 3? Python 3 is present and working by default but we just decide, by convention, that Python 2 = python and Python 3 is python3. For obvious backwards and horizontal compatibility.

  $ lsb_release -a
  No LSB modules are available.
  Distributor ID: Ubuntu
  Description:    Ubuntu 16.04.1 LTS
  Release:        16.04
  Codename:       xenial

  $python3 --version
  Python 3.5.2
Edit: Just to check I started a clean 16.04 (on DO) and did the commands:

  # lsb_release -a
  No LSB modules are available.
  Distributor ID: Ubuntu
  Description:    Ubuntu 16.04.1 LTS
  Release:        16.04
  Codename:       xenial

  # python --version
  The program 'python' can be found in the following packages:
   * python-minimal
   * python3
  Try: apt install <selected package>

  # python3 --version
  Python 3.5.2
So, no python 2 by default but python 3 and you call it using "python3" as adviced in the pep qznc talks about.
Re:Python Versions Used in Commercial Projects, 2016 Edition by juriansluiman on Friday November 11, 2016 @08:35AM (#12930433)
Afaik, it has nothing to do with Ubuntu or any other Linux distro specifically, but this is rather a choice from python itself. See PEP394 [1]:

"for the time being, all distributions should ensure that python refers to the same target as python2."

I read above as the python community itself made "python" the default for python 2.7 and "python3" for python 3.x. Nevertheless, an unfortunate choice at this time. I understand the reasoning at the time of writing (March 2011) but now this should be reconsidered.

    [1] https://www.python.org/dev/peps/pep-0394/
Re:Python Versions Used in Commercial Projects, 2016 Edition by rtpg on Friday November 11, 2016 @08:39AM (#12930468)
We actually hit an unfortunate consequence of this with some scripts being called in python 2 mode while we were working in a python 3 virtual environment.
Re:Python Versions Used in Commercial Projects, 2016 Edition by berntb on Friday November 11, 2016 @08:32AM (#12930391)
Hmm... you really use the system Python installation for development? Python is not pathologically backwards compatible, what happens when the next OS version use a newer Python 2 version?
Re:Python Versions Used in Commercial Projects, 2016 Edition by cuu508 on Friday November 11, 2016 @08:42AM (#12930500)
You don't simply upgrade your production machines to the next OS version with fingers crossed. You do some testing and validation first.

Say, you use containers and so your application is isolated from the host system. When the next version of your host system comes with a new version of Docker, you have to do similar testing and validation anyway.

Re:Python Versions Used in Commercial Projects, 2016 Edition by noir_lord on Friday November 11, 2016 @08:34AM (#12930412)
Personally? I don't, I use Python 3 and virtualenvs but then everything I write in Python is for myself to do things for me.

If I was writing software that had to be used in as many places as possible or sold, I'd absolutely strongly consider using 2.7.

Re:Python Versions Used in Commercial Projects, 2016 Edition by adekok on Friday November 11, 2016 @08:45AM (#12930521)
OS vendors have similar issues with other open source projects. They tend to ship versions which are years out of date.

I understand the desire to have stable releases. But... if you're not shipping the most recent stable version of something, and instead shipping something that's 4-5 years old... it's frustrating for users and developers alike.