poetry2nix icon indicating copy to clipboard operation
poetry2nix copied to clipboard

Suggestion: scientific stack

Open mschneiderwng opened this issue 2 years ago • 2 comments

Python is heavily used in the data science and machine learning community. It would therefore be great to have a basic setup of versions that is known to be working with poetry2nix. Maybe we could have a unit test for common configurations.

A common basic setup is poetry add jupyter matplotlib numpy pandas plotly torch scikitlearn seaborn sympy. I got numpy and torch running by using the carefully chosen version below. However, cannot find a configuration that works with matplotlib, pandas and the others.

  • flake.nix
{
  inputs.nixpkgs.url = "github:NixOS/nixpkgs";
  inputs.utils.url = "github:numtide/flake-utils";
  inputs.poetry2nix-src.url = "github:nix-community/poetry2nix";

  outputs = { nixpkgs, utils, poetry2nix-src, self }: utils.lib.eachDefaultSystem (system:
    let
      pkgs = import nixpkgs { inherit system; overlays = [ poetry2nix-src.overlay ]; };
    in
    {
      devShell = pkgs.mkShell {
        buildInputs = with pkgs; [
          # Additional dev packages list here.
          nixpkgs-fmt
          (pkgs.poetry2nix.mkPoetryEnv {
            projectDir = ./.;
            python = pkgs.python38;
            editablePackageSources = {
              my-app = ./src;
            };
          })
        ];
      };
    });
}
  • pyproject.toml
[tool.poetry]
name = "non"
description = ""
version = "0.1.0"
authors = ["me"]

[tool.poetry.dependencies]
python = "^3.8"
numpy = "~1.20.3"
torch = "~1.10.2"
typing-extensions = "^3.7.4"

[build-system]
requires = ["poetry-core>=1.0.0"]
build-backend = "poetry.core.masonry.api"

mschneiderwng avatar May 04 '22 08:05 mschneiderwng

I've tried to do this quite a bit and have upstreamed quite a bit of it, but I'd also like to see tests for this.

NorfairKing avatar May 04 '22 10:05 NorfairKing

Good news, it looks like a scientific test was created in October 2022 ! Most of @mschneiderwng's packages are part of the test, the only missing ones are plotly, torch and sympy.

Laurent2916 avatar Feb 25 '23 15:02 Laurent2916