Skip to content

Commit

Permalink
Merge pull request #314101 from sikmir/mapclassify
Browse files Browse the repository at this point in the history
python3Packages.mapclassify: init at 2.6.1
  • Loading branch information
imincik authored May 26, 2024
2 parents 0efdd36 + c01eae8 commit e21ac1f
Show file tree
Hide file tree
Showing 5 changed files with 281 additions and 0 deletions.
54 changes: 54 additions & 0 deletions pkgs/development/python-modules/geodatasets/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
{
lib,
buildPythonPackage,
fetchFromGitHub,
pytestCheckHook,
pythonOlder,

geopandas,
pooch,
pyogrio,
setuptools-scm,
}:

buildPythonPackage rec {
pname = "geodatasets";
version = "2023.12.0";
pyproject = true;
disabled = pythonOlder "3.8";

src = fetchFromGitHub {
owner = "geopandas";
repo = "geodatasets";
rev = version;
hash = "sha256-yecAky3lCKcSgW4kkYTBNnyKyIWnGSBL600wVgGN8CE=";
};

build-system = [ setuptools-scm ];

propagatedBuildInputs = [ pooch ];

nativeCheckInputs = [
geopandas
pyogrio
pytestCheckHook
];

preCheck = ''
export HOME=$TMPDIR
'';

pytestFlagsArray = [
# disable tests which require network access
"-m 'not request'"
];

pythonImportsCheck = [ "geodatasets" ];

meta = {
description = "Spatial data examples";
homepage = "https://geodatasets.readthedocs.io/";
license = lib.licenses.bsd3;
maintainers = lib.teams.geospatial.members;
};
}
86 changes: 86 additions & 0 deletions pkgs/development/python-modules/libpysal/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
{
lib,
buildPythonPackage,
fetchFromGitHub,
pytestCheckHook,
pythonOlder,

beautifulsoup4,
fiona,
geodatasets,
geopandas,
numpy,
packaging,
pandas,
platformdirs,
requests,
scikit-learn,
scipy,
setuptools-scm,
shapely,
}:

buildPythonPackage rec {
pname = "libpysal";
version = "4.10";
pyproject = true;
disabled = pythonOlder "3.10";

src = fetchFromGitHub {
owner = "pysal";
repo = "libpysal";
rev = "v${version}";
hash = "sha256-jzSkIFSIXc039KR4fS1HOI/Rj0mHwbArn2hD+zfAZDg=";
};

build-system = [ setuptools-scm ];

propagatedBuildInputs = [
beautifulsoup4
fiona
geopandas
numpy
packaging
pandas
platformdirs
requests
scikit-learn
scipy
shapely
];

nativeCheckInputs = [
geodatasets
pytestCheckHook
];

preCheck = ''
export HOME=$TMPDIR
'';

# requires network access
disabledTestPaths = [
"libpysal/cg/tests/test_geoJSON.py"
"libpysal/examples/tests/test_available.py"
"libpysal/graph/tests/test_base.py"
"libpysal/graph/tests/test_builders.py"
"libpysal/graph/tests/test_contiguity.py"
"libpysal/graph/tests/test_kernel.py"
"libpysal/graph/tests/test_matching.py"
"libpysal/graph/tests/test_plotting.py"
"libpysal/graph/tests/test_triangulation.py"
"libpysal/graph/tests/test_utils.py"
"libpysal/graph/tests/test_set_ops.py"
"libpysal/weights/tests/test_contiguity.py"
"libpysal/weights/tests/test_util.py"
];

pythonImportsCheck = [ "libpysal" ];

meta = {
description = "A library of spatial analysis functions";
homepage = "https://pysal.org/libpysal/";
license = lib.licenses.bsd3;
maintainers = lib.teams.geospatial.members;
};
}
58 changes: 58 additions & 0 deletions pkgs/development/python-modules/mapclassify/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
{
lib,
buildPythonPackage,
fetchFromGitHub,
pytestCheckHook,
pythonOlder,

geopandas,
libpysal,
networkx,
numpy,
pandas,
scikit-learn,
scipy,
setuptools-scm,
}:

