[Nix-dev] Python 3 as default

Freddy Rietdijk freddyrietdijk at fridh.nl
Tue Feb 14 11:29:32 CET 2017


Hi Richard,

Thanks for sharing the PEP.

Actually, we, or at least I, chose to ignore that PEP, and so we do
symlink.

The PEP describes what distributions should do

> for the time being, all distributions should ensure that python refers to
the same target as python2.

> The more general python command should be installed whenever any version
of Python 2 is installed and should invoke the same version of Python as
the python2 command

and what script maintainers should do

> in preparation for an eventual change in the default version of Python,
Python 2 only scripts should either be updated to be source compatible with
Python 3 or else to use python2 in the shebang line.

We have a lot of packages that are compatible with both Python 2 and 3. The
PEP says about such case

> 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 now we have `python2` for Python 2 only, `python3` for Python3 only,
`python` for packages that support only Python 2, or both 2 and 3.

The PEP however doesn't provide any method for distributions that already
would like to make the switch to Python 3, which is the reason this PEP
came to being

> 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.


Freddy


On Tue, Feb 14, 2017 at 10:40 AM, Richard Ipsum <richardipsum at fastmail.co.uk
> wrote:

> On Mon, Feb 13, 2017 at 10:08:07AM +0100, Freddy Rietdijk wrote:
> > Hi,
> >
> > As you may be aware the plan is to change to Python 3.5 as default for
> > 17.03. There were a couple of things that had to be done, and I think
> we're
> > ready now to make the change. Packages that require Python 2 are now
> pinned
> > to do so.
> >
> > Now, obviously I haven't been able to test all packages myself, but
> judging
> > from what Hydra reports and from working from the `python3` branch I
> don't
> > expect any major issues.
> >
> > The Python 2.7 interpreter had quite some patches, among one to make the
> > interpreter and Python packages more deterministic. I say more, because
> > they're not fully deterministic yet. I have some patches lining up for
> the
> > 3.5 interpreter to improvement determinism there as well.
> >
> > In any case, I would like to merge this as soon as possible. Any
> objections?
> >
> > Freddy
>
> Hi, I'm not really an active contributor here but I follow NixOS because
> I think it's a really cool project.
>
> Am I to understand that NixOS is considering replacing the python2
> interpreter with the python3 interpreter, as arch did?
>
> If that's the case it may be worth considering this pep[1] first.
>
> If I've misunderstood and there's no intention to symlink 'python' to
> 'python3'
> then please ignore this. :)
>
> [1]: http://legacy.python.org/dev/peps/pep-0394/#id5
> _______________________________________________
> nix-dev mailing list
> nix-dev at lists.science.uu.nl
> http://lists.science.uu.nl/mailman/listinfo/nix-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.science.uu.nl/pipermail/nix-dev/attachments/20170214/893d9e54/attachment.html>


More information about the nix-dev mailing list