Shorten command using `with` in nix-shell

nix-shell -p python3Packages.numpy  python3Packages.pandas  python3Packages.matplotlib 

please tell the correct way to reduce this code, I tried this but it did not work

nix-shell -p with python3Packages; [numpy pandas]

nix-shell is quite simple-minded, it takes the -p arguments verbatim as dependencies to a derivation. Therefore, all you have to do is quote the argument:

nix-shell -p 'with python3Packages; [ numpy pandas ]'
3 Likes

Your shell may also be able to help out. At least in bash i think this will expand to what you want:

nix-shell -p python3Packages.{numpy,pandas,matplotlib} 
3 Likes