[PATCH] nmbug: explicitly prefer python3

classic Classic list List threaded Threaded
9 messages Options
Daniel Kahn Gillmor Daniel Kahn Gillmor
Reply | Threaded
Open this post in threaded view
|

[PATCH] nmbug: explicitly prefer python3

nmbug and notmuch-report are developer tools.  It's 2018, and all
developers should have python3 available.

Signed-off-by: Daniel Kahn Gillmor <[hidden email]>
---
 devel/nmbug/nmbug          | 2 +-
 devel/nmbug/notmuch-report | 5 ++---
 2 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/devel/nmbug/nmbug b/devel/nmbug/nmbug
index c35dd75d..043c1863 100755
--- a/devel/nmbug/nmbug
+++ b/devel/nmbug/nmbug
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
 #
 # Copyright (c) 2011-2014 David Bremner <[hidden email]>
 #                         W. Trevor King <[hidden email]>
diff --git a/devel/nmbug/notmuch-report b/devel/nmbug/notmuch-report
index a9c2a6ec..a4c13939 100755
--- a/devel/nmbug/notmuch-report
+++ b/devel/nmbug/notmuch-report
@@ -1,10 +1,9 @@
-#!/usr/bin/python
+#!/usr/bin/env python3
 #
 # Copyright (c) 2011-2012 David Bremner <[hidden email]>
 #
 # dependencies
-#       - python 2.6 for json
-#       - argparse; either python 2.7, or install separately
+#       - python3 or python2.7
 #
 # This program is free software: you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
--
2.15.1

_______________________________________________
notmuch mailing list
[hidden email]
https://notmuchmail.org/mailman/listinfo/notmuch
W. Trevor King W. Trevor King
Reply | Threaded
Open this post in threaded view
|

Re: [PATCH] nmbug: explicitly prefer python3

On Thu, Feb 08, 2018 at 11:32:11PM -0500, Daniel Kahn Gillmor wrote:
> nmbug and notmuch-report are developer tools.  It's 2018, and all
> developers should have python3 available.

From PEP 394 [1]:

  One exception to this is scripts that are deliberately written to be
  source compatible with both Python 2.x and 3.x.  Such scripts may
  continue to use python on their shebang line without affecting their
  portability.

So while everyone who uses nmbug may have python3, I don't see a need
to pick sides.  Is there something using python3 gets you for nmbug
that you miss with python2?

Cheers,
Trevor

[1]: https://www.python.org/dev/peps/pep-0394/#recommendation

--
This email may be signed or encrypted with GnuPG (http://www.gnupg.org).
For more information, see http://en.wikipedia.org/wiki/Pretty_Good_Privacy

_______________________________________________
notmuch mailing list
[hidden email]
https://notmuchmail.org/mailman/listinfo/notmuch

signature.asc (849 bytes) Download Attachment
Daniel Kahn Gillmor Daniel Kahn Gillmor
Reply | Threaded
Open this post in threaded view
|

Re: [PATCH] nmbug: explicitly prefer python3

On Fri 2018-02-09 09:12:57 -0800, W. Trevor King wrote:

> On Thu, Feb 08, 2018 at 11:32:11PM -0500, Daniel Kahn Gillmor wrote:
>> nmbug and notmuch-report are developer tools.  It's 2018, and all
>> developers should have python3 available.
>
> From PEP 394 [1]:
>
>   One exception to this is scripts that are deliberately written to be
>   source compatible with both Python 2.x and 3.x.  Such scripts may
>   continue to use python on their shebang line without affecting their
>   portability.
>
> So while everyone who uses nmbug may have python3, I don't see a need
> to pick sides.  Is there something using python3 gets you for nmbug
> that you miss with python2?

Yep, i get to remove python 2 from my operating system :)

Smaller installed codebase, fewer bugs.  There are only two outstanding
holdovers for me, and nmbug is one of them.

     --dkg
_______________________________________________
notmuch mailing list
[hidden email]
https://notmuchmail.org/mailman/listinfo/notmuch
W. Trevor King W. Trevor King
Reply | Threaded
Open this post in threaded view
|

Re: [PATCH] nmbug: explicitly prefer python3

