[Nix-dev] Fwd: Python 3 as default

Freddy Rietdijk freddyrietdijk at fridh.nl
Mon Feb 27 16:48:50 CET 2017


> It may silently break external users, though.

It may do so and likely will. Even so, users of Nixpkgs have always had the
choice to explicitly pin a version, both minor and major.

> BTW, I just noticed that the Python 3 package in 17.03 already defines a
"python
-> python3" symlink (introduced by [1]). IMHO, we should revert that, since
it
can only lead to pointless environment collision errors/warnings.

The collision warnings has been taken care of by changing the priority. It
might be considered messy though, `python` pointing to `python3` when we
only have 3 in a profile, yet pointing to `python2` when 2 is in the
profile.

The symbolic link was added already 4,5 months ago and there haven't been
any complaints since. The only mention of a potential issue came after I
sent this e-mail with Peter mentioning his scripts pointing to
`/usr/bin/env python`. But here the issue is simple: according to PEP 394
[1] one should update the shebangs to point to the version of the
interpreter that is needed, and only point to `python` when both 2 and 3
are valid. Therefore, this is an issue that package/script developers are
supposed to solve.

> Also, we probably don't want to promote the use of the "python"
executable name because it's unversioned

One should use `/bin/python` only when it can handle 2 and 3 and use a more
specific shebang when it is needed.
The reason why `python` also points to `/bin/python3` is because many
packages haven't yet adopted the earlier referenced PEP 394 [1] even though
their packages are already compatible with Python 3.

Earlier I said we don't follow the PEP, but actually we do, with the
noticeable addition that we also point to `/bin/python3` when there is no
`python2` interpreter.

[1] http://legacy.python.org/dev/peps/pep-0394/#id5


On Mon, Feb 27, 2017 at 4:20 PM, Eelco Dolstra <eelco.dolstra at logicblox.com>
wrote:

> Hi,
>
> On 02/24/2017 07:54 AM, Freddy Rietdijk wrote:
>
> >> I'd be happy to help with the process of mass-renaming, if somebody
> provided a
> > list of packages wanting 2 or 3, however I suspect the real work is in
> > determining those package sets.
> > So, if a query-replace for `pkgs.python` -> `pkgs.python2` /
> `pkgs.python3`
> > within nixpkgs would cause so much trouble, how would a rename in
> > `all-packages.nix` fare any better? Are we ready to throw the switch yet?
> >
> > All the packages that explicitly need Python 2 are already pinned to use
> Python
> > 2. That was a matter of converting, testing, and moving on. About 150
> packages
> > were pinned to `python2`. That is why a `python = python3` won't break
> anything
> > (or nearly nothing) in Nixpkgs anymore.
>
> It may silently break external users, though. So removing the "python"
> attribute
> is preferable to aliasing it to "python3".
>
> BTW, I just noticed that the Python 3 package in 17.03 already defines a
> "python
> -> python3" symlink (introduced by [1]). IMHO, we should revert that,
> since it
> can only lead to pointless environment collision errors/warnings. Also, we
> probably don't want to promote the use of the "python" executable name
> because
> it's unversioned (so when Python 4 breaks the language again, we'll have
> to go
> through this whole process again).
>
> [1] https://github.com/NixOS/nixpkgs/commit/708822250e017f0256b0bace5af27a
> 7232e6e1fd
>
> --
> Eelco Dolstra | LogicBlox, Inc. | http://nixos.org/~eelco/
> _______________________________________________
> 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/20170227/a674f1ec/attachment-0001.html>


More information about the nix-dev mailing list