Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.debian.maint.python > #12739 > unrolled thread

The python command in Debian

Started byMatthias Klose <doko@debian.org>
First post2020-07-09 15:30 +0200
Last post2021-03-02 10:50 +0100
Articles 16 — 12 participants

Back to article view | Back to linux.debian.maint.python


Contents

  The python command in Debian Matthias Klose <doko@debian.org> - 2020-07-09 15:30 +0200
    Re: The python command in Debian Jeremy Stanley <fungi@yuggoth.org> - 2020-07-09 19:00 +0200
      Re: The python command in Debian paultag@debian.org - 2020-07-09 19:50 +0200
    Re: The python command in Debian Ondrej Novy <novy@ondrej.org> - 2020-07-09 21:50 +0200
      Re: The python command in Debian Fabrice BAUZAC-STEHLY <noon@mykolab.com> - 2020-07-13 18:30 +0200
        Re: The python command in Debian Matthias Klose <doko@debian.org> - 2020-07-13 19:30 +0200
          Re: The python command in Debian Ondrej Novy <novy@ondrej.org> - 2020-07-14 11:00 +0200
            Re: The python command in Debian Piotr Ożarowski <piotr@debian.org> - 2020-07-14 11:20 +0200
              Re: The python command in Debian Rene Engelhard <rene.engelhard@mailbox.org> - 2020-07-18 08:50 +0200
                Re: The python command in Debian Sebastian Humenda <shumenda@gmx.de> - 2020-07-18 10:30 +0200
                  Re: The python command in Debian debacle@debian.org - 2020-07-18 10:40 +0200
                    Re: The python command in Debian Dmitry Shachnev <mitya57@debian.org> - 2020-07-18 11:30 +0200
    Re: The python command in Debian Sandro Tosi <morph@debian.org> - 2020-07-16 18:10 +0200
    Re: The python command in Debian "Nicolas Dandrimont" <olasd@debian.org> - 2020-09-17 15:20 +0200
      Re: The python command in Debian Matthias Klose <doko@debian.org> - 2020-09-17 15:40 +0200
    Re: The python command in Debian Matthias Klose <doko@debian.org> - 2021-03-02 10:50 +0100

#12739 — The python command in Debian

FromMatthias Klose <doko@debian.org>
Date2020-07-09 15:30 +0200
SubjectThe python command in Debian
Message-ID<AqEMF-3CH-3@gated-at.bofh.it>
As written in [1], bullseye will not see unversioned python packages and the
unversioned python command being built from the python-defaults package.

It seems to be a little bit more controversial what should happen to the python
command in the long term.  Some people argue that python should never point to
python3, because it's incompatible, however Debian will have difficulties to
explain that decision to users who start with Python3 and are not aware of the 2
to 3 transition.  So yes, in the long term, Debian should have a python command
again.

One solution could be not to ship the python command in bullseye, forcing users
to adjust their local installations.  This has the advantage that the error of
an unknown interpreter should be pretty clear.  But leaves users without a
python command for the next two years until bullseye+1.

Describing here a solution which is implemented for Ubuntu focal (20.04 LTS).  A
new source package what-is-python (-perl-dont-hurt-me) ships binary packages
python-is-python2, python-dev-is-python2, python-is-python3 and
python-dev-is-python3.  The python-is-python2 package provides the python
package, such that packages that still depend on python are not removed on a
distro upgrade.  On new installs, python-is-python3 is not installed by default,
but the user gets a hint from command-not-found to install the package if he
tries to run python.  Package dependencies on the new four binary packages have
to be disallowed in the Python policy.  Note that such a package including the
Provides should only be uploaded once all dependencies on the unversioned python
packages are gone.

Matthias

[1] https://lists.debian.org/debian-python/2020/07/msg00039.html
[2] https://launchpad.net/ubuntu/+source/what-is-python

[toc] | [next] | [standalone]


#12740

