From 9eabe4215e06f13de7ac1aa1ad470f763a8f2bcf Mon Sep 17 00:00:00 2001 From: daspk04 Date: Tue, 19 May 2026 14:03:12 -0500 Subject: [PATCH] python3Packages.geoarrow-rust: init at 0.6.1 --- .../python-modules/geoarrow-rust/default.nix | 130 ++++++++++++++++++ pkgs/top-level/python-packages.nix | 5 + 2 files changed, 135 insertions(+) create mode 100644 pkgs/development/python-modules/geoarrow-rust/default.nix diff --git a/pkgs/development/python-modules/geoarrow-rust/default.nix b/pkgs/development/python-modules/geoarrow-rust/default.nix new file mode 100644 index 000000000000..f7c5413a6fc4 --- /dev/null +++ b/pkgs/development/python-modules/geoarrow-rust/default.nix @@ -0,0 +1,130 @@ +{ + lib, + buildPythonPackage, + fetchFromGitHub, + rustPlatform, + pytestCheckHook, + arro3-core, + pyarrow, + pyproj, + numpy, + pandas, + geoarrow-types, +}: +let + version = "0.6.1"; + + src = fetchFromGitHub { + owner = "geoarrow"; + repo = "geoarrow-rs"; + tag = "py-v${version}"; + hash = "sha256-3/HOQsgQVpEd9iAVvIHvpb0slg55/V6X6KLLvhDUVz4="; + }; + + cargoDeps = rustPlatform.fetchCargoVendor { + inherit src version; + pname = "geoarrow-rust-vendor"; + cargoRoot = "python"; + hash = "sha256-UjLqynlt5Rkx10hlnaY76wDRhJwhNvHmkhpj04Y8/ek="; + }; + + commonMeta = { + homepage = "https://github.com/geoarrow/geoarrow-rs"; + changelog = "https://github.com/geoarrow/geoarrow-rs/releases/tag/py-v${version}"; + license = with lib.licenses; [ + asl20 + mit + ]; + maintainers = with lib.maintainers; [ daspk04 ]; + }; + + buildGeoArrowPackage = + { + pname, + subdir, + description, + pythonImportsCheck, + dependencies ? [ ], + }: + buildPythonPackage { + inherit + pname + version + src + cargoDeps + dependencies + pythonImportsCheck + ; + pyproject = true; + + sourceRoot = "${src.name}/python/${subdir}"; + cargoRoot = ".."; + __structuredAttrs = true; + + nativeBuildInputs = with rustPlatform; [ + cargoSetupHook + maturinBuildHook + ]; + + postPatch = '' + chmod -R +w ../.. + ''; + + # set target directory so maturin can find the compiled libraries in this workspace setup + env = { + CARGO_TARGET_DIR = "./target"; + }; + + passthru.tests = { inherit geoarrow-rust-tests; }; + + meta = commonMeta // { + inherit description; + }; + }; + + geoarrow-rust-core = buildGeoArrowPackage { + pname = "geoarrow-rust-core"; + subdir = "geoarrow-core"; + description = "Core library for representing GeoArrow data in Python"; + pythonImportsCheck = [ "geoarrow.rust.core" ]; + dependencies = [ + arro3-core + pyproj + ]; + }; + + geoarrow-rust-io = buildGeoArrowPackage { + pname = "geoarrow-rust-io"; + subdir = "geoarrow-io"; + description = "Rust-based readers and writers for GeoArrow in Python"; + pythonImportsCheck = [ "geoarrow.rust.io" ]; + dependencies = [ + arro3-core + pyproj + ]; + }; + + geoarrow-rust-tests = buildPythonPackage { + pname = "geoarrow-rust-tests"; + inherit src version; + + pyproject = false; + dontBuild = true; + dontInstall = true; + + nativeCheckInputs = [ + pytestCheckHook + geoarrow-types + pandas + pyarrow + numpy + geoarrow-rust-core + geoarrow-rust-io + ]; + + pytestFlags = [ "python" ]; + }; +in +{ + inherit geoarrow-rust-core geoarrow-rust-io; +} diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index 24cdff7b9640..6b6557000871 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -6204,6 +6204,11 @@ self: super: with self; { geoarrow-pyarrow = callPackage ../development/python-modules/geoarrow-pyarrow { }; + inherit (callPackage ../development/python-modules/geoarrow-rust { }) + geoarrow-rust-core + geoarrow-rust-io + ; + geoarrow-types = callPackage ../development/python-modules/geoarrow-types { }; geocachingapi = callPackage ../development/python-modules/geocachingapi { };