Python: Difference between revisions
fixed broken link for pyproject use-cases |
Adds a section about using rPackages with rpy2 in python |
||
| (One intermediate revision by one other user not shown) | |||
| Line 39: | Line 39: | ||
])) | ])) | ||
]; | ]; | ||
</syntaxhighlight> | |||
=== Using R packages in python with rpy2 === | |||
<syntaxhighlight lang="nix"> | |||
environment.systemPackages = with pkgs; [ | |||
# ... | |||
(python3.withPackages (python-pkgs: with python-pkgs; [ | |||
pandas | |||
requests | |||
rpy2 | |||
])) | |||
# don't use rWrapper.override | |||
rPackages.tidyverse | |||
rPackages.uwot | |||
]; | |||
</syntaxhighlight> | </syntaxhighlight> | ||
| Line 546: | Line 563: | ||
[project.scripts] | [project.scripts] | ||
cli = "app.main:main" | cli = "app.main:main" | ||
</syntaxhighlight>We package the application by calling the <code>loadPyproject</code> function from <code>pyproject.nix</code>. Again, we only show a minimal example. More information can be found in the [https://nix | </syntaxhighlight>We package the application by calling the <code>loadPyproject</code> function from <code>pyproject.nix</code>. Again, we only show a minimal example. More information can be found in the [https://pyproject-nix.github.io/pyproject.nix/use-cases/pyproject.html documentation]. Note that this example relies on flakes in contrast to some of the others on this page.<syntaxhighlight lang="nix"> | ||
{ | { | ||
description = "A basic flake using pyproject.toml project metadata"; | description = "A basic flake using pyproject.toml project metadata"; | ||