FromJeremy Stanley <fungi@yuggoth.org>
Date2020-07-09 19:00 +0200
Message-ID<AqI3T-5sW-7@gated-at.bofh.it>
In reply to#12739

[Multipart message — attachments visible in raw view] — view raw

On 2020-07-09 15:26:47 +0200 (+0200), Matthias Klose wrote:
> As written in [1], bullseye will not see unversioned python
> packages and the unversioned python command being built from the
> python-defaults package.
> 
> It seems to be a little bit more controversial what should happen
> to the python command in the long term.  Some people argue that
> python should never point to python3, because it's incompatible,
> however Debian will have difficulties to explain that decision to
> users who start with Python3 and are not aware of the 2 to 3
> transition.  So yes, in the long term, Debian should have a python
> command again.
[...]

I don't follow your logic there. Why is it hard to explain? Python
was a programming language, and its last interpreter (2.7) is no
longer developed or supported. Python3 (formerly Python3000) is also
a programming language, similar to Python and developed by the same
community, but not directly compatible with Python. Debian provides
an interpreter for Python3, but has (or will have by then) ceased
distributing a Python interpreter.
-- 
Jeremy Stanley

[toc] | [prev] | [next] | [standalone]


#12741

Frompaultag@debian.org
Date2020-07-09 19:50 +0200
Message-ID<AqIQh-5YR-1@gated-at.bofh.it>
In reply to#12740

[Multipart message — attachments visible in raw view] — view raw

On Thu, Jul 09, 2020 at 04:55:33PM +0000, Jeremy Stanley wrote:
> I don't follow your logic there. Why is it hard to explain? Python
> was a programming language, and its last interpreter (2.7) is no
> longer developed or supported. Python3 (formerly Python3000) is also
> a programming language, similar to Python and developed by the same
> community, but not directly compatible with Python. Debian provides
> an interpreter for Python3, but has (or will have by then) ceased
> distributing a Python interpreter.

counterpoint: It is normal and expected to have `python` be the same
as `python3` in a virtualenv, the idiomatic way to maintain the Python
environment.

I love the idea of eventually migrating `$(which python)` to be Python 3
as soon as that doesn't induce nasty breakage

