Re: The python command in Debian

2021-03-02 Thread Matthias Klose
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.



Re: The python command in Debian

2020-09-18 Thread Matthias Urlichs
On 17.09.20 15:26, Matthias Klose wrote:
> 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.

FWIW and IMHO that's a reasonable compromise.

-- 
-- Matthias Urlichs




signature.asc
Description: OpenPGP digital signature


Re: The python command in Debian

2020-09-17 Thread Matthias Klose
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



Re: The python command in Debian

2020-09-17 Thread Nicolas Dandrimont
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



Re: The python command in Debian

2020-07-18 Thread Dmitry Shachnev
On Sat, Jul 18, 2020 at 10:35:03AM +0200, deba...@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


signature.asc
Description: PGP signature


Re: The python command in Debian

2020-07-18 Thread debacle
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...



Re: The python command in Debian

2020-07-18 Thread Sebastian Humenda
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


signature.asc
Description: PGP signature


Re: The python command in Debian

2020-07-18 Thread Rene Engelhard
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



Re: The python command in Debian

2020-07-17 Thread Thomas Goirand
On 7/16/20 6:03 PM, Sandro Tosi wrote:
> 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.

I agree.

It's trivial for anyone to manually "fix" (or break?!?) a system to have
/usr/bin/python anyway, so let's not ship Debian as already broken. :)

Thomas



Re: The python command in Debian

2020-07-16 Thread Sandro Tosi
> 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



Re: The python command in Debian

2020-07-14 Thread Thomas Goirand
On 7/9/20 9:31 PM, Ondrej Novy wrote:
> * 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)

Please do break them. They are broken because they expect an interpreter
which we don't support anymore. So they MUST break. Leaving the distro
half-upgraded with the feeling that things are continuing to work is a
horrible design.

During the upgrade to bullseye, please do remove all things Python2,
including the interpreter, unless explicitly requested by the user (if
that's possible). If a user feels like he must install Python2, it must
be a manual decision (maybe after the upgrade and using /usr/local ?).
Otherwise, there's still Buster around for the next 4 years to come...

Cheers,

Thomas Goirand (zigo)



Re: The python command in Debian

2020-07-14 Thread Hans-Christoph Steiner


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.

Sometimes breaking things can be helpful.  If someone is not aware that
something still requires Python 2.x, having that script start failing
can often be helpful.  As long as Debian provides a way to make
/usr/bin/python point to 2.x, I think this kind of breakage will be
useful since it makes it clear that the user is relying on totally
unmaintained software.

Arch has been using /usr/bin/python for Python 3.x for a while now.

.hc



Re: The python command in Debian

2020-07-14 Thread 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.
-- 
GPG: 1D2F A898 58DA AF62 1786 2DF7 AEF6 F1A2 A745 7645



Re: The python command in Debian

2020-07-14 Thread Ondrej Novy
Hi,

po 13. 7. 2020 v 19:21 odesílatel Matthias Klose  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ý


Re: The python command in Debian

2020-07-13 Thread Matthias Klose
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.



Re: The python command in Debian

2020-07-13 Thread Fabrice BAUZAC-STEHLY
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



Re: The python command in Debian

2020-07-13 Thread Hans-Christoph Steiner



Ondrej Novy:
> Hi,
> 
> čt 9. 7. 2020 v 15:27 odesílatel Matthias Klose  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)
> 

I like this overall plan as laid out by Matthias.  And the above points
seem good, except I think it is a bad idea to keep 'python' pointing to
python2.7 on upgrade.  Python 2.7 is no longer maintained, and as
Matthias said, it should only be used as a Build-Depends for very
specific cases.  I think users should either be prompted with a
question, or should have to manually install python-is-python2.  We want
to help users leave Python 2.x behind, not pretend its still OK to use it.

.hc



Re: The python command in Debian

2020-07-09 Thread Ondrej Novy
Hi,

čt 9. 7. 2020 v 15:27 odesílatel Matthias Klose  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ý


Re: The python command in Debian

2020-07-09 Thread paultag
On Thu, Jul 09, 2020 at 04:55:33PM +, 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 
: :'  : Proud Debian Developer
`. `'`  4096R / FEF2 EB20 16E6 A856 B98C E820 2DCD 6B5D E858 ADF3
 `- http://people.debian.org/~paultag


signature.asc
Description: PGP signature


Re: The python command in Debian

2020-07-09 Thread Jeremy Stanley
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


signature.asc
Description: PGP signature