1{
2 lib,
3 blessed,
4 browser-cookie3,
5 buildPythonPackage,
6 cloudscraper,
7 fetchPypi,
8 keyring,
9 keyrings-alt,
10 lxml,
11 measurement,
12 mock,
13 pytestCheckHook,
14 python-dateutil,
15 pythonOlder,
16 requests,
17 rich,
18 setuptools,
19 typing-extensions,
20}:
21
22buildPythonPackage rec {
23 pname = "myfitnesspal";
24 version = "2.1.2";
25 pyproject = true;
26
27 disabled = pythonOlder "3.7";
28
29 src = fetchPypi {
30 inherit pname version;
31 hash = "sha256-eE807M8qFDlSMAcE+GFJyve1YfmlWmB3ML9VJhMUeIE=";
32 };
33
34 pythonRelaxDeps = [ "typing-extensions" ];
35
36 nativeBuildInputs = [ setuptools ];
37
38 propagatedBuildInputs = [
39 blessed
40 browser-cookie3
41 cloudscraper
42 keyring
43 keyrings-alt
44 lxml
45 measurement
46 python-dateutil
47 requests
48 rich
49 typing-extensions
50 ];
51
52 nativeCheckInputs = [
53 mock
54 pytestCheckHook
55 ];
56
57 postPatch = ''
58 # Remove overly restrictive version constraints
59 sed -i -e "s/>=.*//" requirements.txt
60
61 # https://github.com/coddingtonbear/python-measurement/pull/8
62 substituteInPlace tests/test_client.py \
63 --replace-fail "Weight" "Mass" \
64 --replace-fail '"Mass"' '"Weight"'
65 '';
66
67 disabledTests = [
68 # Integration tests require an account to be set
69 "test_integration"
70 ];
71
72 pythonImportsCheck = [ "myfitnesspal" ];
73
74 meta = {
75 description = "Python module to access meal tracking data stored in MyFitnessPal";
76 mainProgram = "myfitnesspal";
77 homepage = "https://github.com/coddingtonbear/python-myfitnesspal";
78 license = lib.licenses.mit;
79 maintainers = with lib.maintainers; [ bhipple ];
80 };
81}