From asmeurer at gmail.com  Sun Sep  4 21:07:35 2011
From: asmeurer at gmail.com (Aaron Meurer)
Date: Sun, 4 Sep 2011 13:07:35 -0600
Subject: [Python-porting] Shebang lines for Python 3
Message-ID: <CAKgW=6LTLt4D1HmYbFmiiE=reTRj3iWMW_=W_RWE9fEv-v9OfQ@mail.gmail.com>

Hi.

We've been having a bit of a discussion about this on the SymPy
(sympy.org) issue tracker.  Is it proper to use "python3" in the
shebang line of a script that should be run in Python 3?  Something
like

#! /usr/bin/env python3

This shortcut works on my machine, but I don't know if it's universal
to all Python 3 installs.  This certainly would make it easier to me
developing with those scripts, because I can just call ./script.py,
but I'm wondering if it's proper to use that in the final (Python 3
version of the) release of the package.

Aaron Meurer

From regebro at gmail.com  Mon Sep  5 07:32:56 2011
From: regebro at gmail.com (Lennart Regebro)
Date: Mon, 5 Sep 2011 07:32:56 +0200
Subject: [Python-porting] Shebang lines for Python 3
In-Reply-To: <CAKgW=6LTLt4D1HmYbFmiiE=reTRj3iWMW_=W_RWE9fEv-v9OfQ@mail.gmail.com>
References: <CAKgW=6LTLt4D1HmYbFmiiE=reTRj3iWMW_=W_RWE9fEv-v9OfQ@mail.gmail.com>
Message-ID: <CAL0kPAVWG9XAXLLCQxH-VHcuum8T=2VvrPCaJ3t0CdO9pF46VA@mail.gmail.com>

On Sun, Sep 4, 2011 at 21:07, Aaron Meurer <asmeurer at gmail.com> wrote:

> Hi.
>
> We've been having a bit of a discussion about this on the SymPy
> (sympy.org) issue tracker.  Is it proper to use "python3" in the
> shebang line of a script that should be run in Python 3?  Something
> like
>
> #! /usr/bin/env python3
>

It is proper, sure.

This shortcut works on my machine, but I don't know if it's universal
> to all Python 3 installs.


I know archlinux uses just "python" for Python 3 and "python2" for Python 2.
In general any install mechanism for your script should handle that, by for
example using distutils or something.

//Lennart
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-porting/attachments/20110905/56a0a597/attachment.html>

From 00ai99 at gmail.com  Mon Sep  5 07:41:55 2011
From: 00ai99 at gmail.com (David Gowers (kampu))
Date: Mon, 5 Sep 2011 15:11:55 +0930
Subject: [Python-porting] Shebang lines for Python 3
In-Reply-To: <CAL0kPAVWG9XAXLLCQxH-VHcuum8T=2VvrPCaJ3t0CdO9pF46VA@mail.gmail.com>
References: <CAKgW=6LTLt4D1HmYbFmiiE=reTRj3iWMW_=W_RWE9fEv-v9OfQ@mail.gmail.com>
	<CAL0kPAVWG9XAXLLCQxH-VHcuum8T=2VvrPCaJ3t0CdO9pF46VA@mail.gmail.com>
Message-ID: <CAKcu9ceguoJanVh=Nm6GQ85A92mpoMEETx80tJbp-p4QeOVQLg@mail.gmail.com>

On Mon, Sep 5, 2011 at 3:02 PM, Lennart Regebro <regebro at gmail.com> wrote:

> On Sun, Sep 4, 2011 at 21:07, Aaron Meurer <asmeurer at gmail.com> wrote:
>
>> Hi.
>>
>> We've been having a bit of a discussion about this on the SymPy
>> (sympy.org) issue tracker.  Is it proper to use "python3" in the
>> shebang line of a script that should be run in Python 3?  Something
>> like
>>
>> #! /usr/bin/env python3
>>
>
> It is proper, sure.
>
> This shortcut works on my machine, but I don't know if it's universal
>> to all Python 3 installs.
>
>
> I know archlinux uses just "python" for Python 3 and "python2" for Python
> 2.
>
Not that that stops you from using 'python3' or even 'python3.2' (though I
wouldn't recommend the latter.). So no changes should be necessary.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-porting/attachments/20110905/aec186c5/attachment.html>

From regebro at gmail.com  Mon Sep  5 07:57:44 2011
From: regebro at gmail.com (Lennart Regebro)
Date: Mon, 5 Sep 2011 07:57:44 +0200
Subject: [Python-porting] Shebang lines for Python 3
In-Reply-To: <CAKcu9ceguoJanVh=Nm6GQ85A92mpoMEETx80tJbp-p4QeOVQLg@mail.gmail.com>
References: <CAKgW=6LTLt4D1HmYbFmiiE=reTRj3iWMW_=W_RWE9fEv-v9OfQ@mail.gmail.com>
	<CAL0kPAVWG9XAXLLCQxH-VHcuum8T=2VvrPCaJ3t0CdO9pF46VA@mail.gmail.com>
	<CAKcu9ceguoJanVh=Nm6GQ85A92mpoMEETx80tJbp-p4QeOVQLg@mail.gmail.com>
Message-ID: <CAL0kPAW-tYAu3YHHvZkBRqnDsyvn4bgJ5-1xKfq54CHDxKXEwA@mail.gmail.com>

On Mon, Sep 5, 2011 at 07:41, David Gowers (kampu) <00ai99 at gmail.com> wrote:

>
>
> On Mon, Sep 5, 2011 at 3:02 PM, Lennart Regebro <regebro at gmail.com> wrote:
>
>> On Sun, Sep 4, 2011 at 21:07, Aaron Meurer <asmeurer at gmail.com> wrote:
>>
>>> Hi.
>>>
>>> We've been having a bit of a discussion about this on the SymPy
>>> (sympy.org) issue tracker.  Is it proper to use "python3" in the
>>> shebang line of a script that should be run in Python 3?  Something
>>> like
>>>
>>> #! /usr/bin/env python3
>>>
>>
>> It is proper, sure.
>>
>> This shortcut works on my machine, but I don't know if it's universal
>>> to all Python 3 installs.
>>
>>
>> I know archlinux uses just "python" for Python 3 and "python2" for Python
>> 2.
>>
> Not that that stops you from using 'python3' or even 'python3.2' (though I
> wouldn't recommend the latter.). So no changes should be necessary.
>

Right,  "python3.2 " would be the best way here.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-porting/attachments/20110905/d234c692/attachment.html>

From hein at kde.org  Mon Sep  5 09:54:00 2011
From: hein at kde.org (Eike Hein)
Date: Mon, 05 Sep 2011 09:54:00 +0200
Subject: [Python-porting] Shebang lines for Python 3
In-Reply-To: <CAKgW=6LTLt4D1HmYbFmiiE=reTRj3iWMW_=W_RWE9fEv-v9OfQ@mail.gmail.com>
References: <CAKgW=6LTLt4D1HmYbFmiiE=reTRj3iWMW_=W_RWE9fEv-v9OfQ@mail.gmail.com>
Message-ID: <4E648018.1050209@kde.org>

On 9/4/2011 9:07 PM, Aaron Meurer wrote:
> This shortcut works on my machine, but I don't know if it's universal
> to all Python 3 installs.  This certainly would make it easier to me
> developing with those scripts, because I can just call ./script.py,
> but I'm wondering if it's proper to use that in the final (Python 3
> version of the) release of the package.

I remember reading somewhere that it's currently the
recommendation of Python upstream to leave "python"
at Python 2.x - possibly even indefinitely - and use
"python3" for Python 3. Arch went against the grain
there, it seems.

I don't think "python3.2" makes sense unless you have
some reason to think it won't work with 3.3.


-- 
Best regards,
Eike Hein

From vlada.peric at gmail.com  Mon Sep  5 11:42:23 2011
From: vlada.peric at gmail.com (=?UTF-8?Q?Vladimir_Peri=C4=87?=)
Date: Mon, 5 Sep 2011 11:42:23 +0200
Subject: [Python-porting] Shebang lines for Python 3
In-Reply-To: <4E648018.1050209@kde.org>
References: <CAKgW=6LTLt4D1HmYbFmiiE=reTRj3iWMW_=W_RWE9fEv-v9OfQ@mail.gmail.com>
	<4E648018.1050209@kde.org>
Message-ID: <CAFu6gYY8h0XO1PES9GYQAKaQreyEzXi9-4JAq13QP9eQzwNTZQ@mail.gmail.com>

On Mon, Sep 5, 2011 at 9:54 AM, Eike Hein <hein at kde.org> wrote:
> On 9/4/2011 9:07 PM, Aaron Meurer wrote:
>>
>> This shortcut works on my machine, but I don't know if it's universal
>> to all Python 3 installs. ?This certainly would make it easier to me
>> developing with those scripts, because I can just call ./script.py,
>> but I'm wondering if it's proper to use that in the final (Python 3
>> version of the) release of the package.
>
> I remember reading somewhere that it's currently the
> recommendation of Python upstream to leave "python"
> at Python 2.x - possibly even indefinitely - and use
> "python3" for Python 3. Arch went against the grain
> there, it seems.

If that's the case, would it make sense to have 2to3 automatically
convert these shebang lines? As a separate (perhaps not enabled by
default) fixer maybe?

>
> I don't think "python3.2" makes sense unless you have
> some reason to think it won't work with 3.3.
>
>
> --
> Best regards,
> Eike Hein
> _______________________________________________
> Python-porting mailing list
> Python-porting at python.org
> http://mail.python.org/mailman/listinfo/python-porting
>



-- 
Vladimir Peri?

From regebro at gmail.com  Mon Sep  5 12:10:43 2011
From: regebro at gmail.com (Lennart Regebro)
Date: Mon, 5 Sep 2011 12:10:43 +0200
Subject: [Python-porting] Shebang lines for Python 3
In-Reply-To: <CAFu6gYY8h0XO1PES9GYQAKaQreyEzXi9-4JAq13QP9eQzwNTZQ@mail.gmail.com>
References: <CAKgW=6LTLt4D1HmYbFmiiE=reTRj3iWMW_=W_RWE9fEv-v9OfQ@mail.gmail.com>
	<4E648018.1050209@kde.org>
	<CAFu6gYY8h0XO1PES9GYQAKaQreyEzXi9-4JAq13QP9eQzwNTZQ@mail.gmail.com>
Message-ID: <CAL0kPAV3ZxJNSz9xSCJL_swOkNAWC2p=k8RjBbXzwEV0fzJyPg@mail.gmail.com>

On Mon, Sep 5, 2011 at 11:42, Vladimir Peri? <vlada.peric at gmail.com> wrote:

> On Mon, Sep 5, 2011 at 9:54 AM, Eike Hein <hein at kde.org> wrote:
> > On 9/4/2011 9:07 PM, Aaron Meurer wrote:
> >>
> >> This shortcut works on my machine, but I don't know if it's universal
> >> to all Python 3 installs.  This certainly would make it easier to me
> >> developing with those scripts, because I can just call ./script.py,
> >> but I'm wondering if it's proper to use that in the final (Python 3
> >> version of the) release of the package.
> >
> > I remember reading somewhere that it's currently the
> > recommendation of Python upstream to leave "python"
> > at Python 2.x - possibly even indefinitely - and use
> > "python3" for Python 3. Arch went against the grain
> > there, it seems.
>
> If that's the case, would it make sense to have 2to3 automatically
> convert these shebang lines? As a separate (perhaps not enabled by
> default) fixer maybe?


That's not possible as you don't know what they should be. And in any case,
the installer should adjust them (as distutils does, for example).

//Lennart

>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-porting/attachments/20110905/ed8b2d41/attachment.html>

From asmeurer at gmail.com  Mon Sep  5 21:22:21 2011
From: asmeurer at gmail.com (Aaron Meurer)
Date: Mon, 5 Sep 2011 13:22:21 -0600
Subject: [Python-porting] Shebang lines for Python 3
In-Reply-To: <CAL0kPAV3ZxJNSz9xSCJL_swOkNAWC2p=k8RjBbXzwEV0fzJyPg@mail.gmail.com>
References: <CAKgW=6LTLt4D1HmYbFmiiE=reTRj3iWMW_=W_RWE9fEv-v9OfQ@mail.gmail.com>
	<4E648018.1050209@kde.org>
	<CAFu6gYY8h0XO1PES9GYQAKaQreyEzXi9-4JAq13QP9eQzwNTZQ@mail.gmail.com>
	<CAL0kPAV3ZxJNSz9xSCJL_swOkNAWC2p=k8RjBbXzwEV0fzJyPg@mail.gmail.com>
Message-ID: <CAKgW=6JgUXAnvRABGDtZ1RVMbf2C4hydG4j7tvx2-ui1g7+zVw@mail.gmail.com>

OK, so actually Arch was the counterexample given in the other
discussion too.  Does Arch not include a python3 alias?  Is it safe to
say that Arch was really stupid for doing this, as it will break every
single Python 2 script that someone wants to use, so that we can just
ignore it?

And can someone point to relevant distutils documentation on how to do
this?  I don't think that Vladimir's actually set up our setup.py
script yet to handle our Python 3 work.

Aaron Meurer

On Mon, Sep 5, 2011 at 4:10 AM, Lennart Regebro <regebro at gmail.com> wrote:
> On Mon, Sep 5, 2011 at 11:42, Vladimir Peri? <vlada.peric at gmail.com> wrote:
>>
>> On Mon, Sep 5, 2011 at 9:54 AM, Eike Hein <hein at kde.org> wrote:
>> > On 9/4/2011 9:07 PM, Aaron Meurer wrote:
>> >>
>> >> This shortcut works on my machine, but I don't know if it's universal
>> >> to all Python 3 installs. ?This certainly would make it easier to me
>> >> developing with those scripts, because I can just call ./script.py,
>> >> but I'm wondering if it's proper to use that in the final (Python 3
>> >> version of the) release of the package.
>> >
>> > I remember reading somewhere that it's currently the
>> > recommendation of Python upstream to leave "python"
>> > at Python 2.x - possibly even indefinitely - and use
>> > "python3" for Python 3. Arch went against the grain
>> > there, it seems.
>>
>> If that's the case, would it make sense to have 2to3 automatically
>> convert these shebang lines? As a separate (perhaps not enabled by
>> default) fixer maybe?
>
> That's not possible as you don't know what they should be. And in any case,
> the installer should adjust them (as distutils does, for example).
> //Lennart
>>
>>
>
> _______________________________________________
> Python-porting mailing list
> Python-porting at python.org
> http://mail.python.org/mailman/listinfo/python-porting
>
>

From regebro at gmail.com  Mon Sep  5 23:16:39 2011
From: regebro at gmail.com (Lennart Regebro)
Date: Mon, 5 Sep 2011 23:16:39 +0200
Subject: [Python-porting] Shebang lines for Python 3
In-Reply-To: <CAKgW=6JgUXAnvRABGDtZ1RVMbf2C4hydG4j7tvx2-ui1g7+zVw@mail.gmail.com>
References: <CAKgW=6LTLt4D1HmYbFmiiE=reTRj3iWMW_=W_RWE9fEv-v9OfQ@mail.gmail.com>
	<4E648018.1050209@kde.org>
	<CAFu6gYY8h0XO1PES9GYQAKaQreyEzXi9-4JAq13QP9eQzwNTZQ@mail.gmail.com>
	<CAL0kPAV3ZxJNSz9xSCJL_swOkNAWC2p=k8RjBbXzwEV0fzJyPg@mail.gmail.com>
	<CAKgW=6JgUXAnvRABGDtZ1RVMbf2C4hydG4j7tvx2-ui1g7+zVw@mail.gmail.com>
Message-ID: <CAL0kPAUkFQZfJeuRJiAo380PsJKJbzYB0BgH8O=J5y0=pAT=qg@mail.gmail.com>

On Mon, Sep 5, 2011 at 21:22, Aaron Meurer <asmeurer at gmail.com> wrote:

> OK, so actually Arch was the counterexample given in the other
> discussion too.  Does Arch not include a python3 alias?


They do.


>  Is it safe to say that Arch was really stupid for doing this


IMO, yes.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-porting/attachments/20110905/737a2168/attachment.html>

From asmeurer at gmail.com  Tue Sep  6 18:30:41 2011
From: asmeurer at gmail.com (Aaron Meurer)
Date: Tue, 6 Sep 2011 10:30:41 -0600
Subject: [Python-porting] Shebang lines for Python 3
In-Reply-To: <CAL0kPAUkFQZfJeuRJiAo380PsJKJbzYB0BgH8O=J5y0=pAT=qg@mail.gmail.com>
References: <CAKgW=6LTLt4D1HmYbFmiiE=reTRj3iWMW_=W_RWE9fEv-v9OfQ@mail.gmail.com>
	<4E648018.1050209@kde.org>
	<CAFu6gYY8h0XO1PES9GYQAKaQreyEzXi9-4JAq13QP9eQzwNTZQ@mail.gmail.com>
	<CAL0kPAV3ZxJNSz9xSCJL_swOkNAWC2p=k8RjBbXzwEV0fzJyPg@mail.gmail.com>
	<CAKgW=6JgUXAnvRABGDtZ1RVMbf2C4hydG4j7tvx2-ui1g7+zVw@mail.gmail.com>
	<CAL0kPAUkFQZfJeuRJiAo380PsJKJbzYB0BgH8O=J5y0=pAT=qg@mail.gmail.com>
Message-ID: <CAKgW=6K0FWf1HFxLj-oKJUZFe0tN5TXipLNwkSTu=8ojeQjUJg@mail.gmail.com>

On Mon, Sep 5, 2011 at 3:16 PM, Lennart Regebro <regebro at gmail.com> wrote:
> On Mon, Sep 5, 2011 at 21:22, Aaron Meurer <asmeurer at gmail.com> wrote:
>>
>> OK, so actually Arch was the counterexample given in the other
>> discussion too. ?Does Arch not include a python3 alias?
>
> They do.

Ah, so the Arch argument really isn't a good one, because /usr/bin/env
python3 will still work there.  And as far as I've heard, it will work
everywhere else too.

The real problem with Arch is that Python 2 stuff will break, not
Python 3, and as we decided, this is Arch's fault, not ours.

Aaron Meurer

>
>>
>> ?Is it safe to?say that Arch was really stupid for doing this
>
> IMO, yes.
>

From barry at python.org  Tue Sep  6 19:41:39 2011
From: barry at python.org (Barry Warsaw)
Date: Tue, 6 Sep 2011 13:41:39 -0400
Subject: [Python-porting] Shebang lines for Python 3
In-Reply-To: <CAKgW=6LTLt4D1HmYbFmiiE=reTRj3iWMW_=W_RWE9fEv-v9OfQ@mail.gmail.com>
References: <CAKgW=6LTLt4D1HmYbFmiiE=reTRj3iWMW_=W_RWE9fEv-v9OfQ@mail.gmail.com>
Message-ID: <20110906134139.493dc485@resist.wooz.org>

On Sep 04, 2011, at 01:07 PM, Aaron Meurer wrote:

>Is it proper to use "python3" in the shebang line of a script that should be
>run in Python 3?

Yes.

See PEP 394:

http://www.python.org/dev/peps/pep-0394/

While not yet approved, I think there's general consensus on the
recommendations in the PEP.

Cheers,
-Barry

From aaron.devore at gmail.com  Wed Sep  7 01:33:44 2011
From: aaron.devore at gmail.com (Aaron DeVore)
Date: Tue, 6 Sep 2011 16:33:44 -0700
Subject: [Python-porting] Shebang lines for Python 3
In-Reply-To: <CAKgW=6K0FWf1HFxLj-oKJUZFe0tN5TXipLNwkSTu=8ojeQjUJg@mail.gmail.com>
References: <CAKgW=6LTLt4D1HmYbFmiiE=reTRj3iWMW_=W_RWE9fEv-v9OfQ@mail.gmail.com>
	<4E648018.1050209@kde.org>
	<CAFu6gYY8h0XO1PES9GYQAKaQreyEzXi9-4JAq13QP9eQzwNTZQ@mail.gmail.com>
	<CAL0kPAV3ZxJNSz9xSCJL_swOkNAWC2p=k8RjBbXzwEV0fzJyPg@mail.gmail.com>
	<CAKgW=6JgUXAnvRABGDtZ1RVMbf2C4hydG4j7tvx2-ui1g7+zVw@mail.gmail.com>
	<CAL0kPAUkFQZfJeuRJiAo380PsJKJbzYB0BgH8O=J5y0=pAT=qg@mail.gmail.com>
	<CAKgW=6K0FWf1HFxLj-oKJUZFe0tN5TXipLNwkSTu=8ojeQjUJg@mail.gmail.com>
Message-ID: <CAL4sBwjWW8T149=_cfDk=xKKg4LM-_uucn+oCg2hun8YEY27Sw@mail.gmail.com>

On Tue, Sep 6, 2011 at 9:30 AM, Aaron Meurer <asmeurer at gmail.com> wrote:
> Ah, so the Arch argument really isn't a good one, because /usr/bin/env
> python3 will still work there. ?And as far as I've heard, it will work
> everywhere else too.
>
> The real problem with Arch is that Python 2 stuff will break, not
> Python 3, and as we decided, this is Arch's fault, not ours.

Arch's justification was that switching /usr/bin/python would push
developers and library writers to port to Python 3. It mostly just
annoyed people, including me.

However, Arch brought up a valid point: Python developers should not
depend on "python" pointing to Python 2 for all eternity.
Distributions, users, or sysadmins may not want:

    $ python

to point to an obsolete version. Shebangs are fine if setup.py uses
the scripts parameter to get shebang rewriting. Shebangs that require
a run of 'sed' are less ideal, but workable. Using:

    subprocess.Popen(['python', 'script_name.py'])

is bad.

-Aaron DeVore

From asmeurer at gmail.com  Wed Sep  7 02:32:30 2011
From: asmeurer at gmail.com (Aaron Meurer)
Date: Tue, 6 Sep 2011 18:32:30 -0600
Subject: [Python-porting] Shebang lines for Python 3
In-Reply-To: <20110906134139.493dc485@resist.wooz.org>
References: <CAKgW=6LTLt4D1HmYbFmiiE=reTRj3iWMW_=W_RWE9fEv-v9OfQ@mail.gmail.com>
	<20110906134139.493dc485@resist.wooz.org>
Message-ID: <CAKgW=6+WR3OTp+Q85Wz4nTCDoiivOELvPhzzUGTU17iDLdZ20w@mail.gmail.com>

Excellent!  That's exactly what I was looking for.  It seems that
python2 is not very widely adopted (yet), but I think that python3 is,
and if anyone complains, we can point to this PEP/thread.

After this PEP is accepted (or even before), would the Python core
community consider adding a (potentially optional) fixer to 2to3 that
changes shebang lines?

Aaron Meurer

On Tue, Sep 6, 2011 at 11:41 AM, Barry Warsaw <barry at python.org> wrote:
> On Sep 04, 2011, at 01:07 PM, Aaron Meurer wrote:
>
>>Is it proper to use "python3" in the shebang line of a script that should be
>>run in Python 3?
>
> Yes.
>
> See PEP 394:
>
> http://www.python.org/dev/peps/pep-0394/
>
> While not yet approved, I think there's general consensus on the
> recommendations in the PEP.
>
> Cheers,
> -Barry
> _______________________________________________
> Python-porting mailing list
> Python-porting at python.org
> http://mail.python.org/mailman/listinfo/python-porting
>