From 1e9cc62985cd9fce297f8064041b8e382e668877 Mon Sep 17 00:00:00 2001 From: Tibo De Peuter Date: Wed, 10 Apr 2024 22:32:35 +0200 Subject: [PATCH] [python] docs: Update conda usage --- python/conda/flake.lock | 12 ++++++------ python/conda/flake.nix | 36 ++++++++++++++++++++---------------- 2 files changed, 26 insertions(+), 22 deletions(-) diff --git a/python/conda/flake.lock b/python/conda/flake.lock index 589280a..10d058a 100644 --- a/python/conda/flake.lock +++ b/python/conda/flake.lock @@ -5,11 +5,11 @@ "systems": "systems" }, "locked": { - "lastModified": 1694529238, - "narHash": "sha256-zsNZZGTGnMOf9YpHKJqMSsa0dXbfmxeoJ7xHlrt+xmY=", + "lastModified": 1710146030, + "narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=", "owner": "numtide", "repo": "flake-utils", - "rev": "ff7b65b44d01cf9ba6a71320833626af21126384", + "rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a", "type": "github" }, "original": { @@ -20,11 +20,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1695360818, - "narHash": "sha256-JlkN3R/SSoMTa+CasbxS1gq+GpGxXQlNZRUh9+LIy/0=", + "lastModified": 1712608508, + "narHash": "sha256-vMZ5603yU0wxgyQeHJryOI+O61yrX2AHwY6LOFyV1gM=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "e35dcc04a3853da485a396bdd332217d0ac9054f", + "rev": "4cba8b53da471aea2ab2b0c1f30a81e7c451f4b6", "type": "github" }, "original": { diff --git a/python/conda/flake.nix b/python/conda/flake.nix index 3c15a31..9f8d65d 100644 --- a/python/conda/flake.nix +++ b/python/conda/flake.nix @@ -2,8 +2,26 @@ description = '' Python flake for use with conda environments. - This will create a directory `~/.conda`, which might be rather large, + This will create a directory ~/.conda, which might become rather large, depending on your required packages. + + ### Usage: ### + + You can enter the environment in your CLI with: + + $ nix-develop -c bash -c "conda-shell -c 'conda activate && sh'" + + If you are using Pycharm, you can start up quickly by running: + + $ nix develop -c bash -c "conda-shell -c pycharm-professonial && exit" + + ### Setup: ### + + On your first run, enter conda using + + $ nix-develop -c bash -c "conda-shell -c 'conda-install'" + (conda-shell)$ conda env create --name --file /path/to/environment.yaml + ''; inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; @@ -16,28 +34,14 @@ inherit system; config.allowUnfree = true; }; - - installation-steps = '' - conda-shell -c 'conda-install' - printf 'Run `conda env create --name ai-practica --file environment.yaml` and exit.\n' - conda-shell && exit - ''; - IDE-steps = '' - conda-shell -c pycharm-professional && exit - ''; - CLI-steps = '' - printf 'Enter your enviroment by running `conda activate ai-practica`.\n' - conda-shell && exit - ''; in { devShells.default = pkgs.mkShell { packages = with pkgs; [ conda # You might want to add an IDE of your choice; - jetbrains.pycharm-professional + # (jetbrains.plugins.addPlugins jetbrains.pycharm-professional [ "github-copilot" ]) ]; - shellHook = IDE-steps; }; }); }