Python: Difference between revisions
Anna Aurora (talk | contribs) m Made first code block less repetitive. |
Add the uv tool as an option |
||
Line 222: | Line 222: | ||
$ nix-shell -p python3 --command "python -m venv .venv --copies" | $ nix-shell -p python3 --command "python -m venv .venv --copies" | ||
</syntaxhighlight>You can then activate and use the Python virtual environment as usual and install dependencies with <code>pip</code> and similar. | </syntaxhighlight>You can then activate and use the Python virtual environment as usual and install dependencies with <code>pip</code> and similar. | ||
=== Using uv === | |||
<blockquote>A single tool to replace <code>pip</code>, <code>pip-tools</code>, <code>pipx</code>, <code>poetry</code>, <code>pyenv</code>, <code>virtualenv</code>, and more.</blockquote>Is very simple to use. Simply <code>uv init</code> to get started. No need for shells, as it creates virtual environments. | |||
As a systemPackage<syntaxhighlight lang="nix"> | |||
environment.systemPackages = with pkgs; [ | |||
uv | |||
]; | |||
</syntaxhighlight>or as a home-manager package<syntaxhighlight lang="nix"> | |||
home.packages = with pkgs; [ | |||
uv | |||
]; | |||
</syntaxhighlight> | |||
=== Using poetry === | === Using poetry === |