Unverified Commit 7488ac7a authored by Gaétan Lepage's avatar Gaétan Lepage Committed by GitHub
Browse files

python3Packages.lida: init at 0.0.14 (#383724)

parents 92d11f06 c2bcbbd4
Loading
Loading
Loading
Loading
+108 −0
Original line number Diff line number Diff line
{
  lib,
  buildPythonPackage,
  fetchPypi,
  setuptools,
  setuptools-scm,
  altair,
  fastapi,
  geopandas,
  kaleido,
  llmx,
  matplotlib,
  matplotlib-venn,
  networkx,
  numpy,
  pandas,
  plotly,
  plotnine,
  pydantic,
  python-multipart,
  scipy,
  seaborn,
  statsmodels,
  typer,
  uvicorn,
  wordcloud,
  peacasso,
  basemap,
  basemap-data-hires,
  geopy,
}:

buildPythonPackage rec {
  pname = "lida";
  version = "0.0.14";
  pyproject = true;

  # No releases or tags are available in https://github.com/microsoft/lida
  src = fetchPypi {
    inherit pname version;
    hash = "sha256-/az6hS8rNPxb8cDiz9SOyUBi/X48r9prJNFUnx1wPHM=";
  };

  patches = [
    # The upstream places the data path under the py file's own directory.
    # However, since `/nix/store` is read-only, we patch it to the user's home directory.
    ./rw_data.patch
  ];

  build-system = [
    setuptools
    setuptools-scm
  ];

  dependencies = [
    altair
    fastapi
    geopandas
    kaleido
    llmx
    matplotlib
    matplotlib-venn
    networkx
    numpy
    pandas
    plotly
    plotnine
    pydantic
    python-multipart
    scipy
    seaborn
    statsmodels
    typer
    uvicorn
    wordcloud
  ];

  optional-dependencies = {
    infographics = [
      peacasso
    ];
    tools = [
      basemap
      basemap-data-hires
      geopy
    ];
    transformers = [
      llmx
    ];
    web = [
      fastapi
      uvicorn
    ];
  };

  # require network
  doCheck = false;

  pythonImportsCheck = [ "lida" ];

  meta = {
    description = "Automatic Generation of Visualizations and Infographics using Large Language Models";
    homepage = "https://github.com/microsoft/lida";
    license = lib.licenses.mit;
    maintainers = with lib.maintainers; [ moraxyc ];
    mainProgram = "lida";
  };
}
+16 −0
Original line number Diff line number Diff line
diff --git a/lida/web/app.py b/lida/web/app.py
index 32046a3..599ae07 100644
--- a/lida/web/app.py
+++ b/lida/web/app.py
@@ -34,8 +34,9 @@ app.mount("/api", api)
 
 root_file_path = os.path.dirname(os.path.abspath(__file__))
 static_folder_root = os.path.join(root_file_path, "ui")
-files_static_root = os.path.join(root_file_path, "files/")
-data_folder = os.path.join(root_file_path, "files/data")
+home_dir = os.path.expanduser("~")
+files_static_root = os.path.join(home_dir, ".lida/files")
+data_folder = os.path.join(files_static_root, "data")
 os.makedirs(data_folder, exist_ok=True)
 os.makedirs(files_static_root, exist_ok=True)
 os.makedirs(static_folder_root, exist_ok=True)
+2 −0
Original line number Diff line number Diff line
@@ -7617,6 +7617,8 @@ self: super: with self; {
  license-expression = callPackage ../development/python-modules/license-expression { };
  lida = callPackage ../development/python-modules/lida { };
  lief = (toPythonModule (pkgs.lief.override {
    inherit python;
  })).py;