On Fri, Feb 09, 2018 at 01:36:48PM -0500, Daniel Kahn Gillmor wrote:
> > Is there something using python3 gets you for nmbug that you miss
> > with python2?
>
> Yep, i get to remove python 2 from my operating system :)
>
> Smaller installed codebase, fewer bugs.  There are only two
> outstanding holdovers for me, and nmbug is one of them.

From later on in PEP 394 [1]:

  It is anticipated that there will eventually come a time where the
  third party ecosystem surrounding Python 3 is sufficiently mature
  for this recommendation to be updated to suggest that the python
  symlink refer to python3 rather than python2.

And from right up at the beginning [2]:

  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.

On my Gentoo system, I've also selected Python 3 to back ‘python’.  So
I think your solution should be “add a /usr/bin/python symlink to your
python3”, not “claim that nmbug is only compatible with Python 3”.

Cheers,
Trevor

[1]: https://www.python.org/dev/peps/pep-0394/#future-changes-to-this-recommendation
[2]: https://www.python.org/dev/peps/pep-0394/#abstract

--
This email may be signed or encrypted with GnuPG (http://www.gnupg.org).
For more information, see http://en.wikipedia.org/wiki/Pretty_Good_Privacy

_______________________________________________
notmuch mailing list
[hidden email]
https://notmuchmail.org/mailman/listinfo/notmuch

signature.asc (849 bytes) Download Attachment
Daniel Kahn Gillmor Daniel Kahn Gillmor
Reply | Threaded
Open this post in threaded view
|

Re: [PATCH] nmbug: explicitly prefer python3

On Fri 2018-02-09 12:46:24 -0800, W. Trevor King wrote:

> From later on in PEP 394 [1]:
>
>   It is anticipated that there will eventually come a time where the
>   third party ecosystem surrounding Python 3 is sufficiently mature
>   for this recommendation to be updated to suggest that the python
>   symlink refer to python3 rather than python2.
>
> And from right up at the beginning [2]:
>
>   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.
>
> On my Gentoo system, I've also selected Python 3 to back ‘python’.  So
> I think your solution should be “add a /usr/bin/python symlink to your
> python3”, not “claim that nmbug is only compatible with Python 3”.
Presumably you still have /usr/bin/python3 in addition to
/usr/bin/python as well.  So the one thing i think we're both agreeing
on is that we use nmbug with python 3.

It looks to me like you're asking me to change my operating system to
accomodate your naming preference.  I'm asking that we put the onus on
developers who really insist on using nmbug with python 2.7 maintain
their own local patch against nmbug, rather than other developers either
modifying their local operating system in potentially disastrous ways
(/usr/bin/python as python3 would cause severe breakage for at least one
python2-only tool i rely on daily, sadly) or carrying their own local
patch against nmbug.  Given that you and i both expect most notmuch
developers to run nmbug against python3 anyway, i can't understand the
allergic reaction to the suggestion that the smaller pool of developers
(those devoted to python2-only systems) be the one to carry the local
patch.

Anyway, I had no idea that this request for something that i think we
fundamentally agree on would cause any controversy, especially given the
expected size and technical sophistication of the nmbug userbase.

i'll drop this request now because i don't understand the origin of the
strength of your reaction, and already wish i'd spent the time i've lost
on it on something more productive :( I hope if you change your mind
you'll come back and recommend it here.

demotivatedly yours,

              --dkg

_______________________________________________
notmuch mailing list
[hidden email]
https://notmuchmail.org/mailman/listinfo/notmuch

signature.asc (233 bytes) Download Attachment
W. Trevor King W. Trevor King
Reply | Threaded
Open this post in threaded view
|

Re: [PATCH] nmbug: explicitly prefer python3

On Sun, Feb 11, 2018 at 10:56:36PM -0500, Daniel Kahn Gillmor wrote:

> On Fri 2018-02-09 12:46:24 -0800, W. Trevor King wrote:
> > From later on in PEP 394 [1]:
> >
> >   It is anticipated that there will eventually come a time where
> >   the third party ecosystem surrounding Python 3 is sufficiently
> >   mature for this recommendation to be updated to suggest that the
> >   python symlink refer to python3 rather than python2.
> >
> > And from right up at the beginning [2]:
> >
> >   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.
> >
> > On my Gentoo system, I've also selected Python 3 to back ‘python’.
> > So I think your solution should be “add a /usr/bin/python symlink
> > to your python3”, not “claim that nmbug is only compatible with
> > Python 3”.
>
> Presumably you still have /usr/bin/python3 in addition to
> /usr/bin/python as well.  So the one thing i think we're both
> agreeing on is that we use nmbug with python 3.
Yup.  But I'm not sure that is the case for all nmbug users.

> It looks to me like you're asking me to change my operating system
> to accomodate your naming preference.

No, I'm asking you to change your operating system to accommodate PEP
394's naming preferences.  As PEP 394 points out, Arch made the switch
to using ‘python’ for ‘python3’ long ago.  You'd just be following
their lead.

> I'm asking that we put the onus on developers who really insist on
> using nmbug with python 2.7 maintain their own local patch against
> nmbug, rather than other developers either modifying their local
> operating system in potentially disastrous ways (/usr/bin/python as
> python3 would cause severe breakage for at least one python2-only
> tool i rely on daily, sadly)…

That Python-2-only tool should be using python2 in its shebang.  This
is exactly the sort of issue that PEP 394 was created to address.
Once you patch that tool to follow PEP 394, you should have no problem
adjusting your system to also follow PEP 394.

> … or carrying their own local patch against nmbug.

A shebang with ‘python’ should work with everyone (and it's what PEP
394 recommends for scripts that work with both Python major versions).
The only folks who would need a local patch would be folks with
systems like your current plan that contain no ‘python’ command at
all.  I see no upside to such systems, while I do see upsides to
systems with just a ‘python2’ (and a ‘python’ alias for it) or just a
‘python3’ (and a ‘python’ alias for it).

> i'll drop this request now because i don't understand the origin of
> the strength of your reaction, and already wish i'd spent the time
> i've lost on it on something more productive :( I hope if you change
> your mind you'll come back and recommend it here.

I like nmbug and have put some time into it.  But I'm not the notmuch
maintainer, and as you point out, nmbug would still work for me with a
python3 shebang.  So if the maintainers want to switch to python3 it's
no skin off my back.  They can always wait and field requests from any
python2-only users if/when those users file complaints (which may be
never).

Cheers,
Trevor

--
This email may be signed or encrypted with GnuPG (http://www.gnupg.org).
For more information, see http://en.wikipedia.org/wiki/Pretty_Good_Privacy

_______________________________________________
notmuch mailing list
[hidden email]
https://notmuchmail.org/mailman/listinfo/notmuch

signature.asc (849 bytes) Download Attachment
Tomi Ollila-2 Tomi Ollila-2
Reply | Threaded
Open this post in threaded view
|

Re: [PATCH] nmbug: explicitly prefer python3

On Mon, Feb 12 2018, W. Trevor King wrote:

> On Sun, Feb 11, 2018 at 10:56:36PM -0500, Daniel Kahn Gillmor wrote:
>> On Fri 2018-02-09 12:46:24 -0800, W. Trevor King wrote:
>> > From later on in PEP 394 [1]:
>> >
>> >   It is anticipated that there will eventually come a time where
>> >   the third party ecosystem surrounding Python 3 is sufficiently
>> >   mature for this recommendation to be updated to suggest that the
>> >   python symlink refer to python3 rather than python2.
>> >
>> > And from right up at the beginning [2]:
>> >
>> >   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.
>> >
>> > On my Gentoo system, I've also selected Python 3 to back ‘python’.
>> > So I think your solution should be “add a /usr/bin/python symlink
>> > to your python3”, not “claim that nmbug is only compatible with
>> > Python 3”.
>>
>> Presumably you still have /usr/bin/python3 in addition to
>> /usr/bin/python as well.  So the one thing i think we're both
>> agreeing on is that we use nmbug with python 3.
>
> Yup.  But I'm not sure that is the case for all nmbug users.
>
>> It looks to me like you're asking me to change my operating system
>> to accomodate your naming preference.
>
> No, I'm asking you to change your operating system to accommodate PEP
> 394's naming preferences.  As PEP 394 points out, Arch made the switch
> to using ‘python’ for ‘python3’ long ago.  You'd just be following
> their lead.
>
>> I'm asking that we put the onus on developers who really insist on
>> using nmbug with python 2.7 maintain their own local patch against
>> nmbug, rather than other developers either modifying their local
>> operating system in potentially disastrous ways (/usr/bin/python as
>> python3 would cause severe breakage for at least one python2-only
>> tool i rely on daily, sadly)…
>
> That Python-2-only tool should be using python2 in its shebang.  This
> is exactly the sort of issue that PEP 394 was created to address.
> Once you patch that tool to follow PEP 394, you should have no problem
> adjusting your system to also follow PEP 394.
>
>> … or carrying their own local patch against nmbug.
>
> A shebang with ‘python’ should work with everyone (and it's what PEP
> 394 recommends for scripts that work with both Python major versions).
> The only folks who would need a local patch would be folks with
> systems like your current plan that contain no ‘python’ command at
> all.  I see no upside to such systems, while I do see upsides to
> systems with just a ‘python2’ (and a ‘python’ alias for it) or just a
> ‘python3’ (and a ‘python’ alias for it).
>
>> i'll drop this request now because i don't understand the origin of
>> the strength of your reaction, and already wish i'd spent the time
>> i've lost on it on something more productive :( I hope if you change
>> your mind you'll come back and recommend it here.
>
> I like nmbug and have put some time into it.  But I'm not the notmuch
> maintainer, and as you point out, nmbug would still work for me with a
> python3 shebang.  So if the maintainers want to switch to python3 it's
> no skin off my back.  They can always wait and field requests from any
> python2-only users if/when those users file complaints (which may be
> never).

Thank you both for interesting read. Based on these I cannot say which
way this should go (personally I prefer faster conversion to python3
but perhaps that is not good readson to put python3 in hashbang).
In this case I value Trevor as valid notmuch maintainer as anyone
else who has done significant work for nmbug.

Tomi

>
> Cheers,
> Trevor
>
> --
> This email may be signed or encrypted with GnuPG (http://www.gnupg.org).
> For more information, see http://en.wikipedia.org/wiki/Pretty_Good_Privacy
_______________________________________________
notmuch mailing list
[hidden email]
https://notmuchmail.org/mailman/listinfo/notmuch
W. Trevor King W. Trevor King
Reply | Threaded
Open this post in threaded view
|

Re: [PATCH] nmbug: explicitly prefer python3

On Thu, Feb 15, 2018 at 07:37:53AM +0200, Tomi Ollila wrote:
> In this case I value Trevor as valid notmuch maintainer as anyone
> else who has done significant work for nmbug.

Thanks, but I don't think that should impact the decision for this
patch.  I'm just sharing my take, but the eventual decisions are up to
David (and others with push access to the main repo?).  I'll certainly
continue to contribute to nmbug if their decision is to use python3
shebangs ;).

Cheers,
Trevor

--
This email may be signed or encrypted with GnuPG (http://www.gnupg.org).
For more information, see http://en.wikipedia.org/wiki/Pretty_Good_Privacy

_______________________________________________
notmuch mailing list
[hidden email]
https://notmuchmail.org/mailman/listinfo/notmuch

signature.asc (849 bytes) Download Attachment
Daniel Kahn Gillmor Daniel Kahn Gillmor
Reply | Threaded
Open this post in threaded view
|

Re: [PATCH] nmbug: explicitly prefer python3

In reply to this post by W. Trevor King
On Mon 2018-02-12 09:53:33 -0800, W. Trevor King wrote:
> That Python-2-only tool should be using python2 in its shebang.  This
> is exactly the sort of issue that PEP 394 was created to address.

Thanks for the suggestion, i've asked them to do that:
https://bugs.debian.org/890282

> Once you patch that tool to follow PEP 394, you should have no problem
> adjusting your system to also follow PEP 394.

heh, that might be easier said than done, but i appreciate your
ambition.

        --dkg
_______________________________________________
notmuch mailing list
[hidden email]
https://notmuchmail.org/mailman/listinfo/notmuch