buildPythonPackage rec {
pname = "mapclassify";
version = "2.6.1";
pyproject = true;
disabled = pythonOlder "3.9";

src = fetchFromGitHub {
owner = "pysal";
repo = "mapclassify";
rev = "v${version}";
hash = "sha256-lb2Ui6zdx6MQBtBrL/Xj9k7cm6De8aLEuBLZDhPPDnE=";
};

build-system = [ setuptools-scm ];

propagatedBuildInputs = [
networkx
numpy
pandas
scikit-learn
scipy
];

nativeCheckInputs = [
pytestCheckHook
geopandas
libpysal
];

# requires network access
disabledTestPaths = [ "mapclassify/tests/test_greedy.py" ];

pythonImportsCheck = [ "mapclassify" ];

meta = {
description = "Classification Schemes for Choropleth Maps";
homepage = "https://pysal.org/mapclassify/";
license = lib.licenses.bsd3;
maintainers = lib.teams.geospatial.members;
};
}
75 changes: 75 additions & 0 deletions pkgs/development/python-modules/pyogrio/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
{
lib,
buildPythonPackage,
fetchFromGitHub,
pytestCheckHook,
pythonOlder,

certifi,
cython,
gdal,
numpy,
packaging,
setuptools,
versioneer,
wheel,
}:

buildPythonPackage rec {
pname = "pyogrio";
version = "0.8.0";
pyproject = true;
disabled = pythonOlder "3.8";

src = fetchFromGitHub {
owner = "geopandas";
repo = "pyogrio";
rev = "v${version}";
hash = "sha256-h4Rv5xOWSJSv0nLbosviz5EiF/IsZO5wzBel9YRd0Bg=";
};

postPatch = ''
substituteInPlace pyproject.toml \
--replace-fail "versioneer[toml]==0.28" "versioneer[toml]"
'' + lib.optionalString (!pythonOlder "3.12") ''
substituteInPlace setup.py \
--replace-fail "distutils" "setuptools._distutils"
'';

nativeBuildInputs = [
cython
gdal # for gdal-config
setuptools
versioneer
wheel
] ++ versioneer.optional-dependencies.toml;

buildInputs = [ gdal ];

propagatedBuildInputs = [
certifi
numpy
packaging
];

nativeCheckInputs = [ pytestCheckHook ];

preCheck = ''
python setup.py build_ext --inplace
'';

pytestFlagsArray = [
# disable tests which require network access
"-m 'not network'"
];

pythonImportsCheck = [ "pyogrio" ];

meta = {
description = "Vectorized spatial vector file format I/O using GDAL/OGR";
homepage = "https://pyogrio.readthedocs.io/";
changelog = "https://github.com/geopandas/pyogrio/blob/${src.rev}/CHANGES.md";
license = lib.licenses.mit;
maintainers = lib.teams.geospatial.members;
};
}
8 changes: 8 additions & 0 deletions pkgs/top-level/python-packages.nix
Original file line number Diff line number Diff line change
Expand Up @@ -4711,6 +4711,8 @@ self: super: with self; {

geocoder = callPackage ../development/python-modules/geocoder { };

geodatasets = callPackage ../development/python-modules/geodatasets { };

geographiclib = callPackage ../development/python-modules/geographiclib { };

geoip2 = callPackage ../development/python-modules/geoip2 { };
Expand Down Expand Up @@ -6690,6 +6692,8 @@ self: super: with self; {

libpyfoscam = callPackage ../development/python-modules/libpyfoscam { };

libpysal = callPackage ../development/python-modules/libpysal { };

libpyvivotek = callPackage ../development/python-modules/libpyvivotek { };

libpwquality = lib.pipe pkgs.libpwquality [
Expand Down Expand Up @@ -7170,6 +7174,8 @@ self: super: with self; {

mapbox-earcut = callPackage ../development/python-modules/mapbox-earcut { };

mapclassify = callPackage ../development/python-modules/mapclassify { };

mariadb = callPackage ../development/python-modules/mariadb { };

marimo = callPackage ../development/python-modules/marimo { };
Expand Down Expand Up @@ -9996,6 +10002,8 @@ self: super: with self; {

pynx584 = callPackage ../development/python-modules/pynx584 { };

pyogrio = callPackage ../development/python-modules/pyogrio { };

pyorthanc = callPackage ../development/python-modules/pyorthanc { };

pyoutbreaksnearme = callPackage ../development/python-modules/pyoutbreaksnearme { };
Expand Down

0 comments on commit e21ac1f

Please sign in to comment.