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

python3Packages.arro3: Init at 0.5.1 (#433369)

parents 4df19283 4113c68e
Loading
Loading
Loading
Loading
+122 −0
Original line number Diff line number Diff line
{
  lib,
  buildPythonPackage,
  fetchFromGitHub,
  rustPlatform,
  pytestCheckHook,
  geoarrow-types,
  pyarrow,
  numpy,
  pandas,
}:
let
  version = "0.5.1";

  src = fetchFromGitHub {
    owner = "kylebarron";
    repo = "arro3";
    tag = "py-v${version}";
    hash = "sha256-RTr+mf5slfxxvXp9cwPuy08AZUswPtIIRz+vngdg/k0=";
  };

  cargoDeps = rustPlatform.fetchCargoVendor {
    inherit version src;
    pname = "arro3-vendor";
    hash = "sha256-YQA8Z86Ul8yAHncMgYrGmNe10KSpubHjaokCjaqTAxo=";
  };

  commonMeta = {
    homepage = "https://github.com/kylebarron/arro3";
    changelog = "https://github.com/kylebarron/arro3/releases/tag/py-v${version}";
    license = lib.licenses.asl20;
    maintainers = [ lib.maintainers.mslingsby ];
  };

  buildArro3Package =
    {
      pname,
      subdir,
      description,
      pythonImportsCheck,
      dependencies ? [ ],
    }:
    buildPythonPackage rec {
      inherit
        pname
        version
        src
        cargoDeps
        dependencies
        pythonImportsCheck
        ;
      pyproject = true;

      sourceRoot = "${src.name}/${subdir}";
      cargoRoot = "..";

      nativeBuildInputs = with rustPlatform; [
        cargoSetupHook
        maturinBuildHook
      ];

      env = {
        CARGO_TARGET_DIR = "./target";
      };

      # Avoid infinite recursion in tests.
      # arro3-core tests depends on arro3-compute and arro3-compute depends on arro3-core
      passthru.tests = { inherit arro3-tests; };

      meta = commonMeta // {
        inherit description;
      };
    };

  arro3-core = buildArro3Package {
    pname = "arro3-core";
    subdir = "arro3-core";
    description = "Core library for representing Arrow data in Python";
    pythonImportsCheck = [ "arro3.core" ];
  };

  arro3-compute = buildArro3Package {
    pname = "arro3-compute";
    subdir = "arro3-compute";
    description = "Rust-based compute kernels for Arrow in Python";
    pythonImportsCheck = [ "arro3.compute" ];
    dependencies = [ arro3-core ];
  };

  arro3-io = buildArro3Package {
    pname = "arro3-io";
    subdir = "arro3-io";
    description = "Rust-based readers and writers for Arrow in Python";
    pythonImportsCheck = [ "arro3.io" ];
    dependencies = [ arro3-core ];
  };

  arro3-tests = buildPythonPackage {
    pname = "arro3-tests";
    version = arro3-core.version;

    format = "other";
    dontBuild = true;
    dontInstall = true;

    inherit src;

    nativeCheckInputs = [
      pytestCheckHook
      geoarrow-types
      pandas
      pyarrow
      numpy
      arro3-core
      arro3-compute
      arro3-io
    ];
  };
in
{
  inherit arro3-core arro3-io arro3-compute;
}
+6 −0
Original line number Diff line number Diff line
@@ -907,6 +907,12 @@ self: super: with self; {
  arris-tg2492lg = callPackage ../development/python-modules/arris-tg2492lg { };
  arro3-compute = (callPackage ../development/python-modules/arro3 { }).arro3-compute;
  arro3-core = (callPackage ../development/python-modules/arro3 { }).arro3-core;
  arro3-io = (callPackage ../development/python-modules/arro3 { }).arro3-io;
  arrow = callPackage ../development/python-modules/arrow { };
  arsenic = callPackage ../development/python-modules/arsenic { };