-- 
 .''`.  Paul Tagliamonte <paultag@debian.org>
: :'  : Proud Debian Developer
`. `'`  4096R / FEF2 EB20 16E6 A856 B98C E820 2DCD 6B5D E858 ADF3
 `-     http://people.debian.org/~paultag

[toc] | [prev] | [next] | [standalone]


#12743

FromOndrej Novy <novy@ondrej.org>
Date2020-07-09 21:50 +0200
Message-ID<AqKIp-78B-1@gated-at.bofh.it>
In reply to#12739

[Multipart message — attachments visible in raw view] — view raw

Hi,

čt 9. 7. 2020 v 15:27 odesílatel Matthias Klose <doko@debian.org> napsal:

> Describing here a solution which is implemented for Ubuntu focal (20.04
> LTS).  A
> new source package what-is-python (-perl-dont-hurt-me) ships binary
> packages
> python-is-python2, python-dev-is-python2, python-is-python3 and
> python-dev-is-python3.  The python-is-python2 package provides the python
> package, such that packages that still depend on python are not removed on
> a
> distro upgrade.  On new installs, python-is-python3 is not installed by
> default,
> but the user gets a hint from command-not-found to install the package if
> he
> tries to run python.  Package dependencies on the new four binary packages
> have
> to be disallowed in the Python policy.  Note that such a package including
> the
> Provides should only be uploaded once all dependencies on the unversioned
> python
> packages are gone.
>

I like this solution in Ubuntu and I have:
onovy@jupiter:~$ dpkg -l | grep python-is-python3
ii  python-is-python3                          3.8.2-4
          all          symlinks /usr/bin/python to python3

What I think is good idea:
* keep "python" command pointing to python2.7 if I'm upgrading
buster->bullseye with python2.7 installed. We are going to keep python2.7
interpreter for bullseye, so don't break old "python" command for
third-parties apps/scripts/etc. (install python-is-python2 during
buster->bullseye upgrade)
* allow users to choose if they want python=python3 (apt install
python-is-python3)
* (maybe?) python=python3 in new installs, because why not? (install
python-is-python3 by default in clean install)

-- 
Best regards
 Ondřej Nový

[toc] | [prev] | [next] | [standalone]


#12756

FromFabrice BAUZAC-STEHLY <noon@mykolab.com>
Date2020-07-13 18:30 +0200
Message-ID<As9v3-25Z-5@gated-at.bofh.it>
In reply to#12743
Hi,

Another solution would be to simply use the update-alternatives system
to manage /usr/bin/python.  python3 would have a higher priority than
python2.  Users would still have the possibility to switch
/usr/bin/python to python2 explicitly if they require it...

--
Fabrice BAUZAC-STEHLY
PGP 015AE9B25DCB0511D200A75DE5674DEA514C891D

[toc] | [prev] | [next] | [standalone]


#12757

FromMatthias Klose <doko@debian.org>
Date2020-07-13 19:30 +0200
Message-ID<Asar7-2Ge-5@gated-at.bofh.it>
In reply to#12756
On 7/13/20 6:23 PM, Fabrice BAUZAC-STEHLY wrote:
> Hi,
> 
> Another solution would be to simply use the update-alternatives system
> to manage /usr/bin/python.  python3 would have a higher priority than
> python2.  Users would still have the possibility to switch
> /usr/bin/python to python2 explicitly if they require it...

No, never ever. update-alternatives cannot be used because it breaks the
dependency system.

[toc] | [prev] | [next] | [standalone]


#12758

FromOndrej Novy <novy@ondrej.org>
Date2020-07-14 11:00 +0200
Message-ID<AsoX7-2VA-1@gated-at.bofh.it>
In reply to#12757

[Multipart message — attachments visible in raw view] — view raw

Hi,

po 13. 7. 2020 v 19:21 odesílatel Matthias Klose <doko@debian.org> napsal:

> On 7/13/20 6:23 PM, Fabrice BAUZAC-STEHLY wrote:
> > Hi,
> >
> > Another solution would be to simply use the update-alternatives system
> > to manage /usr/bin/python.  python3 would have a higher priority than
> > python2.  Users would still have the possibility to switch
> > /usr/bin/python to python2 explicitly if they require it...
>
> No, never ever. update-alternatives cannot be used because it breaks the
> dependency system.
>

no, it doesn't. If all Python2 packages will use /usr/bin/python2 and all
Python3 packages will use /usr/bin/python3, then /usr/bin/python can be
managed by update-alternatives. And because we really want all Python2
packages to use /usr/bin/python2, I think this is a viable option.

But TBH I don't think it's a good idea, because it can be confusing for
users.

-- 
Best regards
 Ondřej Nový

[toc] | [prev] | [next] | [standalone]


#12759

FromPiotr Ożarowski <piotr@debian.org>
Date2020-07-14 11:20 +0200
Message-ID<Aspgt-3hj-1@gated-at.bofh.it>
In reply to#12758
FTR: I didn't change my mind. /usr/bin/python is still used outside
Debian packages, in /usr/local/bin scripts and applications and I
strongly disagree to touch it.
-- 
GPG: 1D2F A898 58DA AF62 1786 2DF7 AEF6 F1A2 A745 7645

[toc] | [prev] | [next] | [standalone]


#12775

FromRene Engelhard <rene.engelhard@mailbox.org>
Date2020-07-18 08:50 +0200
Message-ID<AtOPv-6jD-3@gated-at.bofh.it>
In reply to#12759
Hi,

Am 14.07.20 um 11:00 schrieb Piotr Ożarowski:
> FTR: I didn't change my mind. /usr/bin/python is still used outside
> Debian packages, in /usr/local/bin scripts and applications and I
> strongly disagree to touch it.

Unfortunately (at least if I remember correctly I came up with an
example of this lately...) also new stuff does #!/usr/bin/python and
assumes it is python3...


Do some distros set /usr/bin/python to python 3?


Honestly, I think /usr/local/bin scripts then should simply be fixed by
the admin.


It's not as if they had years to do so.


Regards,


Rene

[toc] | [prev] | [next] | [standalone]


#12776

FromSebastian Humenda <shumenda@gmx.de>
Date2020-07-18 10:30 +0200
Message-ID<AtQoh-7j1-1@gated-at.bofh.it>
In reply to#12775

[Multipart message — attachments visible in raw view] — view raw

Hi

Rene Engelhard schrieb am 18.07.2020,  8:26 +0200:
>Am 14.07.20 um 11:00 schrieb Piotr Ożarowski:
>> FTR: I didn't change my mind. /usr/bin/python is still used outside
>> Debian packages, in /usr/local/bin scripts and applications and I
>> strongly disagree to touch it.
>
>Unfortunately (at least if I remember correctly I came up with an
>example of this lately...) also new stuff does #!/usr/bin/python and
>assumes it is python3...
>
>
>Do some distros set /usr/bin/python to python 3?

Yup, Arch does. From the wiki: https://wiki.archlinux.org/index.php/Python

Any program requiring Python 2 needs to point to /usr/bin/python2, instead of
/usr/bin/python, which points to Python 3. 

Cheers
Sebastian

[toc] | [prev] | [next] | [standalone]


#12777

Fromdebacle@debian.org
Date2020-07-18 10:40 +0200
Message-ID<AtQxX-7lX-3@gated-at.bofh.it>
In reply to#12776
On 2020-07-18 10:26, Sebastian Humenda wrote:
> Rene Engelhard schrieb am 18.07.2020,  8:26 +0200:
> >Do some distros set /usr/bin/python to python 3?
> 
> Yup, Arch does. From the wiki: https://wiki.archlinux.org/index.php/Python
> 
> Any program requiring Python 2 needs to point to /usr/bin/python2, instead of
> /usr/bin/python, which points to Python 3. 

I wonder, what they do, if there will be a Python 4...

[toc] | [prev] | [next] | [standalone]


#12778

FromDmitry Shachnev <mitya57@debian.org>
Date2020-07-18 11:30 +0200
Message-ID<AtRkl-7Rd-3@gated-at.bofh.it>
In reply to#12777

[Multipart message — attachments visible in raw view] — view raw

On Sat, Jul 18, 2020 at 10:35:03AM +0200, debacle@debian.org wrote:
> > Yup, Arch does. From the wiki: https://wiki.archlinux.org/index.php/Python
> >
> > Any program requiring Python 2 needs to point to /usr/bin/python2, instead of
> > /usr/bin/python, which points to Python 3. 
>
> I wonder, what they do, if there will be a Python 4...

AFAIK Python 4 is not planned even in long term (e.g. because that would break
a lot of programs that rely on sys.version_info.major):

https://www.python.org/dev/peps/pep-0602/

--
Dmitry Shachnev

[toc] | [prev] | [next] | [standalone]


#12771

FromSandro Tosi <morph@debian.org>
Date2020-07-16 18:10 +0200
Message-ID<AteCm-x7-25@gated-at.bofh.it>
In reply to#12739
> It seems to be a little bit more controversial what should happen to the python
> command in the long term.  Some people argue that python should never point to
> python3, because it's incompatible,

> however Debian will have difficulties to
> explain that decision to users who start with Python3 and are not aware of the 2
> to 3 transition.

can you explain this point? i think if a new developer starts with
python3 now (and i have plenty of examples at my company) they just
use `python3` on the commandline, shebangs, venv, etc. I dont see the
confusion we would create.

> So yes, in the long term, Debian should have a python command
> again.

I dont think that's the right decision. PEP 0394
(https://www.python.org/dev/peps/pep-0394/) allows distribution not to
ship `python` at all:

https://www.python.org/dev/peps/pep-0394/#for-python-runtime-distributors

* If the python command is installed, it is expected to invoke either
the same version of Python as the python3 command or as the python2
command.
* Distributors may choose to set the behavior of the python command as follows:
** python2,
** python3,
** not provide python command,
** allow python to be configurable by an end user or a system administrator.

> One solution could be not to ship the python command in bullseye, forcing users
> to adjust their local installations.

it is my opinion that that's what we should do: not ship `python` at
all and have users/packagers/developers use either python2 or python3
as needed, and not to reintroduce `python` at a later time.

Regards,
-- 
Sandro "morph" Tosi
My website: http://sandrotosi.me/
Me at Debian: http://wiki.debian.org/SandroTosi
Twitter: https://twitter.com/sandrotosi

[toc] | [prev] | [next] | [standalone]


#12881

From"Nicolas Dandrimont" <olasd@debian.org>
Date2020-09-17 15:20 +0200
Message-ID<AQ1Zo-1x2-15@gated-at.bofh.it>
In reply to#12739
Hi Matthias, others,

On Thu, Jul 9, 2020, at 15:26, Matthias Klose wrote:
> As written in [1], bullseye will not see unversioned python packages and the
> unversioned python command being built from the python-defaults package.
> 
> It seems to be a little bit more controversial what should happen to the python
> command in the long term.  Some people argue that python should never point to
> python3, because it's incompatible, however Debian will have difficulties to
> explain that decision to users who start with Python3 and are not aware of the 2
> to 3 transition.  So yes, in the long term, Debian should have a python command
> again.
> 
> One solution could be not to ship the python command in bullseye, forcing users
> to adjust their local installations.  This has the advantage that the error of
> an unknown interpreter should be pretty clear.  But leaves users without a
> python command for the next two years until bullseye+1.
> 
> Describing here a solution which is implemented for Ubuntu focal (20.04 LTS).  A
> new source package what-is-python (-perl-dont-hurt-me) ships binary packages
> python-is-python2, python-dev-is-python2, python-is-python3 and
> python-dev-is-python3.  The python-is-python2 package provides the python
> package, such that packages that still depend on python are not removed on a
> distro upgrade.  On new installs, python-is-python3 is not installed by default,
> but the user gets a hint from command-not-found to install the package if he
> tries to run python.  Package dependencies on the new four binary packages have
> to be disallowed in the Python policy.  Note that such a package including the
> Provides should only be uploaded once all dependencies on the unversioned python
> packages are gone.

So I see that the removal of `/usr/bin/python`-shipped-by-python-defaults has happened as planned. Thanks!

I've just got a friend ask me about what to do to get /usr/bin/python to point at python3; Do you have any plan of uploading what-is-python for use in bullseye, at least without the python-is-python2 Provides for python as a first step (to keep the current "breakage")?

In any case I think the python packaging policy at https://www.debian.org/doc/packaging-manuals/python-policy/ch-python.html should get an update to match the current status quo related to /usr/bin/python; My friend looked at it and were confused not to find a /usr/bin/python anymore.

Thanks,
-- 
Nicolas Dandrimont

[toc] | [prev] | [next] | [standalone]


#12882

FromMatthias Klose <doko@debian.org>
Date2020-09-17 15:40 +0200
Message-ID<AQ2iJ-1E3-13@gated-at.bofh.it>
In reply to#12881
On 9/17/20 3:04 PM, Nicolas Dandrimont wrote:
> Hi Matthias, others,
> 
> On Thu, Jul 9, 2020, at 15:26, Matthias Klose wrote:
>> As written in [1], bullseye will not see unversioned python packages and the
>> unversioned python command being built from the python-defaults package.
>>
>> It seems to be a little bit more controversial what should happen to the python
>> command in the long term.  Some people argue that python should never point to
>> python3, because it's incompatible, however Debian will have difficulties to
>> explain that decision to users who start with Python3 and are not aware of the 2
>> to 3 transition.  So yes, in the long term, Debian should have a python command
>> again.
>>
>> One solution could be not to ship the python command in bullseye, forcing users
>> to adjust their local installations.  This has the advantage that the error of
>> an unknown interpreter should be pretty clear.  But leaves users without a
>> python command for the next two years until bullseye+1.
>>
>> Describing here a solution which is implemented for Ubuntu focal (20.04 LTS).  A
>> new source package what-is-python (-perl-dont-hurt-me) ships binary packages
>> python-is-python2, python-dev-is-python2, python-is-python3 and
>> python-dev-is-python3.  The python-is-python2 package provides the python
>> package, such that packages that still depend on python are not removed on a
>> distro upgrade.  On new installs, python-is-python3 is not installed by default,
>> but the user gets a hint from command-not-found to install the package if he
>> tries to run python.  Package dependencies on the new four binary packages have
>> to be disallowed in the Python policy.  Note that such a package including the
>> Provides should only be uploaded once all dependencies on the unversioned python
>> packages are gone.
> 
> So I see that the removal of `/usr/bin/python`-shipped-by-python-defaults has happened as planned. Thanks!
> 
> I've just got a friend ask me about what to do to get /usr/bin/python to point at python3; Do you have any plan of uploading what-is-python for use in bullseye, at least without the python-is-python2 Provides for python as a first step (to keep the current "breakage")?
> 
> In any case I think the python packaging policy at https://www.debian.org/doc/packaging-manuals/python-policy/ch-python.html should get an update to match the current status quo related to /usr/bin/python; My friend looked at it and were confused not to find a /usr/bin/python anymore.

the what-is-python package is now in NEW.  Yes, the policy needs an update.
I'll put that on my TODO list.  If there is too much disagreement about the
python-is-python3 package, then I plan to run it via the CTTE, and ask for an
advice how to move on.

Matthias

[toc] | [prev] | [next] | [standalone]


#13243

FromMatthias Klose <doko@debian.org>
Date2021-03-02 10:50 +0100
Message-ID<BO9Pb-1UD-3@gated-at.bofh.it>
In reply to#12739
I am appending the following two sections to the python policy chapter 2,
documenting what currently is in testing.  There are different opinions, no
perfect solutions, and if we disagree, we should delegate the final decision
whether to include or to not include the binary packages
python{,-dev}-is-python3 built from the what-is-python source to the CTTE.

Matthias

+Removal of the unversioned packages
+-----------------------------------
+
+Starting with the Debian 11 release (bullseye), the binary packages
+``python``, ``python-minimal``, ``python-dev``, ``python-dbg`` and
+``python-doc`` are removed.  No package in the archive must use any of
+these packages as build dependencies, dependencies, recommendations or
+suggestions.
+
+
+Unversioned python commands
+---------------------------
+
+For the Debian 11 release (bullseye), the :file:`/usr/bin/python`
+command is provided in the ``python-is-python2`` package (pointing to
+:file:`/usr/bin/python2`).  The :file:`/usr/bin/python-config` and
+:file:`/usr/bin/pydoc` commands are provided in the
+``python-dev-is-python2`` package.  These package are not installed by
+default for new installations, but only for upgrades from the Debian
+10 release (buster).  These packages should be removed after an
+upgrade.  These packages will not be part of the Debian 12 release
+(bookworm).
+
+The packages ``python-is-python3`` and ``python-dev-is-python3``
+provide the :file:`/usr/bin/python`, :file:`/usr/bin/python-config`
+and :file:`/usr/bin/pydoc` commands pointing to Python3.  These
+packages can be installed by developers and users to use the
+unversioned commands.  NOTE: Locally installed software not yet ported
+to Python3 is likely to break when installing these packages.
+
+The packages ``python-is-python3``, ``python-dev-is-python3``,
+``python-is-python2`` and ``python-dev-is-python2`` must not be used
+as build dependencies, dependencies, recommendations or suggestions.

[toc] | [prev] | [standalone]


Back to top | Article view | linux.debian.maint.python


csiph-web