From 34bd524490ea41ce484543d3456b26414906fc6a Mon Sep 17 00:00:00 2001 From: Gaetan Lepage Date: Wed, 1 Jul 2026 09:33:09 +0000 Subject: [PATCH] python3Packages.nianet: cleanup, fix --- .../python-modules/nianet/default.nix | 41 ++++++++++--------- 1 file changed, 21 insertions(+), 20 deletions(-) diff --git a/pkgs/development/python-modules/nianet/default.nix b/pkgs/development/python-modules/nianet/default.nix index d64a30c090a0..7920c0c94938 100644 --- a/pkgs/development/python-modules/nianet/default.nix +++ b/pkgs/development/python-modules/nianet/default.nix @@ -2,33 +2,43 @@ lib, buildPythonPackage, fetchFromGitHub, + + # build-system + poetry-core, + + # dependencies niapy, numpy, - poetry-core, - pytestCheckHook, scikit-learn, - toml-adapt, - tomli, torch, + + # tests + pytestCheckHook, + pyyaml, + tomli, }: -buildPythonPackage rec { +buildPythonPackage (finalAttrs: { pname = "nianet"; version = "1.1.4"; pyproject = true; + __structuredAttrs = true; src = fetchFromGitHub { owner = "SasoPavlic"; repo = "nianet"; - tag = "version_${version}"; - sha256 = "sha256-FZipl6Z9AfiL6WH0kvUn8bVxt8JLdDVlmTSqnyxe0nY="; + tag = "version_${finalAttrs.version}"; + hash = "sha256-FZipl6Z9AfiL6WH0kvUn8bVxt8JLdDVlmTSqnyxe0nY="; }; build-system = [ poetry-core - toml-adapt ]; + pythonRelaxDeps = [ + "numpy" + "torch" + ]; dependencies = [ niapy numpy @@ -36,18 +46,9 @@ buildPythonPackage rec { torch ]; - pythonRelaxDeps = [ - "numpy" - ]; - - # create niapy and torch dep version consistent - preBuild = '' - toml-adapt -path pyproject.toml -a change -dep niapy -ver X - toml-adapt -path pyproject.toml -a change -dep torch -ver X - ''; - nativeCheckInputs = [ pytestCheckHook + pyyaml tomli ]; @@ -56,8 +57,8 @@ buildPythonPackage rec { meta = { description = "Designing and constructing neural network topologies using nature-inspired algorithms"; homepage = "https://github.com/SasoPavlic/NiaNet"; - changelog = "https://github.com/SasoPavlic/NiaNet/releases/tag/v${version}"; + changelog = "https://github.com/SasoPavlic/NiaNet/releases/tag/${finalAttrs.src.tag}"; license = lib.licenses.mit; maintainers = with lib.maintainers; [ firefly-cpp ]; }; -} +})