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