Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add/Update python packages #64962

Closed
30 changes: 30 additions & 0 deletions pkgs/development/misc/h3/default.nix
@@ -0,0 +1,30 @@
{ stdenv
, cmake
, fetchFromGitHub
}:

stdenv.mkDerivation rec {
pname = "h3";
version = "3.4.4";

src = fetchFromGitHub {
owner = "uber";
repo = "h3";
rev = "v${version}";
sha256 = "0d0730iwz290qcryj0ij1mnvmx89plcrg21czw5y4k63wlq8ppfg";
};

nativeBuildInputs = [ cmake ];

cmakeFlags = [
"-DBUILD_SHARED_LIBS=ON"
"-DENABLE_LINTING=OFF"
];

meta = with stdenv.lib; {
homepage = "https://github.com/uber/h3";
description = "Hexagonal hierarchical geospatial indexing system";
license = licenses.asl20;
maintainers = [ maintainers.kalbasit ];
};
}
20 changes: 20 additions & 0 deletions pkgs/development/python-modules/area/default.nix
@@ -0,0 +1,20 @@
{ lib, buildPythonPackage, fetchPypi }:

buildPythonPackage rec {
pname = "area";
version = "1.1.1";

src = fetchPypi {
inherit pname version;
sha256 = "18k5hwmlxhajlq306zxndsglb11vv8vd4vpmwx8dpvfxd1kbksya";
};

# tests not working on the package from pypi
doCheck = false;

meta = with lib; {
description = "Calculate the area inside of any GeoJSON geometry. This is a port of Mapbox’s geojson-area for Python.";
homepage = "https://github.com/scisco/area";
license = licenses.bsd2;
};
}
20 changes: 20 additions & 0 deletions pkgs/development/python-modules/geographiclib/default.nix
@@ -0,0 +1,20 @@
{ lib
, buildPythonPackage
, fetchPypi
}:

buildPythonPackage rec {
pname = "geographiclib";
version = "1.49";

src = fetchPypi {
inherit pname version;
sha256 = "0cv514gcafbxpa3p6prz5aqxxxxc7l85v1r83fw5f2p8zi4acpb3";
};

meta = {
description = "The geodesic routines from GeographicLib";
homepage = "https://geographiclib.sourceforge.io/1.49/python";
license = with lib.licenses; [ mit ];
};
}
10 changes: 4 additions & 6 deletions pkgs/development/python-modules/geopy/default.nix
@@ -1,30 +1,28 @@
{ stdenv
, buildPythonPackage
, fetchPypi
, geographiclib
, isPy27
, mock
, tox
, pylint
, pythonOlder
, tox
}:

buildPythonPackage rec {
pname = "geopy";
version = "1.20.0";
disabled = !isPy27;

src = fetchPypi {
inherit pname version;
sha256 = "9419bc90ee6231590c4ae7acf1cf126cefbd0736942da7a6a1436946e80830e2";
};

doCheck = false; # too much

buildInputs = [ mock tox pylint ];
propagatedBuildInputs = [ geographiclib ];

meta = with stdenv.lib; {
homepage = "https://github.com/geopy/geopy";
description = "Python Geocoding Toolbox";
license = licenses.mit;
};

}
35 changes: 35 additions & 0 deletions pkgs/development/python-modules/h3/default.nix
@@ -0,0 +1,35 @@
{ stdenv
, buildPythonPackage
, cmake
, fetchPypi
, h3
, python
}:

buildPythonPackage rec {
pname = "h3";
version = "3.4.3";

src = fetchPypi {
inherit pname version;
sha256 = "07dlqpr1r4kzb3gci395plpss8gxvvrij40l6w0mylyg7fkab4m2";
};

patches = [
./disable-custom-install.patch
./hardcode-h3-path.patch
];

preBuild = ''
substituteInPlace h3/h3.py \
--subst-var-by libh3_path ${h3}/lib/libh3${stdenv.hostPlatform.extensions.sharedLibrary}
'';

meta = with stdenv.lib; {
homepage = "https://github.com/uber/h3-py";
description = "This library provides Python bindings for the H3 Core Library.";
license = licenses.asl20;
platforms = platforms.unix ++ platforms.darwin;
maintainers = [ maintainers.kalbasit ];
};
}
41 changes: 41 additions & 0 deletions pkgs/development/python-modules/h3/disable-custom-install.patch
@@ -0,0 +1,41 @@
diff --git a/setup.py b/setup.py
index 8e1c220..45297b6 100644
--- a/setup.py
+++ b/setup.py
@@ -25,20 +25,6 @@ class CustomBuildExtCommand(build_ext):
install_h3(h3_version)


-# Tested with wheel v0.29.0
-class BinaryDistribution(Distribution):
- def __init__(self, attrs=None):
- Distribution.__init__(self, attrs)
- # The values used for the name and sources in the Extension below are
- # not important, because we override the build_ext command above.
- # The normal C extension building logic is never invoked, and is
- # replaced with our own custom logic. However, ext_modules cannot be
- # empty, because this signals to other parts of distutils that our
- # package contains C extensions and thus needs to be built for
- # different platforms separately.
- self.ext_modules = [Extension('h3c', [])]
-
-
long_description = open('README.rst').read()

