[Nix-dev] Fwd: Python 3 as default

Herwig Hochleitner hhochleitner at gmail.com
Sun Feb 26 20:39:49 CET 2017


2017-02-24 7:54 GMT+01:00 Freddy Rietdijk <freddyrietdijk at fridh.nl>:
> 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.
>
> Explicitly pinning to `python3` means converting every expression that has
> `python` to `python3`. No breakage should occur anymore, except when one
> makes a mistake in converting expressions only partially. There are about
> 1000 packages that need to be converted.

I've generated a list of packages affected by the rename (the program
is also attached):
https://gist.github.com/bendlas/5115ec6ada57bcd05d8e926358109902

For immediate referrers of python2 (within the set top-level attrs
affected by the rename), your estimate of 1000 is about right: I'm
counting 917 packages. The full set of "direct" referrers counts about
3100, though, if you include packages that got transitively changed
via a package, that's not yet listed in `nix-env -qa`. This includes
many packages, depending on the same unattributed derivation, but even
just the immediate unattributed referrers, count around 1200.

Those counts include `pythonPackages` and a couple of other package
sets, though.

> The best method I can think of is searching for all the files that contain
> `python` without leading and trailing alphanumerical characters. Those can
> typically be converted to `python3`. Exceptions are
> `pkgs/top-level/python-packages.nix`,
> `pkgs/development/interpreters/python`,  `pkgs/development/python-modules/*`
> and when the `python` argument is overriden in, say, `all-packages.nix`.
> Another exception could be `python = python3.withPackages(...)` but I think
> that is rare.

I'll try a sed script to rename all those simple `callPackage` cases,
based on my list. We'll see how many remain after that.
If anybody wants to get clever with hnix, this would be an excellent
opportunity ;-)


More information about the nix-dev mailing list