Python: Difference between revisions

imported>Milahu
mkShell: use python.sitePackages
imported>Ottop
Added an example that shows how this could be implemented
Line 22: Line 22:


We defined a function <code>my-python-packages</code> which takes as input a set <code>python-packages</code> and returns a list of attributes thereof.
We defined a function <code>my-python-packages</code> which takes as input a set <code>python-packages</code> and returns a list of attributes thereof.
=== Example ===
One way to define the python package with modules inside the default configuration file is to use the systemPackages list. In such a case, you could have the following under <code>environment.systemPackages = with pkgs;</code> along with the rest of your packages:
<syntaxhighlight lang="nix">
(let
  my-python-packages = python-packages: with python-packages; [
    pandas
    requests
    #other python packages you want
  ];
  python-with-my-packages = python3.withPackages my-python-packages;
in
python-with-my-packages)
</syntaxhighlight>


== Development shell ==
== Development shell ==