1{
2 lib,
3 aiohttp,
4 buildPythonPackage,
5 fetchPypi,
6 h11,
7 maxminddb,
8 mocket,
9 pytestCheckHook,
10 pythonAtLeast,
11 pythonOlder,
12 requests-mock,
13 requests,
14 setuptools-scm,
15 setuptools,
16 urllib3,
17}:
18
19buildPythonPackage rec {
20 pname = "geoip2";
21 version = "4.8.0";
22 pyproject = true;
23
24 disabled = pythonOlder "3.6";
25
26 src = fetchPypi {
27 inherit pname version;
28 hash = "sha256-3ZzBgLfUFyQkDqSB1dU5FJ5lsjT2QoKyMbkXB5SprDU=";
29 };
30
31 build-system = [
32 setuptools
33 setuptools-scm
34 ];
35
36 propagatedBuildInputs = [
37 aiohttp
38 maxminddb
39 requests
40 urllib3
41 ];
42
43 nativeCheckInputs = [
44 h11
45 mocket
46 requests-mock
47 pytestCheckHook
48 ];
49
50 pythonImportsCheck = [ "geoip2" ];
51
52 disabledTests =
53 lib.optionals (pythonAtLeast "3.10") [
54 # https://github.com/maxmind/GeoIP2-python/pull/136
55 "TestAsyncClient"
56 ]
57 ++ lib.optionals (pythonAtLeast "3.10") [ "test_request" ];
58
59 meta = with lib; {
60 description = "GeoIP2 webservice client and database reader";
61 homepage = "https://github.com/maxmind/GeoIP2-python";
62 changelog = "https://github.com/maxmind/GeoIP2-python/blob/v${version}/HISTORY.rst";
63 license = licenses.asl20;
64 maintainers = [ ];
65 };
66}