about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/python-modules/withings-api/default.nix
blob: 226907f9e95daf5a030d5b926474dfc25d55b84c (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
{ lib
, buildPythonPackage
, pythonOlder
, fetchFromGitHub
, poetry-core
, arrow
, requests-oauthlib
, typing-extensions
, pydantic
, responses
, pytestCheckHook
}:

buildPythonPackage rec {
  pname = "withings-api";
  version = "2.4.0";
  format = "pyproject";

  disabled = pythonOlder "3.6";

  src = fetchFromGitHub {
    owner = "vangorra";
    repo = "python_withings_api";
    rev = "refs/tags/${version}";
    hash = "sha256-8cOLHYnodPGk1b1n6xbVyW2iju3cG6MgnzYTKDsP/nw=";
  };

  postPatch = ''
    substituteInPlace pyproject.toml \
      --replace 'requests-oauth = ">=0.4.1"' ''' \
      --replace 'addopts = "--capture no --cov ./withings_api --cov-report html:build/coverage_report --cov-report term --cov-report xml:build/coverage.xml"' '''
  '';

  nativeBuildInputs = [
    poetry-core
  ];

  propagatedBuildInputs = [
    arrow
    requests-oauthlib
    typing-extensions
    pydantic
  ];

  nativeCheckInputs = [
    pytestCheckHook
    responses
  ];

  meta = with lib; {
    description = "Library for the Withings Health API";
    homepage = "https://github.com/vangorra/python_withings_api";
    license = licenses.mit;
    maintainers = with maintainers; [ kittywitch ];
    broken = versionAtLeast pydantic.version "2";
  };
}