python

Author

GuangTao Zhang

Published

February 20, 2023

Poetry

CLI

poetry install --with data
  • only groups
poetry install --only data,jupyenv
  • then poetry shell to enter the python virtualEnvironment

configFiles

Do not modify the top-level/pyproject.toml, which is generated by nix automaticlly. I would highly recommand the users to control the dependencies through poetry’s groups.

  • add your custom poetry packages

    custom dir: ./nix/python/packages/

poetry add --group data -C ./nix/python/packages/

Notice Don’t forget run direnv reload to re-generate toplevel/pyorject.toml

  • merge the pyproject.toml from other poetry’s projects

    Notice: make sure the pyproject.toml under the path vaule.

{
  poetry =
    l.recursiveUpdate (cell.lib.mergePoetryEnv [
      {
        path = ./packages;
      }
      {
        path = "${inputs.dataflow2nix}/nix/prefect/packages";
        overrides = false;
      }
      {path = "${inputs.desci}/nix/python/packages";}
    ]) {
      # add your overrides here
      #  pyproject = {
      #  tool.poetry.dependencies.polars = {
      #   version = "^0.15.1";
      #   format = "wheel";
      # };
      # };
    };
}

Nix

  • std
std //python/packages/default:build
  • nix-command
nix build .x86_64-linux.python.packages.default --print-build-logs