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