unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* python-mode: Why python-interpreter defaults to "python" instead of looking for python/python3
@ 2023-03-08 14:03 Martín Fernández
  2023-03-08 19:41 ` Augusto Stoffel
  0 siblings, 1 reply; 9+ messages in thread
From: Martín Fernández @ 2023-03-08 14:03 UTC (permalink / raw)
  To: emacs-devel

Hey,

I'm wondering why there is no logic to find the latest python
executable installed (python vs python3) when setting
`python-interpreter`, as it is done with `python-shell-interpreter`.

I think it should be added, but since it is a straightforward change I
assume there are reasons for it. Otherwise I'm happy to send a patch.

Thanks.

-- 
Martín



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: python-mode: Why python-interpreter defaults to "python" instead of looking for python/python3
  2023-03-08 14:03 python-mode: Why python-interpreter defaults to "python" instead of looking for python/python3 Martín Fernández
@ 2023-03-08 19:41 ` Augusto Stoffel
  2023-03-16 10:09   ` Augusto Stoffel
  0 siblings, 1 reply; 9+ messages in thread
From: Augusto Stoffel @ 2023-03-08 19:41 UTC (permalink / raw)
  To: Martín Fernández; +Cc: emacs-devel

On Wed,  8 Mar 2023 at 11:03, Martín Fernández wrote:

> Hey,
>
> I'm wondering why there is no logic to find the latest python
> executable installed (python vs python3) when setting
> `python-interpreter`, as it is done with `python-shell-interpreter`.
>
> I think it should be added, but since it is a straightforward change I
> assume there are reasons for it. Otherwise I'm happy to send a patch.
>
> Thanks.

IMO the logic to choose `python-shell-interpreter' is misguided.  The
default value should be just "python", since if you are doing anything
with Python and "python" doesn't point to the right version, then you
are in trouble anyway.  OTOH, if you really need to work with Python 2
and symlink "python" accordingly then the current default proactively
puts you in trouble.

Personally I'd be happy to see a patch fixing `python-shell-interpreter'.



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: python-mode: Why python-interpreter defaults to "python" instead of looking for python/python3
  2023-03-08 19:41 ` Augusto Stoffel
@ 2023-03-16 10:09   ` Augusto Stoffel
  2023-03-16 10:18     ` Philip Kaludercic
  0 siblings, 1 reply; 9+ messages in thread
From: Augusto Stoffel @ 2023-03-16 10:09 UTC (permalink / raw)
  To: Martín Fernández; +Cc: emacs-devel

Hi again Martín,

On Wed,  8 Mar 2023 at 20:41, Augusto Stoffel wrote:

> On Wed,  8 Mar 2023 at 11:03, Martín Fernández wrote:
>
>> Hey,
>>
>> I'm wondering why there is no logic to find the latest python
>> executable installed (python vs python3) when setting
>> `python-interpreter`, as it is done with `python-shell-interpreter`.
>>
>> I think it should be added, but since it is a straightforward change I
>> assume there are reasons for it. Otherwise I'm happy to send a patch.

Can you expand a bit on why you think so?  I just noticed that Debian
doesn't provide a `python' command by default, so indeed some logic
might be needed.  But then it should look for python, then python3, and
finally fall back to python.  Still, doing so has its downsides, as I
mentioned in my previous message.

> IMO the logic to choose `python-shell-interpreter' is misguided.  The
> default value should be just "python", since if you are doing anything
> with Python and "python" doesn't point to the right version, then you
> are in trouble anyway.  OTOH, if you really need to work with Python 2
> and symlink "python" accordingly then the current default proactively
> puts you in trouble.
>
> Personally I'd be happy to see a patch fixing `python-shell-interpreter'.



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: python-mode: Why python-interpreter defaults to "python" instead of looking for python/python3
  2023-03-16 10:09   ` Augusto Stoffel
@ 2023-03-16 10:18     ` Philip Kaludercic
  2023-03-16 14:29       ` Martín Fernández
  2023-03-16 18:17       ` Augusto Stoffel
  0 siblings, 2 replies; 9+ messages in thread
From: Philip Kaludercic @ 2023-03-16 10:18 UTC (permalink / raw)
  To: Augusto Stoffel; +Cc: Martín Fernández, emacs-devel

Augusto Stoffel <arstoffel@gmail.com> writes:

> Hi again Martín,
>
> On Wed,  8 Mar 2023 at 20:41, Augusto Stoffel wrote:
>
>> On Wed,  8 Mar 2023 at 11:03, Martín Fernández wrote:
>>
>>> Hey,
>>>
>>> I'm wondering why there is no logic to find the latest python
>>> executable installed (python vs python3) when setting
>>> `python-interpreter`, as it is done with `python-shell-interpreter`.
>>>
>>> I think it should be added, but since it is a straightforward change I
>>> assume there are reasons for it. Otherwise I'm happy to send a patch.
>
> Can you expand a bit on why you think so?  I just noticed that Debian
> doesn't provide a `python' command by default, so indeed some logic
> might be needed.  