setup(
@@ -52,14 +38,10 @@ setup(
url='https://github.com/uber/h3-py.git',
packages=find_packages(exclude=['tests', 'tests.*']),
install_requires=[],
- cmdclass={
- 'build_ext': CustomBuildExtCommand,
- },
package_data={
'h-py':
['out/*.dylib' if platform.system() == 'Darwin' else (
'out/*.dll' if platform.system() == 'Windows' else
'out/*.so.*')]
},
- license='Apache License 2.0',
- distclass=BinaryDistribution)
+ license='Apache License 2.0')
19 changes: 19 additions & 0 deletions pkgs/development/python-modules/h3/hardcode-h3-path.patch
@@ -0,0 +1,19 @@
diff --git a/h3/h3.py b/h3/h3.py
index 18cf168..2cc7812 100644
--- a/h3/h3.py
+++ b/h3/h3.py
@@ -34,13 +34,7 @@ from ctypes import (
POINTER,
)

-_dirname = os.path.dirname(__file__)
-libh3_path = ('{}/{}'.format(_dirname, 'out/libh3.1.dylib')
- if platform.system() == 'Darwin' else (
- '{}/{}'.format(_dirname, 'out/h3.dll') if platform.system() == 'Windows' else
- '{}/{}'.format(_dirname, 'out/libh3.so.1')))
-
-libh3 = cdll.LoadLibrary(libh3_path)
+libh3 = cdll.LoadLibrary('@libh3_path@')

# Type of an H3 index
H3Index = c_ulonglong
12 changes: 6 additions & 6 deletions pkgs/development/python-modules/pycryptodomex/default.nix
Expand Up @@ -2,16 +2,16 @@

buildPythonPackage rec {
pname = "pycryptodomex";
version = "3.7.3";
version = "3.8.2";

src = fetchPypi {
inherit pname version;
sha256 = "01qnl81s8qdmkmwindvcz8zk05bbhk5iin3hppwbbimxdfpia2z5";
};

meta = {
description = "A self-contained cryptographic library for Python";
homepage = https://www.pycryptodome.org;
license = lib.licenses.bsd2;
};

src = fetchPypi {
inherit pname version;
sha256 = "b70fe991564e178af02ccf89435a8f9e8d052707a7c4b95bf6027cb785da3175";
};
}
6 changes: 2 additions & 4 deletions pkgs/development/python-modules/s3transfer/default.nix
Expand Up @@ -14,15 +14,13 @@

buildPythonPackage rec {
pname = "s3transfer";
version = "0.2.0";
version = "0.2.1";

src = fetchPypi {
inherit pname version;
sha256 = "f23d5cb7d862b104401d9021fc82e5fa0e0cf57b7660a1331425aab0c691d021";
sha256 = "17dckw0wn47h79z9asjwm9w27sgxkbnmywkr59n5gkd371kr5z3f";
};

foo = 1;

propagatedBuildInputs =
[ botocore
] ++ stdenv.lib.optional (pythonOlder "3") futures;
Expand Down
@@ -0,0 +1,59 @@
{ buildPythonPackage
, azure-storage-blob
, boto3
, certifi
, cffi
, fetchPypi
, future
, idna
, ijson
, isPy3k
, lib
, pyarrow
, pyasn1-modules
, pycryptodomex
, pyjwt
, pyopenssl
, pytz
, six
, urllib3
}:

buildPythonPackage rec {
pname = "snowflake-connector-python";
version = "1.8.5";

src = fetchPypi {
inherit pname version;
sha256 = "0ll1brxs933za18hcsc3lrykk9x9yczyv3qs13zv3ql60pxfdmcn";
};

propagatedBuildInputs = [
azure-storage-blob
boto3
certifi
cffi
future
idna
ijson
pycryptodomex
pyjwt
pyopenssl
pytz
six
] ++ lib.optionals (!isPy3k) [
pyarrow
pyasn1-modules
urllib3
];

# tests are not working
# XXX: fix the tests
doCheck = false;

meta = with lib; {
description = "Snowflake Connector for Python";
homepage = "https://www.snowflake.com/";
license = licenses.asl20;
};
}
27 changes: 27 additions & 0 deletions pkgs/development/python-modules/snowflake-sqlalchemy/default.nix
@@ -0,0 +1,27 @@
{ buildPythonPackage
, lib
, fetchPypi
, sqlalchemy
, snowflake-connector-python
}:

buildPythonPackage rec {
pname = "snowflake-sqlalchemy";
version = "1.1.13";

src = fetchPypi {
inherit pname version;
sha256 = "15pyx8bdy6p5kjc0ldykzp0lwr3wqbhf16258yvlzfwm0hm3cvb9";
};

propagatedBuildInputs = [
sqlalchemy
snowflake-connector-python
];

meta = with lib; {
description = "Snowflake SQLAlchemy Dialect";
homepage = "https://www.snowflake.net/";
license = licenses.asl20;
};
}
30 changes: 30 additions & 0 deletions pkgs/development/python-modules/timezonefinder/default.nix
@@ -0,0 +1,30 @@
{ buildPythonPackage
, lib
, fetchPypi
, importlib-resources
, numba
, numpy
}:

buildPythonPackage rec {
pname = "timezonefinder";
version = "4.1.0";

src = fetchPypi {
inherit pname version;
sha256 = "18wn6k9is4kh5ijglmvb7g0xxpjxf8qdr4kddbzw1ra30f55as85";
};

propagatedBuildInputs = [
importlib-resources
numpy
];

checkInputs = [ numba ];

meta = with lib; {
description = "fast python package for finding the timezone of any point on earth (coordinates) offline";
homepage = "https://github.com/MrMinimal64/timezonefinder";
license = licenses.mit;
};
}
2 changes: 2 additions & 0 deletions pkgs/top-level/all-packages.nix
Expand Up @@ -8888,6 +8888,8 @@ in
samples = true;
};

h3 = callPackage ../development/misc/h3 { };

amtk = callPackage ../development/libraries/amtk { };

avrlibc = callPackage ../development/misc/avr/libc {};
Expand Down