Python: Difference between revisions

From NixOS Wiki
imported>Asymmetric
m make difference between libraries/apps more visible
imported>Asymmetric
Add info about python applications requiring pythonPackages
Line 1: Line 1:
== Contribution guidelines ==
== Contribution guidelines ==


According to the [https://nixos.org/nixpkgs/manual/#contributing-guidelines official guidelines] for python new package expressions for '''libraries''' should be placed in <syntaxhighlight lang="bash" inline>pkgs/development/python-modules/<name>/default.nix</syntaxhighlight>. Those expressions are then referenced from <code>pkgs/top-level/python-packages.nix</code> like in this example:
=== Libraries ===
 
According to the [https://nixos.org/nixpkgs/manual/#contributing-guidelines official guidelines] for python new package expressions for 'libraries' should be placed in <syntaxhighlight lang="bash" inline>pkgs/development/python-modules/<name>/default.nix</syntaxhighlight>. Those expressions are then referenced from <code>pkgs/top-level/python-packages.nix</code> like in this example:


<syntaxhighlight lang="nix">
<syntaxhighlight lang="nix">
Line 11: Line 13:
The reasoning behind this is the large size of <code>pkgs/top-level/python-packages.nix</code>. Unfortunately most libraries are still defined in-place in <code>pkgs/top-level/python-packages.nix</code>. If a change to library is necessary or an update is made, it is recommend to move the modified package out of <code>pkgs/top-level/python-packages.nix</code>.
The reasoning behind this is the large size of <code>pkgs/top-level/python-packages.nix</code>. Unfortunately most libraries are still defined in-place in <code>pkgs/top-level/python-packages.nix</code>. If a change to library is necessary or an update is made, it is recommend to move the modified package out of <code>pkgs/top-level/python-packages.nix</code>.


Python '''applications''' instead should be referenced directly from <code>pkgs/top-level/all-packages.nix</code>.
=== Applications ===
 
Python 'applications instead should be referenced directly from <code>pkgs/top-level/all-packages.nix</code>.
 
The expression should take `pythonPackages` as one of the arguments, which guarantees that packages belong to the same set.
 
Also:
 
* for libraries,


= External Documentation =
= External Documentation =


* [https://nixos.org/nixpkgs/manual/#python Python user guide in nixpkgs manual]
* [https://nixos.org/nixpkgs/manual/#python Python user guide in nixpkgs manual]

Revision as of 15:33, 26 February 2018

Contribution guidelines

Libraries

According to the official guidelines for python new package expressions for 'libraries' should be placed in pkgs/development/python-modules/<name>/default.nix. Those expressions are then referenced from pkgs/top-level/python-packages.nix like in this example:

{
  aenum = callPackage ../development/python-modules/aenum { };
}

The reasoning behind this is the large size of pkgs/top-level/python-packages.nix. Unfortunately most libraries are still defined in-place in pkgs/top-level/python-packages.nix. If a change to library is necessary or an update is made, it is recommend to move the modified package out of pkgs/top-level/python-packages.nix.

Applications

Python 'applications instead should be referenced directly from pkgs/top-level/all-packages.nix.

The expression should take `pythonPackages` as one of the arguments, which guarantees that packages belong to the same set.

Also:

  • for libraries,

External Documentation