That depends on your version.  According to [0], Debian 11 has a package
called "python2-is-python" that just create a symlink between python and
python2.  This has been removed with Debian 12, now you'd have to
install python-is-python3 to have python symlink'ed to python3.

[0] https://wiki.debian.org/Python/FAQ#Python_2_support

>                   
>                   But then it should look for python, then python3, and
> finally fall back to python.  Still, doing so has its downsides, as I
> mentioned in my previous message.
>
>> IMO the logic to choose `python-shell-interpreter' is misguided.  The
>> default value should be just "python", since if you are doing anything
>> with Python and "python" doesn't point to the right version, then you
>> are in trouble anyway.  OTOH, if you really need to work with Python 2
>> and symlink "python" accordingly then the current default proactively
>> puts you in trouble.
>>
>> Personally I'd be happy to see a patch fixing `python-shell-interpreter'.



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: python-mode: Why python-interpreter defaults to "python" instead of looking for python/python3
  2023-03-16 10:18     ` Philip Kaludercic
@ 2023-03-16 14:29       ` Martín Fernández
  2023-03-16 18:13         ` Augusto Stoffel
  2023-03-16 18:17       ` Augusto Stoffel
  1 sibling, 1 reply; 9+ messages in thread
From: Martín Fernández @ 2023-03-16 14:29 UTC (permalink / raw)
  To: Philip Kaludercic; +Cc: Augusto Stoffel, emacs-devel

On 3/16/23, Philip Kaludercic <philipk@posteo.net> wrote:
> Augusto Stoffel <arstoffel@gmail.com> writes:
>
>> Hi again Martín,
>>
>> On Wed,  8 Mar 2023 at 20:41, Augusto Stoffel wrote:
>>
>>> On Wed,  8 Mar 2023 at 11:03, Martín Fernández wrote:
>>>
>>>> Hey,
>>>>
>>>> I'm wondering why there is no logic to find the latest python
>>>> executable installed (python vs python3) when setting
>>>> `python-interpreter`, as it is done with `python-shell-interpreter`.
>>>>
>>>> I think it should be added, but since it is a straightforward change I
>>>> assume there are reasons for it. Otherwise I'm happy to send a patch.
>>
>> Can you expand a bit on why you think so?  I just noticed that Debian
>> doesn't provide a `python' command by default, so indeed some logic
>> might be needed.

I think because it's already done for the interpreter variable, why is
that different? And yes, I'm a debian user, and `python` runs python2.
So yes, it's consistency and convince (for me).

But to be honest, the more I think about it, the more I think that it
should be set on a per project basis. But again, then I would remove
the logic on the interpreter variable and just default to "python", as
you mentioned.

What do you think? Do you know what the history is for the logic on
the interpreter variable and why it wasn't implemented on the cmdline
variable?

>
> That depends on your version.  According to [0], Debian 11 has a package
> called "python2-is-python" that just create a symlink between python and
> python2.  This has been removed with Debian 12, now you'd have to
> install python-is-python3 to have python symlink'ed to python3.
>
> [0] https://wiki.debian.org/Python/FAQ#Python_2_support
>

Oh I didn't know that! Thank you!

>>
>>                   But then it should look for python, then python3, and
>> finally fall back to python.  Still, doing so has its downsides, as I
>> mentioned in my previous message.
>>
>>> IMO the logic to choose `python-shell-interpreter' is misguided.  The
>>> default value should be just "python", since if you are doing anything
>>> with Python and "python" doesn't point to the right version, then you
>>> are in trouble anyway.  OTOH, if you really need to work with Python 2
>>> and symlink "python" accordingly then the current default proactively
>>> puts you in trouble.
>>>
>>> Personally I'd be happy to see a patch fixing
>>> `python-shell-interpreter'.
>



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: python-mode: Why python-interpreter defaults to "python" instead of looking for python/python3
  2023-03-16 14:29       ` Martín Fernández
@ 2023-03-16 18:13         ` Augusto Stoffel
  0 siblings, 0 replies; 9+ messages in thread
From: Augusto Stoffel @ 2023-03-16 18:13 UTC (permalink / raw)
  To: Martín Fernández, Glenn Morris; +Cc: Philip Kaludercic, emacs-devel

On Thu, 16 Mar 2023 at 11:29, Martín Fernández wrote:

> What do you think? Do you know what the history is for the logic on
> the interpreter variable and why it wasn't implemented on the cmdline
> variable?

