Skip to content

Commit

Permalink
python312Packages.hdmedians: modernize, fix testing, adopt
Browse files Browse the repository at this point in the history
  • Loading branch information
TomaSajt committed Jul 9, 2024
1 parent 06ed889 commit a5afd9b
Showing 1 changed file with 38 additions and 13 deletions.
51 changes: 38 additions & 13 deletions pkgs/development/python-modules/hdmedians/default.nix
Original file line number Diff line number Diff line change
@@ -1,40 +1,65 @@
{
lib,
buildPythonPackage,
pythonOlder,
fetchPypi,
nose,
cython,
oldest-supported-numpy,
setuptools,
numpy,
nose,
}:

buildPythonPackage rec {
version = "0.14.2";
format = "setuptools";
pname = "hdmedians";
version = "0.14.2";
pyproject = true;

src = fetchPypi {
inherit pname version;
sha256 = "b47aecb16771e1ba0736557255d80ae0240b09156bff434321de559b359ac2d6";
};

# nose was specified in setup.py as a build dependency...
buildInputs = [
# nose was marked as a build-time dependency, but is only used for testing
postPatch = ''
substituteInPlace setup.py \
--replace-fail "'nose>=1.0', " ""
'';

build-system = [
cython
nose
oldest-supported-numpy
setuptools
];
propagatedBuildInputs = [ numpy ];

# cannot resolve path for packages in tests
doCheck = false;
dependencies = [ numpy ];

# nose no longer builds on python >=3.12
doCheck = pythonOlder "3.12";

nativeCheckInputs = [ nose ];

checkPhase = ''
nosetests
runHook preCheck
# force python to resolve the package from $out, where the cython ext files actually exist
mv hdmedians/tests tests
rm -r hdmedians
nosetests tests
runHook postCheck
'';

meta = with lib; {
pythonImportsCheck = [
"hdmedians"
"hdmedians.geomedian" # ext
];

meta = {
homepage = "https://github.com/daleroberts/hdmedians";
description = "High-dimensional medians";
license = licenses.gpl3;
maintainers = [ ];
license = lib.licenses.asl20;
maintainers = with lib.maintainers; [ tomasajt ];
};
}

0 comments on commit a5afd9b

Please sign in to comment.