1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5 geopy,
6 httpx,
7 numpy,
8 poetry-core,
9 pytestCheckHook,
10 pytest-asyncio,
11 python-dateutil,
12 pythonOlder,
13 rapidfuzz,
14 scipy,
15 shapely,
16 time-machine,
17 xmltodict,
18}:
19
20buildPythonPackage rec {
21 pname = "avwx-engine";
22 version = "1.8.28";
23 pyproject = true;
24
25 disabled = pythonOlder "3.10";
26
27 src = fetchFromGitHub {
28 owner = "avwx-rest";
29 repo = "avwx-engine";
30 rev = "refs/tags/${version}";
31 hash = "sha256-sxOLhcmTJg/dTrtemr9BcfcBoHTP1eGo8U1ab8iSvUM=";
32 };
33
34 postPatch = ''
35 sed -i -e "/--cov/d" -e "/--no-cov/d" pyproject.toml
36 '';
37
38 build-system = [ poetry-core ];
39
40 dependencies = [
41 geopy
42 httpx
43 python-dateutil
44 xmltodict
45 ];
46
47 passthru.optional-dependencies = {
48 all = [
49 numpy
50 rapidfuzz
51 scipy
52 shapely
53 ];
54 fuzz = [ rapidfuzz ];
55 scipy = [
56 numpy
57 scipy
58 ];
59 shape = [ shapely ];
60 };
61
62 nativeCheckInputs = [
63 pytest-asyncio
64 pytestCheckHook
65 time-machine
66 ] ++ lib.flatten (builtins.attrValues passthru.optional-dependencies);
67
68 pythonImportsCheck = [ "avwx" ];
69
70 disabledTests = [
71 # Tests require network access
72 "fetch"
73 "test_nbm_all"
74 "test_station_nearest_ip"
75 ];
76
77 meta = with lib; {
78 description = "Aviation Weather parsing engine";
79 homepage = "https://github.com/avwx-rest/avwx-engine";
80 changelog = "https://github.com/avwx-rest/avwx-engine/blob/${version}/changelog.md";
81 license = licenses.mit;
82 maintainers = with maintainers; [ fab ];
83 };
84}