summaryrefslogtreecommitdiff
path: root/pkgs/development/python-modules/pysma/default.nix
blob: 71e9f563b30148ca5dd38630688fc781b1ff5b54 (plain)
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
{
  lib,
  aiohttp,
  aioresponses,
  attrs,
  buildPythonPackage,
  fetchFromGitHub,
  jmespath,
  pytest-asyncio,
  pytest-cov-stub,
  pytestCheckHook,
  uv-build,
}:

buildPythonPackage (finalAttrs: {
  pname = "pysma";
  version = "1.1.0";
  pyproject = true;

  src = fetchFromGitHub {
    owner = "kellerza";
    repo = "pysma";
    tag = "v${finalAttrs.version}";
    hash = "sha256-fRYpWr3eny9Ore2uQhPgVDSb+M1KYy1cy9bE2+Em3xU=";
  };

  postPatch = ''
    substituteInPlace pyproject.toml \
      --replace-fail "uv-build>=0.9,<0.10" uv-build
  '';

  build-system = [ uv-build ];

  dependencies = [
    aiohttp
    attrs
    jmespath
  ];

  nativeCheckInputs = [
    aioresponses
    pytest-asyncio
    pytest-cov-stub
    pytestCheckHook
  ];

  pythonImportsCheck = [ "pysma" ];

  meta = {
    description = "Python library for interacting with SMA Solar's WebConnect";
    homepage = "https://github.com/kellerza/pysma";
    changelog = "https://github.com/kellerza/pysma/blob/${finalAttrs.src.tag}/CHANGELOG.md";
    license = lib.licenses.mit;
    maintainers = with lib.maintainers; [ fab ];
  };
})