I've included Glen, who implemented the logic in bug#45655.  I now see
that in that ticket Stefan made exactly the same points I made here.
Namely:

>>>> IMO the logic to choose `python-shell-interpreter' is misguided.  The
>>>> default value should be just "python", since if you are doing anything
>>>> with Python and "python" doesn't point to the right version, then you
>>>> are in trouble anyway.  OTOH, if you really need to work with Python 2
>>>> and symlink "python" accordingly then the current default proactively
>>>> puts you in trouble.
>>>>
>>>> Personally I'd be happy to see a patch fixing
>>>> `python-shell-interpreter'.



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: python-mode: Why python-interpreter defaults to "python" instead of looking for python/python3
  2023-03-16 10:18     ` Philip Kaludercic
  2023-03-16 14:29       ` Martín Fernández
@ 2023-03-16 18:17       ` Augusto Stoffel
  2023-03-16 18:45         ` Yuri Khan
  1 sibling, 1 reply; 9+ messages in thread
From: Augusto Stoffel @ 2023-03-16 18:17 UTC (permalink / raw)
  To: Philip Kaludercic; +Cc: Martín Fernández, emacs-devel

On Thu, 16 Mar 2023 at 10:18, Philip Kaludercic wrote:

> That depends on your version.  According to [0], Debian 11 has a package
> called "python2-is-python" that just create a symlink between python and
> python2.  This has been removed with Debian 12, now you'd have to
> install python-is-python3 to have python symlink'ed to python3.
>
> [0] https://wiki.debian.org/Python/FAQ#Python_2_support

I would like to understand why python-is-python3 is not installed by
default nowadays.  It is in Fedora, for instance.



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: python-mode: Why python-interpreter defaults to "python" instead of looking for python/python3
  2023-03-16 18:17       ` Augusto Stoffel
@ 2023-03-16 18:45         ` Yuri Khan
  2023-03-17 19:32           ` chad
  0 siblings, 1 reply; 9+ messages in thread
From: Yuri Khan @ 2023-03-16 18:45 UTC (permalink / raw)
  To: Augusto Stoffel
  Cc: Philip Kaludercic, Martín Fernández, emacs-devel

On Fri, 17 Mar 2023 at 01:18, Augusto Stoffel <arstoffel@gmail.com> wrote:

> I would like to understand why python-is-python3 is not installed by
> default nowadays.  It is in Fedora, for instance.

As far as I understand, Debian is trying to provide a very gentle
transition period for users, and enforces explicit python versioning
in all its packages. It also encourages developers to specify
explicitly python2 or python3 by not shipping the /usr/bin/python link
by default (except for upgrades from older distro versions).

Maybe one day we can say there is only one Python version. But today
is not that  day.



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: python-mode: Why python-interpreter defaults to "python" instead of looking for python/python3
  2023-03-16 18:45         ` Yuri Khan
@ 2023-03-17 19:32           ` chad
  0 siblings, 0 replies; 9+ messages in thread
From: chad @ 2023-03-17 19:32 UTC (permalink / raw)
  To: Yuri Khan
  Cc: Augusto Stoffel, Philip Kaludercic, Martín Fernández,
	emacs-devel

[-- Attachment #1: Type: text/plain, Size: 909 bytes --]

On Thu, Mar 16, 2023 at 2:46 PM Yuri Khan <yuri.v.khan@gmail.com> wrote:

> On Fri, 17 Mar 2023 at 01:18, Augusto Stoffel <arstoffel@gmail.com> wrote:
>
> > I would like to understand why python-is-python3 is not installed by
> > default nowadays.  It is in Fedora, for instance.
>
> As far as I understand, Debian is trying to provide a very gentle
> transition period for users, and enforces explicit python versioning
> in all its packages. It also encourages developers to specify
> explicitly python2 or python3 by not shipping the /usr/bin/python link
> by default (except for upgrades from older distro versions).
>
> Maybe one day we can say there is only one Python version. But today
> is not that  day.
>

FWIW: I'm running Debian 11, and there is no "python" by default. There is
a python3 included in the base, and there is NOT a python2 included in
same, under any name.

Hope that helps,
~Chad

[-- Attachment #2: Type: text/html, Size: 1398 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2023-03-17 19:32 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-08 14:03 python-mode: Why python-interpreter defaults to "python" instead of looking for python/python3 Martín Fernández
2023-03-08 19:41 ` Augusto Stoffel
2023-03-16 10:09   ` Augusto Stoffel
2023-03-16 10:18     ` Philip Kaludercic
2023-03-16 14:29       ` Martín Fernández
2023-03-16 18:13         ` Augusto Stoffel
2023-03-16 18:17       ` Augusto Stoffel
2023-03-16 18:45         ` Yuri Khan
2023-03-17 19:32           ` chad

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).